class Beaver::RefundReq

RefundReq Model.

Attributes

amounts[RW]

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

custom_data[RW]

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

order_id[RW]

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

payment_id[RW]

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

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]

refund_reason[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/refund_req.rb, line 67
def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payment_id = hash['payment_id']
  refund_reason = hash['refund_reason']
  amounts = RefundAmounts.from_hash(hash['amounts']) if hash['amounts']
  custom_data = hash['custom_data']
  order_id = hash['order_id']
  # 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.
  RefundReq.new(payment_id,
                refund_reason,
                amounts,
                custom_data,
                order_id,
                rbits,
                reference_id)
end
names() click to toggle source

A mapping from model property names to API property names.

# File lib/beaver/models/refund_req.rb, line 38
def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amounts'] = 'amounts'
  @_hash['custom_data'] = 'custom_data'
  @_hash['order_id'] = 'order_id'
  @_hash['payment_id'] = 'payment_id'
  @_hash['rbits'] = 'rbits'
  @_hash['refund_reason'] = 'refund_reason'
  @_hash['reference_id'] = 'reference_id'
  @_hash
end
new(payment_id = nil, refund_reason = nil, amounts = nil, custom_data = nil, order_id = nil, rbits = nil, reference_id = nil) click to toggle source
# File lib/beaver/models/refund_req.rb, line 50
def initialize(payment_id = nil,
               refund_reason = nil,
               amounts = nil,
               custom_data = nil,
               order_id = nil,
               rbits = nil,
               reference_id = nil)
  @amounts = amounts
  @custom_data = custom_data
  @order_id = order_id
  @payment_id = payment_id
  @rbits = rbits
  @refund_reason = refund_reason
  @reference_id = reference_id
end