Class: Omise::List

Inherits:
OmiseObject show all
Includes:
Enumerable
Defined in:
lib/omise/list.rb

Direct Known Subclasses

CardList, RefundList

Instance Method Summary collapse

Methods inherited from OmiseObject

location, resource

Methods included from Attributes

#[], #as_json, #assign_attributes, #attributes, #destroyed?, #key?, #location, #method_missing, #respond_to?

Constructor Details

#initialize(attributes = {}) ⇒ List

Returns a new instance of List.



8
9
10
11
# File 'lib/omise/list.rb', line 8

def initialize(attributes = {})
  super(attributes)
  setup_data
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Omise::Attributes

Instance Method Details

#each(*args, &block) ⇒ Object



19
20
21
# File 'lib/omise/list.rb', line 19

def each(*args, &block)
  to_a.each(*args, &block)
end

#lastObject



27
28
29
# File 'lib/omise/list.rb', line 27

def last
  to_a.last
end

#reload(attributes = {}) ⇒ Object



13
14
15
16
17
# File 'lib/omise/list.rb', line 13

def reload(attributes = {})
  assign_attributes resource(attributes).get do
    setup_data
  end
end

#to_aObject



23
24
25
# File 'lib/omise/list.rb', line 23

def to_a
  @data
end