Class: Square::Locations::Client
- Inherits:
-
Object
- Object
- Square::Locations::Client
- Defined in:
- lib/square/locations/client.rb
Instance Method Summary collapse
-
#checkouts(request_options: {}, **params) ⇒ Square::Types::CreateCheckoutResponse
Links a ‘checkoutId` to a `checkout_page_url` that customers are directed to in order to provide their payment information using a payment processing workflow hosted on connect.squareup.com.
-
#create(request_options: {}, **params) ⇒ Square::Types::CreateLocationResponse
Creates a [location](developer.squareup.com/docs/locations-api).
- #custom_attribute_definitions ⇒ Square::CustomAttributeDefinitions::Client
- #custom_attributes ⇒ Square::CustomAttributes::Client
-
#get(request_options: {}, **params) ⇒ Square::Types::GetLocationResponse
Retrieves details of a single location.
- #initialize(client:) ⇒ Square::Locations::Client constructor
-
#list(request_options: {}, **_params) ⇒ Square::Types::ListLocationsResponse
Provides details about all of the seller’s [locations](developer.squareup.com/docs/locations-api), including those with an inactive status.
- #transactions ⇒ Square::Transactions::Client
-
#update(request_options: {}, **params) ⇒ Square::Types::UpdateLocationResponse
Updates a [location](developer.squareup.com/docs/locations-api).
Constructor Details
#initialize(client:) ⇒ Square::Locations::Client
7 8 9 |
# File 'lib/square/locations/client.rb', line 7 def initialize(client:) @client = client end |
Instance Method Details
#checkouts(request_options: {}, **params) ⇒ Square::Types::CreateCheckoutResponse
Links a ‘checkoutId` to a `checkout_page_url` that customers are directed to in order to provide their payment information using a payment processing workflow hosted on connect.squareup.com.
NOTE: The Checkout API has been updated with new features. For more information, see [Checkout API highlights](developer.squareup.com/docs/checkout-api#checkout-api-highlights).
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/square/locations/client.rb', line 100 def checkouts(request_options: {}, **params) _path_param_names = ["location_id"] _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "POST", path: "v2/locations/#{params[:location_id]}/checkouts", body: params.except(*_path_param_names) ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::CreateCheckoutResponse.load(_response.body) end raise _response.body end |
#create(request_options: {}, **params) ⇒ Square::Types::CreateLocationResponse
Creates a [location](developer.squareup.com/docs/locations-api). Creating new locations allows for separate configuration of receipt layouts, item prices, and sales reports. Developers can use locations to separate sales activity through applications that integrate with Square from sales activity elsewhere in a seller’s account. Locations created programmatically with the Locations API last forever and are visible to the seller for their own management. Therefore, ensure that each location has a sensible and unique name.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/square/locations/client.rb', line 38 def create(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "POST", path: "v2/locations", body: params ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::CreateLocationResponse.load(_response.body) end raise _response.body end |
#custom_attribute_definitions ⇒ Square::CustomAttributeDefinitions::Client
118 119 120 |
# File 'lib/square/locations/client.rb', line 118 def custom_attribute_definitions @custom_attribute_definitions ||= Square::Locations::CustomAttributeDefinitions::Client.new(client: @client) end |
#custom_attributes ⇒ Square::CustomAttributes::Client
123 124 125 |
# File 'lib/square/locations/client.rb', line 123 def custom_attributes @custom_attributes ||= Square::Locations::CustomAttributes::Client.new(client: @client) end |
#get(request_options: {}, **params) ⇒ Square::Types::GetLocationResponse
Retrieves details of a single location. Specify “main” as the location ID to retrieve details of the [main location](developer.squareup.com/docs/locations-api#about-the-main-location).
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/square/locations/client.rb', line 57 def get(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "GET", path: "v2/locations/#{params[:location_id]}" ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::GetLocationResponse.load(_response.body) end raise _response.body end |
#list(request_options: {}, **_params) ⇒ Square::Types::ListLocationsResponse
Provides details about all of the seller’s [locations](developer.squareup.com/docs/locations-api), including those with an inactive status. Locations are listed alphabetically by ‘name`.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/square/locations/client.rb', line 15 def list(request_options: {}, **_params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "GET", path: "v2/locations" ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::ListLocationsResponse.load(_response.body) end raise _response.body end |
#transactions ⇒ Square::Transactions::Client
128 129 130 |
# File 'lib/square/locations/client.rb', line 128 def transactions @transactions ||= Square::Locations::Transactions::Client.new(client: @client) end |
#update(request_options: {}, **params) ⇒ Square::Types::UpdateLocationResponse
Updates a [location](developer.squareup.com/docs/locations-api).
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/square/locations/client.rb', line 74 def update(request_options: {}, **params) _path_param_names = ["location_id"] _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "PUT", path: "v2/locations/#{params[:location_id]}", body: params.except(*_path_param_names) ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::UpdateLocationResponse.load(_response.body) end raise _response.body end |