Class: MundiApi::CreateCardRequest
- Defined in:
- lib/mundi_api/models/create_card_request.rb
Overview
Card data
Instance Attribute Summary collapse
-
#billing_address ⇒ CreateAddressRequest
Card’s billing address.
-
#billing_address_id ⇒ String
The address id for the billing address.
-
#brand ⇒ String
Card brand.
-
#cvv ⇒ String
The card’s security code.
-
#exp_month ⇒ Integer
The expiration month.
-
#exp_year ⇒ Integer
The expiration year, that can be informed with 2 or 4 digits.
-
#holder_document ⇒ String
Document number for the card’s holder.
-
#holder_name ⇒ String
Holder name, as written on the card.
-
#metadata ⇒ Array<String, String>
Metadata.
-
#number ⇒ String
Credit card number.
-
#options ⇒ CreateCardOptionsRequest
Options for creating the card.
-
#type ⇒ String
Card type.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(number = nil, holder_name = nil, exp_month = nil, exp_year = nil, cvv = nil, billing_address = nil, brand = nil, billing_address_id = nil, metadata = nil, type = 'credit', options = nil, holder_document = nil) ⇒ CreateCardRequest
constructor
A new instance of CreateCardRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(number = nil, holder_name = nil, exp_month = nil, exp_year = nil, cvv = nil, billing_address = nil, brand = nil, billing_address_id = nil, metadata = nil, type = 'credit', options = nil, holder_document = nil) ⇒ CreateCardRequest
Returns a new instance of CreateCardRequest.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/mundi_api/models/create_card_request.rb', line 75 def initialize(number = nil, holder_name = nil, exp_month = nil, exp_year = nil, cvv = nil, billing_address = nil, brand = nil, billing_address_id = nil, = nil, type = 'credit', = nil, holder_document = nil) @number = number @holder_name = holder_name @exp_month = exp_month @exp_year = exp_year @cvv = cvv @billing_address = billing_address @brand = brand @billing_address_id = billing_address_id = @type = type = @holder_document = holder_document end |
Instance Attribute Details
#billing_address ⇒ CreateAddressRequest
Card’s billing address
29 30 31 |
# File 'lib/mundi_api/models/create_card_request.rb', line 29 def billing_address @billing_address end |
#billing_address_id ⇒ String
The address id for the billing address
37 38 39 |
# File 'lib/mundi_api/models/create_card_request.rb', line 37 def billing_address_id @billing_address_id end |
#brand ⇒ String
Card brand
33 34 35 |
# File 'lib/mundi_api/models/create_card_request.rb', line 33 def brand @brand end |
#cvv ⇒ String
The card’s security code
25 26 27 |
# File 'lib/mundi_api/models/create_card_request.rb', line 25 def cvv @cvv end |
#exp_month ⇒ Integer
The expiration month
17 18 19 |
# File 'lib/mundi_api/models/create_card_request.rb', line 17 def exp_month @exp_month end |
#exp_year ⇒ Integer
The expiration year, that can be informed with 2 or 4 digits
21 22 23 |
# File 'lib/mundi_api/models/create_card_request.rb', line 21 def exp_year @exp_year end |
#holder_document ⇒ String
Document number for the card’s holder
53 54 55 |
# File 'lib/mundi_api/models/create_card_request.rb', line 53 def holder_document @holder_document end |
#holder_name ⇒ String
Holder name, as written on the card
13 14 15 |
# File 'lib/mundi_api/models/create_card_request.rb', line 13 def holder_name @holder_name end |
#metadata ⇒ Array<String, String>
Metadata
41 42 43 |
# File 'lib/mundi_api/models/create_card_request.rb', line 41 def end |
#number ⇒ String
Credit card number
9 10 11 |
# File 'lib/mundi_api/models/create_card_request.rb', line 9 def number @number end |
#options ⇒ CreateCardOptionsRequest
Options for creating the card
49 50 51 |
# File 'lib/mundi_api/models/create_card_request.rb', line 49 def end |
#type ⇒ String
Card type
45 46 47 |
# File 'lib/mundi_api/models/create_card_request.rb', line 45 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/mundi_api/models/create_card_request.rb', line 102 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. number = hash['number'] holder_name = hash['holder_name'] exp_month = hash['exp_month'] exp_year = hash['exp_year'] cvv = hash['cvv'] billing_address = CreateAddressRequest.from_hash(hash['billing_address']) if hash['billing_address'] brand = hash['brand'] billing_address_id = hash['billing_address_id'] = hash['metadata'] type = hash['type'] ||= 'credit' = CreateCardOptionsRequest.from_hash(hash['options']) if hash['options'] holder_document = hash['holder_document'] # Create object from extracted values. CreateCardRequest.new(number, holder_name, exp_month, exp_year, cvv, billing_address, brand, billing_address_id, , type, , holder_document) end |
.names ⇒ Object
A mapping from model property names to API property names.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/mundi_api/models/create_card_request.rb', line 56 def self.names if @_hash.nil? @_hash = {} @_hash['number'] = 'number' @_hash['holder_name'] = 'holder_name' @_hash['exp_month'] = 'exp_month' @_hash['exp_year'] = 'exp_year' @_hash['cvv'] = 'cvv' @_hash['billing_address'] = 'billing_address' @_hash['brand'] = 'brand' @_hash['billing_address_id'] = 'billing_address_id' @_hash['metadata'] = 'metadata' @_hash['type'] = 'type' @_hash['options'] = 'options' @_hash['holder_document'] = 'holder_document' end @_hash end |