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.
185 186 187 188 |
# File 'lib/webpay/data_types.rb', line 185 def initialize(hash = {}) hash = normalize_hash(hash) @attributes = hash end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
168 169 170 |
# File 'lib/webpay/data_types.rb', line 168 def attributes @attributes end |
Class Method Details
.create(params) ⇒ Object
175 176 177 178 179 180 181 182 183 |
# File 'lib/webpay/data_types.rb', line 175 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
170 171 172 |
# File 'lib/webpay/data_types.rb', line 170 def self.fields ['number', 'exp_month', 'exp_year', 'cvc', 'name'] end |
Instance Method Details
#cvc ⇒ Object
232 233 234 |
# File 'lib/webpay/data_types.rb', line 232 def cvc attributes['cvc'] end |
#cvc=(value) ⇒ Object
236 237 238 |
# File 'lib/webpay/data_types.rb', line 236 def cvc=(value) attributes['cvc'] = value end |
#exp_month ⇒ Object
216 217 218 |
# File 'lib/webpay/data_types.rb', line 216 def exp_month attributes['exp_month'] end |
#exp_month=(value) ⇒ Object
220 221 222 |
# File 'lib/webpay/data_types.rb', line 220 def exp_month=(value) attributes['exp_month'] = value end |
#exp_year ⇒ Object
224 225 226 |
# File 'lib/webpay/data_types.rb', line 224 def exp_year attributes['exp_year'] end |
#exp_year=(value) ⇒ Object
228 229 230 |
# File 'lib/webpay/data_types.rb', line 228 def exp_year=(value) attributes['exp_year'] = value end |
#name ⇒ Object
240 241 242 |
# File 'lib/webpay/data_types.rb', line 240 def name attributes['name'] end |
#name=(value) ⇒ Object
244 245 246 |
# File 'lib/webpay/data_types.rb', line 244 def name=(value) attributes['name'] = value end |
#number ⇒ Object
attributes accessors
208 209 210 |
# File 'lib/webpay/data_types.rb', line 208 def number attributes['number'] end |
#number=(value) ⇒ Object
212 213 214 |
# File 'lib/webpay/data_types.rb', line 212 def number=(value) attributes['number'] = value end |
#query_params ⇒ Object
201 202 203 204 |
# File 'lib/webpay/data_types.rb', line 201 def query_params result = {} return result end |
#request_body ⇒ Object
191 192 193 194 195 196 197 198 199 |
# File 'lib/webpay/data_types.rb', line 191 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 |