Class: SquareLegacy::MerchantsApi
- Defined in:
- lib/square_legacy/api/merchants_api.rb
Overview
MerchantsApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#list_merchants(cursor: nil) ⇒ ApiResponse
Provides details about the merchant associated with a given access token.
-
#retrieve_merchant(merchant_id:) ⇒ ApiResponse
Retrieves the
Merchantobject for the givenmerchant_id.
Methods inherited from BaseApi
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from SquareLegacy::BaseApi
Instance Method Details
#list_merchants(cursor: nil) ⇒ ApiResponse
Provides details about the merchant associated with a given access token.
The access token used to connect your application to a Square seller is
associated
with a single merchant. That means that ListMerchants returns a list
with a single Merchant object. You can specify your personal access
token
to get your own merchant information or specify an OAuth token to get the
information for the merchant that granted your application access.
If you know the merchant ID, you can also use the
RetrieveMerchant
endpoint to retrieve the merchant information.
previous response.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/square_legacy/api/merchants_api.rb', line 18 def list_merchants(cursor: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/merchants', 'default') .query_param(new_parameter(cursor, key: 'cursor')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_merchant(merchant_id:) ⇒ ApiResponse
Retrieves the Merchant object for the given merchant_id.
retrieve. If the string "me" is supplied as the ID, then retrieve the
merchant that is currently accessible to this call.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/square_legacy/api/merchants_api.rb', line 38 def retrieve_merchant(merchant_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/merchants/{merchant_id}', 'default') .template_param(new_parameter(merchant_id, key: 'merchant_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |