Class: Courier::AsyncNotificationsClient
- Inherits:
-
Object
- Object
- Courier::AsyncNotificationsClient
- 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:) ⇒ AsyncNotificationsClient 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:) ⇒ AsyncNotificationsClient
190 191 192 193 |
# File 'lib/trycourier/notifications/client.rb', line 190 def initialize(request_client:) # @type [AsyncRequestClient] @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Object (readonly)
Returns the value of attribute request_client.
186 187 188 |
# File 'lib/trycourier/notifications/client.rb', line 186 def request_client @request_client end |
Instance Method Details
#cancel_submission(id:, submission_id:, request_options: nil) ⇒ Void
366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'lib/trycourier/notifications/client.rb', line 366 def cancel_submission(id:, submission_id:, request_options: nil) Async do @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 end |
#get_content(id:, request_options: nil) ⇒ Notifications::NotificationGetContentResponse
216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/trycourier/notifications/client.rb', line 216 def get_content(id:, request_options: nil) Async do 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 end |
#get_draft_content(id:, request_options: nil) ⇒ Notifications::NotificationGetContentResponse
233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/trycourier/notifications/client.rb', line 233 def get_draft_content(id:, request_options: nil) Async do 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 end |
#get_submission_checks(id:, submission_id:, request_options: nil) ⇒ Notifications::SubmissionChecksGetResponse
325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/trycourier/notifications/client.rb', line 325 def get_submission_checks(id:, submission_id:, request_options: nil) Async do 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 end |
#list(cursor: nil, request_options: nil) ⇒ Notifications::NotificationListResponse
198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/trycourier/notifications/client.rb', line 198 def list(cursor: nil, request_options: nil) Async do 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 end |
#replace_submission_checks(id:, submission_id:, checks:, request_options: nil) ⇒ Notifications::SubmissionChecksReplaceResponse
347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/trycourier/notifications/client.rb', line 347 def replace_submission_checks(id:, submission_id:, checks:, request_options: nil) Async do 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 end |
#update_draft_variations(id:, blocks: nil, channels: nil, request_options: nil) ⇒ Void
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/trycourier/notifications/client.rb', line 303 def update_draft_variations(id:, blocks: nil, channels: nil, request_options: nil) Async do @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 end |
#update_variations(id:, blocks: nil, channels: nil, request_options: nil) ⇒ Void
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/trycourier/notifications/client.rb', line 266 def update_variations(id:, blocks: nil, channels: nil, request_options: nil) Async do @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 end |