class BoffinIO::ListObject
Public Instance Methods
[](k)
click to toggle source
Calls superclass method
BoffinIO::BoffinIOObject#[]
# File lib/boffinio/list_object.rb, line 4 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={}, api_key=nil)
click to toggle source
# File lib/boffinio/list_object.rb, line 29 def all(params={}, api_key=nil) api_key ||= @api_key response, api_key = BoffinIO.request(:get, url, api_key, params) Util.convert_to_boffinio_object(response, api_key) end
create(params={}, api_key=nil)
click to toggle source
# File lib/boffinio/list_object.rb, line 23 def create(params={}, api_key=nil) api_key ||= @api_key response, api_key = BoffinIO.request(:post, url, api_key, params) Util.convert_to_boffinio_object(response, api_key) end
each(&blk)
click to toggle source
# File lib/boffinio/list_object.rb, line 13 def each(&blk) self.data.each(&blk) end
retrieve(id, api_key=nil)
click to toggle source
# File lib/boffinio/list_object.rb, line 17 def retrieve(id, api_key=nil) api_key ||= @api_key response, api_key = BoffinIO.request(:get,"#{url}/#{CGI.escape(id)}", api_key) Util.convert_to_boffinio_object(response, api_key) end