Class: GdsApi::GovUkDelivery
Instance Attribute Summary
Attributes inherited from Base
#options
Instance Method Summary
collapse
#ignoring
Methods inherited from Base
#client, #create_client, #get_list!, #url_for_slug
Constructor Details
#initialize(endpoint_url, options = {}) ⇒ GovUkDelivery
Returns a new instance of GovUkDelivery.
8
9
10
|
# File 'lib/gds_api/gov_uk_delivery.rb', line 8
def initialize(endpoint_url, options={})
super(endpoint_url, options.merge({timeout: 10}))
end
|
Instance Method Details
#notify(feed_urls, subject, body) ⇒ Object
30
31
32
33
34
|
# File 'lib/gds_api/gov_uk_delivery.rb', line 30
def notify(feed_urls, subject, body)
data = {feed_urls: feed_urls, subject: subject, body: body}
url = "#{base_url}/notifications"
post_url(url, data)
end
|
#signup_url(feed_url) ⇒ Object
24
25
26
27
28
|
# File 'lib/gds_api/gov_uk_delivery.rb', line 24
def signup_url(feed_url)
if response = get_json("#{base_url}/list-url?feed_url=#{CGI.escape(feed_url)}")
response.list_url
end
end
|
#subscribe(email, feed_urls) ⇒ Object
12
13
14
15
16
|
# File 'lib/gds_api/gov_uk_delivery.rb', line 12
def subscribe(email, feed_urls)
data = {email: email, feed_urls: feed_urls}
url = "#{base_url}/subscriptions"
post_url(url, data)
end
|
#topic(feed_url, title, description = nil) ⇒ Object
18
19
20
21
22
|
# File 'lib/gds_api/gov_uk_delivery.rb', line 18
def topic(feed_url, title, description=nil)
data = {feed_url: feed_url, title: title, description: description}
url = "#{base_url}/lists"
post_url(url, data)
end
|