Class: Square::Sites::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Square::Sites::Client



7
8
9
# File 'lib/square/sites/client.rb', line 7

def initialize(client:)
  @client = client
end

Instance Method Details

#list(request_options: {}, **_params) ⇒ Square::Types::ListSitesResponse

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).



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/square/sites/client.rb', line 17

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

  raise _response.body
end