class EwayRapid::Models::CardDetails

Card information

Attributes

cvn[RW]
expiry_month[RW]
expiry_year[RW]
issue_number[RW]
name[RW]
number[RW]
start_month[RW]
start_year[RW]

Public Class Methods

from_hash(hash) click to toggle source
# File lib/eway_rapid/models/models.rb, line 49
def self.from_hash(hash)
  unless hash.nil?
    card_details = CardDetails.new
    card_details.name = hash[Constants::NAME]
    card_details.number = hash[Constants::NUMBER]
    card_details.expiry_month = hash[Constants::EXPIRY_MONTH]
    card_details.expiry_year = hash[Constants::EXPIRY_YEAR]
    card_details.start_month = hash[Constants::START_MONTH]
    card_details.start_year = hash[Constants::START_YEAR]
    card_details.issue_number = hash[Constants::ISSUE_NUMBER]
    card_details.cvn = hash[Constants::CVN]
    card_details
  end
end
from_json(json) click to toggle source
# File lib/eway_rapid/models/models.rb, line 44
def self.from_json(json)
  hash = JSON.parse(json)
  from_hash(hash)
end
to_hash(card_details) click to toggle source
# File lib/eway_rapid/models/models.rb, line 33
def self.to_hash(card_details)
  { Constants::NAME => card_details.name,
   Constants::NUMBER => card_details.number,
   Constants::EXPIRY_MONTH => card_details.expiry_month,
   Constants::EXPIRY_YEAR => card_details.expiry_year,
   Constants::START_MONTH => card_details.start_month,
   Constants::START_YEAR => card_details.start_year,
   Constants::ISSUE_NUMBER => card_details.issue_number,
   Constants::CVN => card_details.cvn } if card_details
end