Class: Courier::TemplatesClient
- Inherits:
-
Object
- Object
- Courier::TemplatesClient
- Defined in:
- lib/trycourier/templates/client.rb
Instance Attribute Summary collapse
-
#request_client ⇒ Object
readonly
Returns the value of attribute request_client.
Instance Method Summary collapse
- #initialize(request_client:) ⇒ TemplatesClient constructor
-
#list(cursor: nil, request_options: nil) ⇒ Templates::ListTemplatesResponse
Returns a list of notification templates.
Constructor Details
#initialize(request_client:) ⇒ TemplatesClient
13 14 15 16 |
# File 'lib/trycourier/templates/client.rb', line 13 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.
9 10 11 |
# File 'lib/trycourier/templates/client.rb', line 9 def request_client @request_client end |
Instance Method Details
#list(cursor: nil, request_options: nil) ⇒ Templates::ListTemplatesResponse
Returns a list of notification templates
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/trycourier/templates/client.rb', line 23 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 Templates::ListTemplatesResponse.from_json(json_object: response.body) end |