Class: WebPay::CardRequest

Inherits:
Entity
  • Object
show all
Defined in:
lib/webpay/data_types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#normalize_hash, #to_h, #to_s

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

#attributesObject (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

.fieldsObject



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

#cvcObject



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_monthObject



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_yearObject



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

#nameObject



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

#numberObject

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_paramsObject



201
202
203
204
# File 'lib/webpay/data_types.rb', line 201

def query_params
  result = {}
  return result
end

#request_bodyObject



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