Class: Square::Checkout::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/square/checkout/client.rb

Instance Method Summary collapse

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

Returns:

  • (Square::PaymentLinks::Client)


84
85
86
# File 'lib/square/checkout/client.rb', line 84

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
# File 'lib/square/checkout/client.rb', line 14

def retrieve_location_settings(request_options: {}, **params)
  _request = Square::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Square::Environment::SANDBOX,
    method: "GET",
    path: "v2/online-checkout/location-settings/#{params[:location_id]}"
  )
  _response = @client.send(_request)
  if _response.code >= "200" && _response.code < "300"
    return Square::Types::RetrieveLocationSettingsResponse.load(_response.body)
  end

  raise _response.body
end

#retrieve_merchant_settings(request_options: {}, **_params) ⇒ Square::Types::RetrieveMerchantSettingsResponse

Retrieves the merchant-level settings for a Square-hosted checkout page.



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/square/checkout/client.rb', line 51

def retrieve_merchant_settings(request_options: {}, **_params)
  _request = Square::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Square::Environment::SANDBOX,
    method: "GET",
    path: "v2/online-checkout/merchant-settings"
  )
  _response = @client.send(_request)
  if _response.code >= "200" && _response.code < "300"
    return Square::Types::RetrieveMerchantSettingsResponse.load(_response.body)
  end

  raise _response.body
end

#update_location_settings(request_options: {}, **params) ⇒ Square::Types::UpdateLocationSettingsResponse

Updates the location-level settings for a Square-hosted checkout page.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/square/checkout/client.rb', line 31

def update_location_settings(request_options: {}, **params)
  _path_param_names = ["location_id"]

  _request = Square::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Square::Environment::SANDBOX,
    method: "PUT",
    path: "v2/online-checkout/location-settings/#{params[:location_id]}",
    body: params.except(*_path_param_names)
  )
  _response = @client.send(_request)
  if _response.code >= "200" && _response.code < "300"
    return Square::Types::UpdateLocationSettingsResponse.load(_response.body)
  end

  raise _response.body
end

#update_merchant_settings(request_options: {}, **params) ⇒ Square::Types::UpdateMerchantSettingsResponse

Updates the merchant-level settings for a Square-hosted checkout page.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/square/checkout/client.rb', line 68

def update_merchant_settings(request_options: {}, **params)
  _request = Square::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Square::Environment::SANDBOX,
    method: "PUT",
    path: "v2/online-checkout/merchant-settings",
    body: params
  )
  _response = @client.send(_request)
  if _response.code >= "200" && _response.code < "300"
    return Square::Types::UpdateMerchantSettingsResponse.load(_response.body)
  end

  raise _response.body
end