Class: WebPay::CardRequest
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Class Method Summary collapse
Instance Method Summary collapse
- #cvc ⇒ Object
- #cvc=(value) ⇒ Object
- #exp_month ⇒ Object
- #exp_month=(value) ⇒ Object
- #exp_year ⇒ Object
- #exp_year=(value) ⇒ Object
-
#initialize(hash = {}) ⇒ CardRequest
constructor
A new instance of CardRequest.
- #name ⇒ Object
- #name=(value) ⇒ Object
-
#number ⇒ Object
attributes accessors.
- #number=(value) ⇒ Object
- #query_params ⇒ Object
- #request_body ⇒ Object
Methods inherited from Entity
Constructor Details
#initialize(hash = {}) ⇒ CardRequest
Returns a new instance of CardRequest.
65 66 67 68 |
# File 'lib/webpay/data_types.rb', line 65 def initialize(hash = {}) hash = normalize_hash(hash) @attributes = hash end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
48 49 50 |
# File 'lib/webpay/data_types.rb', line 48 def attributes @attributes end |
Class Method Details
.create(params) ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/webpay/data_types.rb', line 55 def self.create(params) return params if params.is_a?(self) hash = case params when Hash; params else raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params) end self.new(hash) end |
.fields ⇒ Object
50 51 52 |
# File 'lib/webpay/data_types.rb', line 50 def self.fields ['number', 'exp_month', 'exp_year', 'cvc', 'name'] end |
Instance Method Details
#cvc ⇒ Object
112 113 114 |
# File 'lib/webpay/data_types.rb', line 112 def cvc attributes['cvc'] end |
#cvc=(value) ⇒ Object
116 117 118 |
# File 'lib/webpay/data_types.rb', line 116 def cvc=(value) attributes['cvc'] = value end |
#exp_month ⇒ Object
96 97 98 |
# File 'lib/webpay/data_types.rb', line 96 def exp_month attributes['exp_month'] end |
#exp_month=(value) ⇒ Object
100 101 102 |
# File 'lib/webpay/data_types.rb', line 100 def exp_month=(value) attributes['exp_month'] = value end |
#exp_year ⇒ Object
104 105 106 |
# File 'lib/webpay/data_types.rb', line 104 def exp_year attributes['exp_year'] end |
#exp_year=(value) ⇒ Object
108 109 110 |
# File 'lib/webpay/data_types.rb', line 108 def exp_year=(value) attributes['exp_year'] = value end |
#name ⇒ Object
120 121 122 |
# File 'lib/webpay/data_types.rb', line 120 def name attributes['name'] end |
#name=(value) ⇒ Object
124 125 126 |
# File 'lib/webpay/data_types.rb', line 124 def name=(value) attributes['name'] = value end |
#number ⇒ Object
attributes accessors
88 89 90 |
# File 'lib/webpay/data_types.rb', line 88 def number attributes['number'] end |
#number=(value) ⇒ Object
92 93 94 |
# File 'lib/webpay/data_types.rb', line 92 def number=(value) attributes['number'] = value end |
#query_params ⇒ Object
81 82 83 84 |
# File 'lib/webpay/data_types.rb', line 81 def query_params result = {} return result end |
#request_body ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/webpay/data_types.rb', line 71 def request_body result = {} copy_if_exists(@attributes, result, 'number', 'request_body'); copy_if_exists(@attributes, result, 'exp_month', 'request_body'); copy_if_exists(@attributes, result, 'exp_year', 'request_body'); copy_if_exists(@attributes, result, 'cvc', 'request_body'); copy_if_exists(@attributes, result, 'name', 'request_body'); result end |