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.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/payabli/notificationlogs/client.rb', line 145 def bulk_retry_notification_logs(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v2/notificationlogs/retry", 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.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/payabli/notificationlogs/client.rb', line 73 def get_notification_log(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/notificationlogs/#{URI.encode_uri_component(params[:uuid].to_s)}", 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
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/payabli/notificationlogs/client.rb', line 109 def retry_notification_log(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/notificationlogs/#{URI.encode_uri_component(params[:uuid].to_s)}/retry", 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.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/payabli/notificationlogs/client.rb', line 30 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) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v2/notificationlogs", 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 |