Class: Square::SitesApi

Inherits:
BaseApi show all
Defined in:
lib/square/api/sites_api.rb

Overview

SitesApi

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

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 Square::BaseApi

Instance Method Details

#list_sitesApiResponse

Lists the Square Online sites that belong to a seller. Sites are listed in descending order by the ‘created_at` date. Note: Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](developer.squareup.com/docs/online-api#early-access-program- for-square-online-apis).

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/square/api/sites_api.rb', line 12

def list_sites
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/sites',
                                 'default')
               .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