Class: Square::Employees::Client
- Inherits:
-
Object
- Object
- Square::Employees::Client
- Defined in:
- lib/square/employees/client.rb
Instance Method Summary collapse
- #get(request_options: {}, **params) ⇒ Square::Types::GetEmployeeResponse
- #initialize(client:) ⇒ Square::Employees::Client constructor
- #list(request_options: {}, **params) ⇒ Square::Types::ListEmployeesResponse
Constructor Details
#initialize(client:) ⇒ Square::Employees::Client
7 8 9 |
# File 'lib/square/employees/client.rb', line 7 def initialize(client:) @client = client end |
Instance Method Details
#get(request_options: {}, **params) ⇒ Square::Types::GetEmployeeResponse
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/square/employees/client.rb', line 32 def get(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "GET", path: "v2/employees/#{params[:id]}" ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::GetEmployeeResponse.load(_response.body) end raise _response.body end |
#list(request_options: {}, **params) ⇒ Square::Types::ListEmployeesResponse
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/square/employees/client.rb', line 12 def list(request_options: {}, **params) _query_param_names = %w[location_id status limit cursor] _query = params.slice(*_query_param_names) params.except(*_query_param_names) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "GET", path: "v2/employees", query: _query ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::ListEmployeesResponse.load(_response.body) end raise _response.body end |