Class: CreditCardInfo
- Inherits:
-
Object
- Object
- CreditCardInfo
- Includes:
- LibXML
- Defined in:
- app/models/credit_card_info.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(token = nil) ⇒ CreditCardInfo
constructor
A new instance of CreditCardInfo.
- #method_missing(sym, *args, &block) ⇒ Object
Constructor Details
#initialize(token = nil) ⇒ CreditCardInfo
Returns a new instance of CreditCardInfo.
5 6 7 8 |
# File 'app/models/credit_card_info.rb', line 5 def initialize(token = nil) params = { 'customer_vault_id' => token, 'report_type' => 'customer_vault'} collect_card_info(Braintree::Query.new(params).run) unless token.nil? or token.blank? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/models/credit_card_info.rb', line 10 def method_missing(sym, *args, &block) begin if %w(first_name last_name email address_1 city state postal_code country cc_exp cc_number).include?(sym.to_s) fetch(@customer, sym.to_s) end rescue super(sym, args, &block) end end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
3 4 5 |
# File 'app/models/credit_card_info.rb', line 3 def address @address end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'app/models/credit_card_info.rb', line 3 def name @name end |