Class: Payabli::Notificationlogs::Client
- Inherits:
-
Object
- Object
- Payabli::Notificationlogs::Client
- Defined in:
- lib/payabli/notificationlogs/client.rb
Instance Method Summary collapse
-
#bulk_retry_notification_logs(request_options: {}, **params) ⇒ untyped
Retry sending multiple notifications (maximum 50 IDs).
-
#get_notification_log(request_options: {}, **params) ⇒ Payabli::Types::NotificationLogDetail
Get detailed information for a specific notification log entry.
- #initialize(client:) ⇒ void constructor
-
#retry_notification_log(request_options: {}, **params) ⇒ Payabli::Types::NotificationLogDetail
Retry sending a specific notification.
-
#search_notification_logs(request_options: {}, **params) ⇒ Array[Payabli::Types::NotificationLog]
Search notification logs with filtering and pagination.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/payabli/notificationlogs/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#bulk_retry_notification_logs(request_options: {}, **params) ⇒ untyped
Retry sending multiple notifications (maximum 50 IDs). This is an async process, so use the search endpoint again to check the notification status.
This endpoint requires the notifications_create permission.
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/payabli/notificationlogs/client.rb', line 170 def bulk_retry_notification_logs(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v2/notificationlogs/retry", headers: headers, body: params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Payabli::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |
#get_notification_log(request_options: {}, **params) ⇒ Payabli::Types::NotificationLogDetail
Get detailed information for a specific notification log entry.
This endpoint requires the notifications_create OR notifications_read permission.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/payabli/notificationlogs/client.rb', line 88 def get_notification_log(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/notificationlogs/#{URI.encode_uri_component(params[:uuid].to_s)}", headers: headers, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Payabli::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Payabli::Types::NotificationLogDetail.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#retry_notification_log(request_options: {}, **params) ⇒ Payabli::Types::NotificationLogDetail
Retry sending a specific notification.
Permissions: notifications_create
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/payabli/notificationlogs/client.rb', line 129 def retry_notification_log(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/notificationlogs/#{URI.encode_uri_component(params[:uuid].to_s)}/retry", headers: headers, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Payabli::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Payabli::Types::NotificationLogDetail.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#search_notification_logs(request_options: {}, **params) ⇒ Array[Payabli::Types::NotificationLog]
Search notification logs with filtering and pagination.
- Start date and end date cannot be more than 30 days apart
- Either
orgIdorpaypointIdmust be provided
This endpoint requires the notifications_create OR notifications_read permission.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/payabli/notificationlogs/client.rb', line 40 def search_notification_logs(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request_data = Payabli::Notificationlogs::Types::SearchNotificationLogsRequest.new(params).to_h non_body_param_names = %w[PageSize Page] body = request_data.except(*non_body_param_names) query_params = {} query_params["PageSize"] = params[:page_size] if params.key?(:page_size) query_params["Page"] = params[:page] if params.key?(:page) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v2/notificationlogs", headers: headers, query: query_params, body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Payabli::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |