class Beaver::PaymentMethodReq

PaymentMethodReq Model.

Attributes

credit_card[RW]

TODO: Write general description for this method @return [CreditCard2]

custom_data[RW]

TODO: Write general description for this method @return [Object]

payment_bank_us[RW]

TODO: Write general description for this method @return [PaymentBankUsReq]

rbits[RW]

TODO: Write general description for this method @return [List of EmbeddedRbit]

token[RW]

TODO: Write general description for this method @return [Token]

type[RW]

TODO: Write general description for this method @return [Type3Enum]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

# File lib/beaver/models/payment_method_req.rb, line 60
def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash['type']
  credit_card = CreditCard2.from_hash(hash['credit_card']) if
    hash['credit_card']
  custom_data = hash['custom_data']
  payment_bank_us = PaymentBankUsReq.from_hash(hash['payment_bank_us']) if
    hash['payment_bank_us']
  # Parameter is an array, so we need to iterate through it
  rbits = nil
  unless hash['rbits'].nil?
    rbits = []
    hash['rbits'].each do |structure|
      rbits << (EmbeddedRbit.from_hash(structure) if structure)
    end
  end
  token = Token.from_hash(hash['token']) if hash['token']

  # Create object from extracted values.
  PaymentMethodReq.new(type,
                       credit_card,
                       custom_data,
                       payment_bank_us,
                       rbits,
                       token)
end
names() click to toggle source

A mapping from model property names to API property names.

# File lib/beaver/models/payment_method_req.rb, line 34
def self.names
  @_hash = {} if @_hash.nil?
  @_hash['credit_card'] = 'credit_card'
  @_hash['custom_data'] = 'custom_data'
  @_hash['payment_bank_us'] = 'payment_bank_us'
  @_hash['rbits'] = 'rbits'
  @_hash['token'] = 'token'
  @_hash['type'] = 'type'
  @_hash
end
new(type = nil, credit_card = nil, custom_data = nil, payment_bank_us = nil, rbits = nil, token = nil) click to toggle source
# File lib/beaver/models/payment_method_req.rb, line 45
def initialize(type = nil,
               credit_card = nil,
               custom_data = nil,
               payment_bank_us = nil,
               rbits = nil,
               token = nil)
  @credit_card = credit_card
  @custom_data = custom_data
  @payment_bank_us = payment_bank_us
  @rbits = rbits
  @token = token
  @type = type
end