Class: Square::Checkout::Client
- Inherits:
-
Object
- Object
- Square::Checkout::Client
- Defined in:
- lib/square/checkout/client.rb
Instance Method Summary collapse
- #initialize(client:) ⇒ Square::Checkout::Client constructor
- #payment_links ⇒ Square::PaymentLinks::Client
-
#retrieve_location_settings(request_options: {}, **params) ⇒ Square::Types::RetrieveLocationSettingsResponse
Retrieves the location-level settings for a Square-hosted checkout page.
-
#retrieve_merchant_settings(request_options: {}, **_params) ⇒ Square::Types::RetrieveMerchantSettingsResponse
Retrieves the merchant-level settings for a Square-hosted checkout page.
-
#update_location_settings(request_options: {}, **params) ⇒ Square::Types::UpdateLocationSettingsResponse
Updates the location-level settings for a Square-hosted checkout page.
-
#update_merchant_settings(request_options: {}, **params) ⇒ Square::Types::UpdateMerchantSettingsResponse
Updates the merchant-level settings for a Square-hosted checkout page.
Constructor Details
#initialize(client:) ⇒ Square::Checkout::Client
7 8 9 |
# File 'lib/square/checkout/client.rb', line 7 def initialize(client:) @client = client end |
Instance Method Details
#payment_links ⇒ Square::PaymentLinks::Client
108 109 110 |
# File 'lib/square/checkout/client.rb', line 108 def payment_links @payment_links ||= Square::Checkout::PaymentLinks::Client.new(client: @client) end |
#retrieve_location_settings(request_options: {}, **params) ⇒ Square::Types::RetrieveLocationSettingsResponse
Retrieves the location-level settings for a Square-hosted checkout page.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/square/checkout/client.rb', line 14 def retrieve_location_settings(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::PRODUCTION, method: "GET", path: "v2/online-checkout/location-settings/#{params[:location_id]}" ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Square::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Square::Types::RetrieveLocationSettingsResponse.load(_response.body) else error_class = Square::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#retrieve_merchant_settings(request_options: {}, **_params) ⇒ Square::Types::RetrieveMerchantSettingsResponse
Retrieves the merchant-level settings for a Square-hosted checkout page.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/square/checkout/client.rb', line 63 def retrieve_merchant_settings(request_options: {}, **_params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::PRODUCTION, method: "GET", path: "v2/online-checkout/merchant-settings" ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Square::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Square::Types::RetrieveMerchantSettingsResponse.load(_response.body) else error_class = Square::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#update_location_settings(request_options: {}, **params) ⇒ Square::Types::UpdateLocationSettingsResponse
Updates the location-level settings for a Square-hosted checkout page.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/square/checkout/client.rb', line 37 def update_location_settings(request_options: {}, **params) _path_param_names = ["location_id"] _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::PRODUCTION, method: "PUT", path: "v2/online-checkout/location-settings/#{params[:location_id]}", body: params.except(*_path_param_names) ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Square::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Square::Types::UpdateLocationSettingsResponse.load(_response.body) else error_class = Square::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#update_merchant_settings(request_options: {}, **params) ⇒ Square::Types::UpdateMerchantSettingsResponse
Updates the merchant-level settings for a Square-hosted checkout page.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/square/checkout/client.rb', line 86 def update_merchant_settings(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::PRODUCTION, method: "PUT", path: "v2/online-checkout/merchant-settings", body: params ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Square::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Square::Types::UpdateMerchantSettingsResponse.load(_response.body) else error_class = Square::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |