Class: Payabli::Paypoint::Client
- Inherits:
-
Object
- Object
- Payabli::Paypoint::Client
- Defined in:
- lib/payabli/paypoint/client.rb
Instance Method Summary collapse
-
#get_basic_entry(request_options: {}, **params) ⇒ Payabli::Types::GetBasicEntryResponse
Gets the basic details for a paypoint.
-
#get_basic_entry_by_id(request_options: {}, **params) ⇒ Payabli::Types::GetBasicEntryByIdResponse
Retrieves the basic details for a paypoint by ID.
-
#get_entry_config(request_options: {}, **params) ⇒ Payabli::Types::GetEntryConfigResponse
Gets the details for a single paypoint.
-
#get_page(request_options: {}, **params) ⇒ Payabli::Types::PayabliPages
Gets the details for a single payment page for a paypoint.
- #initialize(client:) ⇒ void constructor
-
#migrate(request_options: {}, **params) ⇒ Payabli::Types::MigratePaypointResponse
Migrates a paypoint to a new parent organization.
-
#remove_page(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponseGeneric2Part
Deletes a payment page in a paypoint.
-
#save_logo(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponse00Responsedatanonobject
Updates a paypoint logo.
-
#settings_page(request_options: {}, **params) ⇒ Payabli::Types::SettingsQueryRecord
Retrieves a paypoint's basic settings like custom fields, identifiers, and invoicing settings.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/payabli/paypoint/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#get_basic_entry(request_options: {}, **params) ⇒ Payabli::Types::GetBasicEntryResponse
Gets the basic details for a paypoint.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/payabli/paypoint/client.rb', line 28 def get_basic_entry(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: "Paypoint/basic/#{URI.encode_uri_component(params[:entry].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::GetBasicEntryResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_basic_entry_by_id(request_options: {}, **params) ⇒ Payabli::Types::GetBasicEntryByIdResponse
Retrieves the basic details for a paypoint by ID.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/payabli/paypoint/client.rb', line 67 def get_basic_entry_by_id(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: "Paypoint/basicById/#{URI.encode_uri_component(params[:id_paypoint].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::GetBasicEntryByIdResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_entry_config(request_options: {}, **params) ⇒ Payabli::Types::GetEntryConfigResponse
Gets the details for a single paypoint.
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/payabli/paypoint/client.rb', line 238 def get_entry_config(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["entrypages"] = params[:entrypages] if params.key?(:entrypages) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "Paypoint/#{URI.encode_uri_component(params[:entry].to_s)}", headers: headers, query: query_params, 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::GetEntryConfigResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_page(request_options: {}, **params) ⇒ Payabli::Types::PayabliPages
Gets the details for a single payment page for a paypoint.
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/payabli/paypoint/client.rb', line 285 def get_page(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: "Paypoint/#{URI.encode_uri_component(params[:entry].to_s)}/#{URI.encode_uri_component(params[:subdomain].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::PayabliPages.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#migrate(request_options: {}, **params) ⇒ Payabli::Types::MigratePaypointResponse
Migrates a paypoint to a new parent organization.
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/payabli/paypoint/client.rb', line 158 def migrate(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: "Paypoint/migrate", headers: headers, body: Payabli::Paypoint::Types::PaypointMoveRequest.new(params).to_h, 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::MigratePaypointResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#remove_page(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponseGeneric2Part
Deletes a payment page in a paypoint.
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/payabli/paypoint/client.rb', line 328 def remove_page(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: "DELETE", path: "Paypoint/#{URI.encode_uri_component(params[:entry].to_s)}/#{URI.encode_uri_component(params[:subdomain].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::PayabliApiResponseGeneric2Part.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#save_logo(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponse00Responsedatanonobject
Updates a paypoint logo.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/payabli/paypoint/client.rb', line 106 def save_logo(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) path_param_names = %i[entry] body_params = params.except(*path_param_names) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "Paypoint/logo/#{URI.encode_uri_component(params[:entry].to_s)}", headers: headers, body: Payabli::Types::FileContent.new(body_params).to_h, 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::PayabliApiResponse00Responsedatanonobject.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#settings_page(request_options: {}, **params) ⇒ Payabli::Types::SettingsQueryRecord
Retrieves a paypoint's basic settings like custom fields, identifiers, and invoicing settings.
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/payabli/paypoint/client.rb', line 198 def settings_page(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: "Paypoint/settings/#{URI.encode_uri_component(params[:entry].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::SettingsQueryRecord.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |