Class: Freshmaker::UserProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/freshmaker/user_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ UserProxy

Returns a new instance of UserProxy.



3
4
5
# File 'lib/freshmaker/user_proxy.rb', line 3

def initialize(client)
  @client = client
end

Instance Method Details

#allObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/freshmaker/user_proxy.rb', line 7

def all
  all  = []
  page = 1

  begin
    users = get(page: page)
    all  += users
    page += 1
  end while users.present?

  all
end

#get(params = {}) ⇒ Object



20
21
22
23
# File 'lib/freshmaker/user_proxy.rb', line 20

def get(params={})
  response = @client.get('/contacts', query: params)
  response['users'] || []
end