Class: Square::Checkout::Client
- Inherits:
-
Object
- Object
- Square::Checkout::Client
- Defined in:
- lib/square/checkout/client.rb
Instance Method Summary collapse
- #initialize(client:) ⇒ void 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:) ⇒ void
9 10 11 |
# File 'lib/square/checkout/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#payment_links ⇒ Square::PaymentLinks::Client
154 155 156 |
# File 'lib/square/checkout/client.rb', line 154 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.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/square/checkout/client.rb', line 25 def retrieve_location_settings(request_options: {}, **params) params = Square::Internal::Types::Utils.normalize_keys(params) request = Square::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/online-checkout/location-settings/#{params[:location_id]}", request_options: ) 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.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/square/checkout/client.rb', line 97 def retrieve_merchant_settings(request_options: {}, **params) Square::Internal::Types::Utils.normalize_keys(params) request = Square::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/online-checkout/merchant-settings", request_options: ) 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.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/square/checkout/client.rb', line 59 def update_location_settings(request_options: {}, **params) params = Square::Internal::Types::Utils.normalize_keys(params) request_data = Square::Checkout::Types::UpdateLocationSettingsRequest.new(params).to_h non_body_param_names = ["location_id"] body = request_data.except(*non_body_param_names) request = Square::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "v2/online-checkout/location-settings/#{params[:location_id]}", body: body, request_options: ) 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.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/square/checkout/client.rb', line 130 def update_merchant_settings(request_options: {}, **params) params = Square::Internal::Types::Utils.normalize_keys(params) request = Square::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "v2/online-checkout/merchant-settings", body: Square::Checkout::Types::UpdateMerchantSettingsRequest.new(params).to_h, request_options: ) 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 |