Class: Omise::CardList
- Inherits:
-
List
- Object
- OmiseObject
- List
- Omise::CardList
- Defined in:
- lib/omise/card_list.rb
Instance Method Summary collapse
- #create(attributes = {}) ⇒ Object
-
#initialize(customer, attributes = {}) ⇒ CardList
constructor
A new instance of CardList.
- #retrieve(id, attributes = {}) ⇒ Object
Methods inherited from List
Methods inherited from OmiseObject
Methods included from Attributes
#[], #as_json, #assign_attributes, #attributes, #destroyed?, #key?, #location, #method_missing, #respond_to?
Constructor Details
#initialize(customer, attributes = {}) ⇒ CardList
Returns a new instance of CardList.
7 8 9 10 |
# File 'lib/omise/card_list.rb', line 7 def initialize(customer, attributes = {}) super(attributes) @customer = customer end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Omise::Attributes
Instance Method Details
#create(attributes = {}) ⇒ Object
16 17 18 19 20 |
# File 'lib/omise/card_list.rb', line 16 def create(attributes = {}) token = Token.create(card: attributes) @customer.update(card: token.id) retrieve(token.card.id) end |
#retrieve(id, attributes = {}) ⇒ Object
12 13 14 |
# File 'lib/omise/card_list.rb', line 12 def retrieve(id, attributes = {}) Card.new self.class.resource(location(id), attributes).get(attributes) end |