class GdsApi::Panopticon
def all
def all url = base_url + '.json' json = get_json url to_ostruct json end
def artefact_for_slug(slug, opts = {})
def artefact_for_slug(slug, opts = {}) return nil if slug.nil? or slug == '' get_json(url_for_slug(slug)) end
def base_url
def base_url "#{endpoint}/artefacts" end
def create_artefact(artefact)
def create_artefact(artefact) ignoring GdsApi::HTTPErrorResponse do create_artefact! artefact end end
def create_artefact!(artefact)
def create_artefact!(artefact) post_json!(base_url + ".json", artefact) end
def create_tag(attributes)
def create_tag(attributes) post_json!("#{endpoint}/tags.json", attributes) end
def delete_artefact!(id_or_slug)
def delete_artefact!(id_or_slug) delete_json!("#{base_url}/#{id_or_slug}.json") end
def publish_tag(tag_type, tag_id)
def publish_tag(tag_type, tag_id) post_json!( tag_url(tag_type, tag_id, '/publish'), # we don't need to send any more data along with the publish request, # but a body is still required, so sending an empty JSON hash instead { } ) end
def put_artefact(id_or_slug, artefact)
def put_artefact(id_or_slug, artefact) ignoring GdsApi::HTTPErrorResponse do put_artefact! id_or_slug, artefact end end
def put_artefact!(id_or_slug, artefact)
def put_artefact!(id_or_slug, artefact) put_json!("#{base_url}/#{id_or_slug}.json", artefact) end
def put_tag(tag_type, tag_id, attributes)
def put_tag(tag_type, tag_id, attributes) put_json!( tag_url(tag_type, tag_id), attributes ) end
def tag_url(tag_type, tag_id, action='')
def tag_url(tag_type, tag_id, action='') "#{endpoint}/tags/#{tag_type}/#{tag_id}#{action}.json" end
def update_artefact(id_or_slug, artefact)
def update_artefact(id_or_slug, artefact) self.class.logger.warn( "The update_artefact method is deprecated and may be removed in a " + "future release. You should use put_artefact instead." ) put_artefact(id_or_slug, artefact) end