Class: GdsApi::GovUkDelivery
- Inherits:
-
Base
- Object
- Base
- GdsApi::GovUkDelivery
show all
- Defined in:
- lib/gds_api/gov_uk_delivery.rb
Instance Attribute Summary
Attributes inherited from Base
#options
Instance Method Summary
collapse
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.
6
7
8
|
# File 'lib/gds_api/gov_uk_delivery.rb', line 6
def initialize(endpoint_url, options = {})
super(endpoint_url, options.merge(timeout: 10))
end
|
Instance Method Details
#notify(feed_urls, subject, body) ⇒ Object
29
30
31
32
33
|
# File 'lib/gds_api/gov_uk_delivery.rb', line 29
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
22
23
24
25
26
27
|
# File 'lib/gds_api/gov_uk_delivery.rb', line 22
def signup_url(feed_url)
response = get_json("#{base_url}/list-url?feed_url=#{CGI.escape(feed_url)}")
if response
response['list_url']
end
end
|
#subscribe(email, feed_urls) ⇒ Object
10
11
12
13
14
|
# File 'lib/gds_api/gov_uk_delivery.rb', line 10
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
16
17
18
19
20
|
# File 'lib/gds_api/gov_uk_delivery.rb', line 16
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
|