Module: Onfleet::Actions::List::ClassMethods

Defined in:
lib/onfleet-ruby/actions/list.rb

Instance Method Summary collapse

Instance Method Details

#list(query_params = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/onfleet-ruby/actions/list.rb', line 5

def list query_params={}
  api_url = "#{self.api_url}"

  if !query_params.empty?
    api_url += "?"
    query_params.each do |key, value|
      api_url += "#{key}=#{value}&"
    end
  end

  response = Onfleet.request(api_url, :get)
  response.compact.map do |listObj|
    Util.constantize("#{self}").new(listObj)
  end
end