class Payjp::ListObject

Public Instance Methods

[](k) click to toggle source
Calls superclass method
# File lib/payjp/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/payjp/list_object.rb, line 28
def all(params = {}, opts = {})
  response, opts = request(:get, url, params, opts)
  Util.convert_to_payjp_object(response, opts)
end
create(params = {}, opts = {}) click to toggle source
# File lib/payjp/list_object.rb, line 23
def create(params = {}, opts = {})
  response, opts = request(:post, url, params, opts)
  Util.convert_to_payjp_object(response, opts)
end
each(&blk) click to toggle source
# File lib/payjp/list_object.rb, line 14
def each(&blk)
  data.each(&blk)
end
retrieve(id, opts = {}) click to toggle source
# File lib/payjp/list_object.rb, line 18
def retrieve(id, opts = {})
  response, opts = request(:get, "#{url}/#{CGI.escape(id)}", {}, opts)
  Util.convert_to_payjp_object(response, opts)
end