Class: GdsApi::Publisher
- Inherits:
-
Base
- Object
- Base
- GdsApi::Publisher
show all
- Defined in:
- lib/gds_api/publisher.rb
Instance Attribute Summary
Attributes inherited from Base
#options
Instance Method Summary
collapse
Methods inherited from Base
#client, #create_client, #get_list!, #initialize, #url_for_slug
Constructor Details
This class inherits a constructor from GdsApi::Base
Instance Method Details
#council_for_name(name) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/gds_api/publisher.rb', line 36
def council_for_name(name)
name = URI.escape(name)
json = get_json(
"#{@endpoint}/local_transactions/find_by_council_name?name=#{name}"
)
json.to_hash if json
end
|
#council_for_slug(slug, snac_codes) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/gds_api/publisher.rb', line 23
def council_for_slug(slug, snac_codes)
json = post_json(
"#{@endpoint}/local_transactions/#{slug}/verify_snac.json",
{'snac_codes' => snac_codes}
)
json['snac'] if json
end
|
#council_for_snac_code(snac) ⇒ Object
31
32
33
34
|
# File 'lib/gds_api/publisher.rb', line 31
def council_for_snac_code(snac)
json = get_json("#{@endpoint}/local_transactions/find_by_snac?snac=#{snac}")
json.to_hash if json
end
|
#publication_for_slug(slug, options = {}) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/gds_api/publisher.rb', line 9
def publication_for_slug(slug, options = {})
return nil if slug.nil? or slug == ''
response = get_json(url_for_slug(slug, options))
if response
container = response.to_ostruct
container.extend(GdsApi::PartMethods) if container.parts
convert_updated_date(container)
container
else
nil
end
end
|
#reindex_topic_editions(slug) ⇒ Object
5
6
7
|
# File 'lib/gds_api/publisher.rb', line 5
def reindex_topic_editions(slug)
post_json!("#{endpoint}/api/reindex-topic-editions/#{slug}")
end
|