Class: EwayRapid::Models::CardDetails
- Inherits:
-
Object
- Object
- EwayRapid::Models::CardDetails
- Defined in:
- lib/eway_rapid/models/models.rb
Overview
Card information
Instance Attribute Summary collapse
-
#cvn ⇒ Object
Returns the value of attribute cvn.
-
#expiry_month ⇒ Object
Returns the value of attribute expiry_month.
-
#expiry_year ⇒ Object
Returns the value of attribute expiry_year.
-
#issue_number ⇒ Object
Returns the value of attribute issue_number.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number ⇒ Object
Returns the value of attribute number.
-
#start_month ⇒ Object
Returns the value of attribute start_month.
-
#start_year ⇒ Object
Returns the value of attribute start_year.
Class Method Summary collapse
Instance Attribute Details
#cvn ⇒ Object
Returns the value of attribute cvn.
31 32 33 |
# File 'lib/eway_rapid/models/models.rb', line 31 def cvn @cvn end |
#expiry_month ⇒ Object
Returns the value of attribute expiry_month.
26 27 28 |
# File 'lib/eway_rapid/models/models.rb', line 26 def expiry_month @expiry_month end |
#expiry_year ⇒ Object
Returns the value of attribute expiry_year.
27 28 29 |
# File 'lib/eway_rapid/models/models.rb', line 27 def expiry_year @expiry_year end |
#issue_number ⇒ Object
Returns the value of attribute issue_number.
30 31 32 |
# File 'lib/eway_rapid/models/models.rb', line 30 def issue_number @issue_number end |
#name ⇒ Object
Returns the value of attribute name.
24 25 26 |
# File 'lib/eway_rapid/models/models.rb', line 24 def name @name end |
#number ⇒ Object
Returns the value of attribute number.
25 26 27 |
# File 'lib/eway_rapid/models/models.rb', line 25 def number @number end |
#start_month ⇒ Object
Returns the value of attribute start_month.
28 29 30 |
# File 'lib/eway_rapid/models/models.rb', line 28 def start_month @start_month end |
#start_year ⇒ Object
Returns the value of attribute start_year.
29 30 31 |
# File 'lib/eway_rapid/models/models.rb', line 29 def start_year @start_year end |
Class Method Details
.from_hash(hash) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# 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) ⇒ Object
44 45 46 47 |
# 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) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# 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 |