class Beaver::PaymentsRequest

PaymentsRequest Model.

Attributes

account_id[RW]

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

amount[RW]

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

auto_capture[RW]

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

capture_at[RW]

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

currency[RW]

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

custom_data[RW]

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

fee_amount[RW]

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

initiated_by[RW]

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

order_id[RW]

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

payment_method[RW]

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

rbits[RW]

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

reference_id[RW]

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

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

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

  # Extract variables from the hash.
  account_id = hash['account_id']
  amount = hash['amount']
  currency = hash['currency']
  if hash['payment_method']
    payment_method = PaymentMethodForPayments.from_hash(hash['payment_method'])
  end
  auto_capture = hash['auto_capture']
  capture_at = hash['capture_at']
  custom_data = hash['custom_data']
  fee_amount = hash['fee_amount']
  order_id = hash['order_id']
  initiated_by = hash['initiated_by']
  # 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
  reference_id = hash['reference_id']

  # Create object from extracted values.
  PaymentsRequest.new(account_id,
                      amount,
                      currency,
                      payment_method,
                      auto_capture,
                      capture_at,
                      custom_data,
                      fee_amount,
                      order_id,
                      initiated_by,
                      rbits,
                      reference_id)
end
names() click to toggle source

A mapping from model property names to API property names.

# File lib/beaver/models/payments_request.rb, line 58
def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'account_id'
  @_hash['amount'] = 'amount'
  @_hash['auto_capture'] = 'auto_capture'
  @_hash['capture_at'] = 'capture_at'
  @_hash['currency'] = 'currency'
  @_hash['custom_data'] = 'custom_data'
  @_hash['fee_amount'] = 'fee_amount'
  @_hash['order_id'] = 'order_id'
  @_hash['payment_method'] = 'payment_method'
  @_hash['initiated_by'] = 'initiated_by'
  @_hash['rbits'] = 'rbits'
  @_hash['reference_id'] = 'reference_id'
  @_hash
end
new(account_id = nil, amount = nil, currency = nil, payment_method = nil, auto_capture = nil, capture_at = nil, custom_data = nil, fee_amount = nil, order_id = nil, initiated_by = nil, rbits = nil, reference_id = nil) click to toggle source
# File lib/beaver/models/payments_request.rb, line 75
def initialize(account_id = nil,
               amount = nil,
               currency = nil,
               payment_method = nil,
               auto_capture = nil,
               capture_at = nil,
               custom_data = nil,
               fee_amount = nil,
               order_id = nil,
               initiated_by = nil,
               rbits = nil,
               reference_id = nil)
  @account_id = account_id
  @amount = amount
  @auto_capture = auto_capture
  @capture_at = capture_at
  @currency = currency
  @custom_data = custom_data
  @fee_amount = fee_amount
  @order_id = order_id
  @payment_method = payment_method
  @initiated_by = initiated_by
  @rbits = rbits
  @reference_id = reference_id
end