Class: BraintreeRails::Transactions
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- BraintreeRails::Transactions
- Includes:
- CollectionAssociation
- Defined in:
- lib/braintree_rails/transactions.rb
Instance Method Summary collapse
- #default_options ⇒ Object
-
#initialize(belongs_to) ⇒ Transactions
constructor
A new instance of Transactions.
Methods included from CollectionAssociation
Constructor Details
#initialize(belongs_to) ⇒ Transactions
Returns a new instance of Transactions.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/braintree_rails/transactions.rb', line 5 def initialize(belongs_to) case belongs_to when BraintreeRails::Customer @customer = belongs_to when BraintreeRails::CreditCard @credit_card = belongs_to when BraintreeRails::Subscription @subscription = belongs_to self.singleton_class.not_supported_apis(:build) end super([]) end |
Instance Method Details
#default_options ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/braintree_rails/transactions.rb', line 18 def if @credit_card.present? {:credit_card => @credit_card} elsif @customer.present? {:customer => @customer, :credit_card => @customer.default_credit_card} else {} end end |