Module: Assembly::Actions::List::ClassMethods

Defined in:
lib/assembly/actions/list.rb

Instance Method Summary collapse

Instance Method Details

#all(params, client = Assembly.client) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/assembly/actions/list.rb', line 10

def all(params, client=Assembly.client)
  params.delete(:page)
  params.delete(:per_page)
  results = []
  page = 1
  while page
    ret = list({page: page, per_page: 100}.merge(params), client)
    results += ret.data
    page = ret.next_page
  end
  results
end

#list(params, client = Assembly.client) ⇒ Object



5
6
7
8
# File 'lib/assembly/actions/list.rb', line 5

def list(params, client=Assembly.client)
  response = client.get(path, params)
  Util.build(response, client)
end

#total_count(params = {}, client = Assembly.client) ⇒ Object



23
24
25
# File 'lib/assembly/actions/list.rb', line 23

def total_count(params={}, client=Assembly.client)
  list({per_page: 1}.merge(params), client).total_count
end