class Square::SitesApi
Public Class Methods
new(config, http_call_back: nil)
click to toggle source
Calls superclass method
Square::BaseApi::new
# File lib/square/api/sites_api.rb, line 4 def initialize(config, http_call_back: nil) super(config, http_call_back: http_call_back) end
Public Instance Methods
list_sites()
click to toggle source
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). @return [ListSitesResponse Hash] response from the API call
# File lib/square/api/sites_api.rb, line 16 def list_sites # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/sites' _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end