class Beaver::PaymentMethodForPayments

PaymentMethodForPayments 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]

encoded_payment_method[RW]

Encoded payment data. Currently is used for POS payment tokens but in future may be used for other types of encoded payment information @return [String]

payment_bank_us[RW]

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

payment_method_id[RW]

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

token[RW]

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

type[RW]

Encoded payment data. Currently is used for POS payment tokens but in future may be used for other types of encoded payment information @return [Type9Enum]

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_for_payments.rb, line 69
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']
  payment_method_id = hash['payment_method_id']
  token = Token.from_hash(hash['token']) if hash['token']
  encoded_payment_method = hash['encoded_payment_method']

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

A mapping from model property names to API property names.

# File lib/beaver/models/payment_method_for_payments.rb, line 40
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['payment_method_id'] = 'payment_method_id'
  @_hash['token'] = 'token'
  @_hash['encoded_payment_method'] = 'encoded_payment_method'
  @_hash['type'] = 'type'
  @_hash
end
new(type = nil, credit_card = nil, custom_data = nil, payment_bank_us = nil, payment_method_id = nil, token = nil, encoded_payment_method = nil) click to toggle source
# File lib/beaver/models/payment_method_for_payments.rb, line 52
def initialize(type = nil,
               credit_card = nil,
               custom_data = nil,
               payment_bank_us = nil,
               payment_method_id = nil,
               token = nil,
               encoded_payment_method = nil)
  @credit_card = credit_card
  @custom_data = custom_data
  @payment_bank_us = payment_bank_us
  @payment_method_id = payment_method_id
  @token = token
  @encoded_payment_method = encoded_payment_method
  @type = type
end