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::Paypoint::Types::GetBasicEntryResponse
Gets the basic details for a paypoint.
-
#get_basic_entry_by_id(request_options: {}, **params) ⇒ Payabli::Paypoint::Types::GetBasicEntryByIdResponse
Retrieves the basic details for a paypoint by ID.
-
#get_entry_config(request_options: {}, **params) ⇒ Payabli::Paypoint::Types::GetEntryConfigResponse
Gets the details for a single paypoint.
-
#get_page(request_options: {}, **params) ⇒ Payabli::Types::PayabliPages
Gets the details for single payment page for a paypoint.
- #initialize(client:) ⇒ void constructor
-
#migrate(request_options: {}, **params) ⇒ Payabli::Paypoint::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 an 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::Paypoint::Types::GetBasicEntryResponse
Gets the basic details for a paypoint.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/payabli/paypoint/client.rb', line 25 def get_basic_entry(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "Paypoint/basic/#{URI.encode_uri_component(params[:entry].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::Paypoint::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::Paypoint::Types::GetBasicEntryByIdResponse
Retrieves the basic details for a paypoint by ID.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/payabli/paypoint/client.rb', line 59 def get_basic_entry_by_id(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "Paypoint/basicById/#{URI.encode_uri_component(params[:id_paypoint].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::Paypoint::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::Paypoint::Types::GetEntryConfigResponse
Gets the details for a single paypoint.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/payabli/paypoint/client.rb', line 94 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) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "Paypoint/#{URI.encode_uri_component(params[:entry].to_s)}", 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::Paypoint::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 single payment page for a paypoint.
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/payabli/paypoint/client.rb', line 133 def get_page(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) 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)}", 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::Paypoint::Types::MigratePaypointResponse
Migrates a paypoint to a new parent organization.
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/payabli/paypoint/client.rb', line 270 def migrate(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "Paypoint/migrate", 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::Paypoint::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.
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/payabli/paypoint/client.rb', line 168 def remove_page(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) 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)}", 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.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/payabli/paypoint/client.rb', line 202 def save_logo(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "Paypoint/logo/#{URI.encode_uri_component(params[:entry].to_s)}", body: Payabli::Types::FileContent.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::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 an paypoint’s basic settings like custom fields, identifiers, and invoicing settings.
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/payabli/paypoint/client.rb', line 237 def settings_page(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "Paypoint/settings/#{URI.encode_uri_component(params[:entry].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::SettingsQueryRecord.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |