Class: Cloverrb::Employee

Inherits:
Client
  • Object
show all
Defined in:
lib/cloverrb/employee.rb

Constant Summary

Constants inherited from Client

Client::AUTH_URL, Client::BASE_URL

Instance Method Summary collapse

Methods inherited from Client

generate_access_token, #get, #post, #put

Constructor Details

#initialize(token, merchant_code) ⇒ Employee

Returns a new instance of Employee.



3
4
5
6
# File 'lib/cloverrb/employee.rb', line 3

def initialize(token, merchant_code)
  @token = token
  @merchant_code = merchant_code
end

Instance Method Details

#all(role = nil) ⇒ Object



8
9
10
11
12
# File 'lib/cloverrb/employee.rb', line 8

def all(role=nil)
  url = "/merchants/#{@merchant_code}/employees"
  url += "?filter=role=#{role}" if role
  get(@token, url)
end

#find(employee_id) ⇒ Object



14
15
16
17
# File 'lib/cloverrb/employee.rb', line 14

def find(employee_id)
  url = "/merchants/#{@merchant_code}/employees/#{employee_id}"
  get(@token, url)
end