Class: MusicTodayApiWrapper::Resources::Checkout::Billing::Payment

Inherits:
Object
  • Object
show all
Defined in:
lib/resources/checkout/billing/payment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(card_number, name, amount, expiration_year, expiration_month) ⇒ Payment

Returns a new instance of Payment.



16
17
18
19
20
21
22
23
24
# File 'lib/resources/checkout/billing/payment.rb', line 16

def initialize(card_number, name, amount, expiration_year,
  expiration_month)
  @card_number = card_number
  @expiration_year = expiration_year.to_i
  @expiration_month = expiration_month.to_i
  @name = name
  @amount = amount.to_f
  credit_card_type
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



9
10
11
# File 'lib/resources/checkout/billing/payment.rb', line 9

def amount
  @amount
end

#card_numberObject

Returns the value of attribute card_number.



9
10
11
# File 'lib/resources/checkout/billing/payment.rb', line 9

def card_number
  @card_number
end

#card_typeObject

Returns the value of attribute card_type.



9
10
11
# File 'lib/resources/checkout/billing/payment.rb', line 9

def card_type
  @card_type
end

#expiration_monthObject

Returns the value of attribute expiration_month.



9
10
11
# File 'lib/resources/checkout/billing/payment.rb', line 9

def expiration_month
  @expiration_month
end

#expiration_yearObject

Returns the value of attribute expiration_year.



9
10
11
# File 'lib/resources/checkout/billing/payment.rb', line 9

def expiration_year
  @expiration_year
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/resources/checkout/billing/payment.rb', line 9

def name
  @name
end

Instance Method Details

#as_hashObject



26
27
28
29
30
31
32
33
# File 'lib/resources/checkout/billing/payment.rb', line 26

def as_hash
  { type: @card_type,
    accountNumber: @card_number,
    expYear: @expiration_year,
    expMonth: @expiration_month,
    nameOnCard: @name,
    amount: @amount }.compact
end