Class: Notifications::Client
- Inherits:
-
Object
- Object
- Notifications::Client
- Defined in:
- lib/notifications/client.rb,
lib/notifications/client/speaker.rb,
lib/notifications/client/version.rb,
lib/notifications/client/notification.rb,
lib/notifications/client/request_error.rb,
lib/notifications/client/response_notification.rb,
lib/notifications/client/notifications_collection.rb
Defined Under Namespace
Classes: Notification, NotificationsCollection, RequestError, ResponseNotification, Speaker
Constant Summary collapse
- PRODUCTION_BASE_URL =
"https://api.notifications.service.gov.uk".freeze
- VERSION =
"1.0.0".freeze
Instance Attribute Summary collapse
-
#speaker ⇒ Object
readonly
Returns the value of attribute speaker.
Instance Method Summary collapse
- #get_notification(id) ⇒ Notification
- #get_notifications(options = {}) ⇒ NotificationsCollection
-
#initialize(*args) ⇒ Client
constructor
A new instance of Client.
-
#send_email(args) ⇒ ResponseNotification
@see Notifications::Client::Speaker#post.
- #send_sms(args) ⇒ ResponseNotification
Constructor Details
Instance Attribute Details
#speaker ⇒ Object (readonly)
Returns the value of attribute speaker.
10 11 12 |
# File 'lib/notifications/client.rb', line 10 def speaker @speaker end |
Instance Method Details
#get_notification(id) ⇒ Notification
46 47 48 49 50 |
# File 'lib/notifications/client.rb', line 46 def get_notification(id) Notification.new( speaker.get(id) ) end |
#get_notifications(options = {}) ⇒ NotificationsCollection
64 65 66 67 68 |
# File 'lib/notifications/client.rb', line 64 def get_notifications( = {}) NotificationsCollection.new( speaker.get(nil, ) ) end |
#send_email(args) ⇒ ResponseNotification
@see Notifications::Client::Speaker#post
27 28 29 30 31 |
# File 'lib/notifications/client.rb', line 27 def send_email(args) ResponseNotification.new( speaker.post("email", args) ) end |
#send_sms(args) ⇒ ResponseNotification
36 37 38 39 40 |
# File 'lib/notifications/client.rb', line 36 def send_sms(args) ResponseNotification.new( speaker.post("sms", args) ) end |