lib/braintree/credit_card.rb in braintree-1.1.3 vs lib/braintree/credit_card.rb in braintree-1.2.0
- old
+ new
@@ -1,11 +1,11 @@
module Braintree
class CreditCard
include BaseModule # :nodoc:
attr_reader :billing_address, :bin, :card_type, :cardholder_name, :created_at, :customer_id, :expiration_month,
- :expiration_year, :last_4, :token, :updated_at
+ :expiration_year, :last_4, :subscriptions, :token, :updated_at
def self.create(attributes)
if attributes.has_key?(:expiration_date) && (attributes.has_key?(:expiration_month) || attributes.has_key?(:expiration_year))
raise ArgumentError.new("create with both expiration_month and expiration_year or only expiration_date")
end
@@ -97,9 +97,10 @@
"#{Braintree::Configuration.base_merchant_url}/payment_methods/all/update_via_transparent_redirect_request"
end
def initialize(attributes) # :nodoc:
_init attributes
+ @subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription.new(subscription_hash) }
end
# Creates a credit transaction for this credit card.
def credit(transaction_attributes)
Transaction.credit(transaction_attributes.merge(