Class: OnlinePayments::SDK::Domain::Card

Inherits:
OnlinePayments::SDK::DataObject show all
Defined in:
lib/onlinepayments/sdk/domain/card.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OnlinePayments::SDK::DataObject

new_from_hash

Instance Attribute Details

#card_numberString

Returns the current value of card_number.

Returns:

  • (String)

    the current value of card_number



13
14
15
# File 'lib/onlinepayments/sdk/domain/card.rb', line 13

def card_number
  @card_number
end

#cardholder_nameString

Returns the current value of cardholder_name.

Returns:

  • (String)

    the current value of cardholder_name



13
14
15
# File 'lib/onlinepayments/sdk/domain/card.rb', line 13

def cardholder_name
  @cardholder_name
end

#cvvString

Returns the current value of cvv.

Returns:

  • (String)

    the current value of cvv



13
14
15
# File 'lib/onlinepayments/sdk/domain/card.rb', line 13

def cvv
  @cvv
end

#expiry_dateString

Returns the current value of expiry_date.

Returns:

  • (String)

    the current value of expiry_date



13
14
15
# File 'lib/onlinepayments/sdk/domain/card.rb', line 13

def expiry_date
  @expiry_date
end

Instance Method Details

#from_hash(hash) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/onlinepayments/sdk/domain/card.rb', line 29

def from_hash(hash)
  super
  @card_number = hash['cardNumber'] if hash.key? 'cardNumber'
  @cardholder_name = hash['cardholderName'] if hash.key? 'cardholderName'
  @cvv = hash['cvv'] if hash.key? 'cvv'
  @expiry_date = hash['expiryDate'] if hash.key? 'expiryDate'
end

#to_hHash

Returns:

  • (Hash)


20
21
22
23
24
25
26
27
# File 'lib/onlinepayments/sdk/domain/card.rb', line 20

def to_h
  hash = super
  hash['cardNumber'] = @card_number unless @card_number.nil?
  hash['cardholderName'] = @cardholder_name unless @cardholder_name.nil?
  hash['cvv'] = @cvv unless @cvv.nil?
  hash['expiryDate'] = @expiry_date unless @expiry_date.nil?
  hash
end