class RelateIQ::Account

Public Class Methods

all() click to toggle source
# File lib/relate_iq/account.rb, line 7
def self.all
  page_size = 20
  start = 0
  accounts = []
 
  loop do 
    page_results = RelateIQ.get('accounts', '_start' => start, '_limit' => page_size)['objects']
    break if page_results.empty?
    
    accounts.concat(page_results.map {|a| self.new(a) })
    start += page_size
    sleep 0.5
  end

  accounts
end
create(attributes) click to toggle source
# File lib/relate_iq/account.rb, line 3
def self.create(attributes)
  self.new(RelateIQ.post('accounts', attributes))
end