class Pingpp::ListObject
Public Instance Methods
[](k)
click to toggle source
Calls superclass method
# File lib/pingpp/list_object.rb, line 7 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
each(&blk)
click to toggle source
# File lib/pingpp/list_object.rb, line 16 def each(&blk) self.data.each(&blk) end
empty?()
click to toggle source
# File lib/pingpp/list_object.rb, line 20 def empty? self.data.empty? end
resource_url(opts={})
click to toggle source
# File lib/pingpp/list_object.rb, line 30 def resource_url(opts={}) self.url || raise(ArgumentError, "List object does not contain a 'url' field.") end
retrieve(id, opts={})
click to toggle source
# File lib/pingpp/list_object.rb, line 24 def retrieve(id, opts={}) id, retrieve_params = Util.normalize_id(id) response, opts = request(:get, "#{resource_url(opts)}/#{CGI.escape(id)}", retrieve_params, opts) Util.convert_to_pingpp_object(response, opts) end