Class: Courier::NotificationsClient
- Inherits:
-
Object
- Object
- Courier::NotificationsClient
- Defined in:
- lib/trycourier/notifications/client.rb
Instance Attribute Summary collapse
-
#request_client ⇒ Object
readonly
Returns the value of attribute request_client.
Instance Method Summary collapse
- #cancel_submission(id:, submission_id:, request_options: nil) ⇒ Void
- #get_content(id:, request_options: nil) ⇒ Notifications::NotificationGetContentResponse
- #get_draft_content(id:, request_options: nil) ⇒ Notifications::NotificationGetContentResponse
- #get_submission_checks(id:, submission_id:, request_options: nil) ⇒ Notifications::SubmissionChecksGetResponse
- #initialize(request_client:) ⇒ NotificationsClient constructor
- #list(cursor: nil, request_options: nil) ⇒ Notifications::NotificationListResponse
- #replace_submission_checks(id:, submission_id:, checks:, request_options: nil) ⇒ Notifications::SubmissionChecksReplaceResponse
- #update_draft_variations(id:, blocks: nil, channels: nil, request_options: nil) ⇒ Void
- #update_variations(id:, blocks: nil, channels: nil, request_options: nil) ⇒ Void
Constructor Details
#initialize(request_client:) ⇒ NotificationsClient
19 20 21 22 |
# File 'lib/trycourier/notifications/client.rb', line 19 def initialize(request_client:) # @type [RequestClient] @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Object (readonly)
Returns the value of attribute request_client.
15 16 17 |
# File 'lib/trycourier/notifications/client.rb', line 15 def request_client @request_client end |
Instance Method Details
#cancel_submission(id:, submission_id:, request_options: nil) ⇒ Void
173 174 175 176 177 178 179 180 181 182 |
# File 'lib/trycourier/notifications/client.rb', line 173 def cancel_submission(id:, submission_id:, request_options: nil) @request_client.conn.delete("/notifications/#{id}/#{submission_id}/checks") do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? unless &..nil? req.headers["Authorization"] = . end req.headers = { **req.headers, **(&.additional_headers || {}) }.compact end end |
#get_content(id:, request_options: nil) ⇒ Notifications::NotificationGetContentResponse
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/trycourier/notifications/client.rb', line 43 def get_content(id:, request_options: nil) response = @request_client.conn.get("/notifications/#{id}/content") do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? unless &..nil? req.headers["Authorization"] = . end req.headers = { **req.headers, **(&.additional_headers || {}) }.compact end Notifications::NotificationGetContentResponse.from_json(json_object: response.body) end |
#get_draft_content(id:, request_options: nil) ⇒ Notifications::NotificationGetContentResponse
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/trycourier/notifications/client.rb', line 58 def get_draft_content(id:, request_options: nil) response = @request_client.conn.get("/notifications/#{id}/draft/content") do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? unless &..nil? req.headers["Authorization"] = . end req.headers = { **req.headers, **(&.additional_headers || {}) }.compact end Notifications::NotificationGetContentResponse.from_json(json_object: response.body) end |
#get_submission_checks(id:, submission_id:, request_options: nil) ⇒ Notifications::SubmissionChecksGetResponse
136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/trycourier/notifications/client.rb', line 136 def get_submission_checks(id:, submission_id:, request_options: nil) response = @request_client.conn.get("/notifications/#{id}/#{submission_id}/checks") do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? unless &..nil? req.headers["Authorization"] = . end req.headers = { **req.headers, **(&.additional_headers || {}) }.compact end Notifications::SubmissionChecksGetResponse.from_json(json_object: response.body) end |
#list(cursor: nil, request_options: nil) ⇒ Notifications::NotificationListResponse
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/trycourier/notifications/client.rb', line 27 def list(cursor: nil, request_options: nil) response = @request_client.conn.get("/notifications") do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? unless &..nil? req.headers["Authorization"] = . end req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "cursor": cursor }.compact end Notifications::NotificationListResponse.from_json(json_object: response.body) end |
#replace_submission_checks(id:, submission_id:, checks:, request_options: nil) ⇒ Notifications::SubmissionChecksReplaceResponse
156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/trycourier/notifications/client.rb', line 156 def replace_submission_checks(id:, submission_id:, checks:, request_options: nil) response = @request_client.conn.put("/notifications/#{id}/#{submission_id}/checks") do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? unless &..nil? req.headers["Authorization"] = . end req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), checks: checks }.compact end Notifications::SubmissionChecksReplaceResponse.from_json(json_object: response.body) end |
#update_draft_variations(id:, blocks: nil, channels: nil, request_options: nil) ⇒ Void
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/trycourier/notifications/client.rb', line 120 def update_draft_variations(id:, blocks: nil, channels: nil, request_options: nil) @request_client.conn.post("/notifications/#{id}/draft/variations") do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? unless &..nil? req.headers["Authorization"] = . end req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), blocks: blocks, channels: channels }.compact end end |
#update_variations(id:, blocks: nil, channels: nil, request_options: nil) ⇒ Void
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/trycourier/notifications/client.rb', line 89 def update_variations(id:, blocks: nil, channels: nil, request_options: nil) @request_client.conn.post("/notifications/#{id}/variations") do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? unless &..nil? req.headers["Authorization"] = . end req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), blocks: blocks, channels: channels }.compact end end |