class Baabedo::ListObject

Public Instance Methods

[](k) click to toggle source
Calls superclass method Baabedo::APIObject#[]
# File lib/baabedo/list_object.rb, line 5
def [](k)
  case k
  when String, Symbol
    super
  else
    raise ArgumentError.new("You tried to access the #{k.inspect} index, but ListObject types only support String keys. (HINT: List calls return an object with a 'data' (which is the data array). You likely want to call #data[#{k.inspect}])")
  end
end
all(params={}, opts={}) click to toggle source
# File lib/baabedo/list_object.rb, line 28
def all(params={}, opts={})
  response, opts = request(:get, url, params, opts)
  Util.convert_to_api_object(response, opts)
end
create(params={}, opts={}) click to toggle source
# File lib/baabedo/list_object.rb, line 23
def create(params={}, opts={})
  response, opts = request(:post, url, params, opts)
  Util.convert_to_api_object(response, opts)
end
each(&blk) click to toggle source
# File lib/baabedo/list_object.rb, line 14
def each(&blk)
  self.data.each(&blk)
end
retrieve(id, opts={}) click to toggle source
# File lib/baabedo/list_object.rb, line 18
def retrieve(id, opts={})
  response, opts = request(:get,"#{url}/#{CGI.escape(id)}", {}, opts)
  Util.convert_to_api_object(response, opts)
end