Class: GdsApi::Panopticon
Defined Under Namespace
Classes: Registerer
Instance Attribute Summary
Attributes inherited from Base
#options
Instance Method Summary
collapse
#ignoring
Methods inherited from Base
#adapter_name, #client, #create_client, #initialize, #url_for_slug
Constructor Details
This class inherits a constructor from GdsApi::Base
Instance Method Details
#all ⇒ Object
9
10
11
12
13
|
# File 'lib/gds_api/panopticon.rb', line 9
def all
url = base_url + '.json'
json = get_json url
to_ostruct json
end
|
#artefact_for_slug(slug, opts = {}) ⇒ Object
15
16
17
18
|
# File 'lib/gds_api/panopticon.rb', line 15
def artefact_for_slug(slug, opts = {})
return nil if slug.nil? or slug == ''
get_json(url_for_slug(slug))
end
|
#create_artefact(artefact) ⇒ Object
20
21
22
23
24
|
# File 'lib/gds_api/panopticon.rb', line 20
def create_artefact(artefact)
ignoring GdsApi::HTTPErrorResponse do
create_artefact! artefact
end
end
|
#create_artefact!(artefact) ⇒ Object
26
27
28
|
# File 'lib/gds_api/panopticon.rb', line 26
def create_artefact!(artefact)
post_json!(base_url + ".json", artefact)
end
|
#curated_lists ⇒ Object
52
53
54
|
# File 'lib/gds_api/panopticon.rb', line 52
def curated_lists
get_json("#{@endpoint}/curated_lists.json").to_hash
end
|
#delete_artefact!(id_or_slug) ⇒ Object
48
49
50
|
# File 'lib/gds_api/panopticon.rb', line 48
def delete_artefact!(id_or_slug)
delete_json!("#{base_url}/#{id_or_slug}.json")
end
|
#put_artefact(id_or_slug, artefact) ⇒ Object
30
31
32
33
34
|
# File 'lib/gds_api/panopticon.rb', line 30
def put_artefact(id_or_slug, artefact)
ignoring GdsApi::HTTPErrorResponse do
put_artefact! id_or_slug, artefact
end
end
|
#put_artefact!(id_or_slug, artefact) ⇒ Object
36
37
38
|
# File 'lib/gds_api/panopticon.rb', line 36
def put_artefact!(id_or_slug, artefact)
put_json!("#{base_url}/#{id_or_slug}.json", artefact)
end
|
#update_artefact(id_or_slug, artefact) ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/gds_api/panopticon.rb', line 40
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
|