class Beaver::RefundResp

RefundResp Model.

Attributes

amounts[RW]

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

api_version[RW]

Owner structure to be used in any resource where an account is the owner @return [String]

create_time[RW]

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

custom_data[RW]

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

failure_reason[RW]

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

id[RW]

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

order[RW]

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

owner[RW]

Owner structure to be used in any resource where an account is the owner @return [OwnerIsAccount]

path[RW]

Owner structure to be used in any resource where an account is the owner @return [String]

payment[RW]

Owner structure to be used in any resource where an account is the owner @return [PaymentNonExpanded]

payment_method[RW]

Owner structure to be used in any resource where an account is the owner @return [PaymentMethodNonExpanded]

pending_reasons[RW]

Owner structure to be used in any resource where an account is the owner @return [List of RefundPendingReason]

reference_id[RW]

Owner structure to be used in any resource where an account is the owner @return [String]

refund_reason[RW]

Owner structure to be used in any resource where an account is the owner @return [String]

resource[RW]

Owner structure to be used in any resource where an account is the owner @return [String]

status[RW]

Owner structure to be used in any resource where an account is the owner @return [String]

txnr_app_fee_refund[RW]

Owner structure to be used in any resource where an account is the owner @return [TransactionRecordNonExpanded]

txnr_merchant_refund[RW]

Owner structure to be used in any resource where an account is the owner @return [TransactionRecordNonExpanded]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

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

  # Extract variables from the hash.
  amounts = RefundAmounts.from_hash(hash['amounts']) if hash['amounts']
  create_time = hash['create_time']
  failure_reason = RefundFailureReason.from_hash(hash['failure_reason']) if
    hash['failure_reason']
  id = hash['id']
  order = OrderNonExpanded.from_hash(hash['order']) if hash['order']
  owner = OwnerIsAccount.from_hash(hash['owner']) if hash['owner']
  path = hash['path']
  payment = PaymentNonExpanded.from_hash(hash['payment']) if
    hash['payment']
  if hash['payment_method']
    payment_method = PaymentMethodNonExpanded.from_hash(hash['payment_method'])
  end
  refund_reason = hash['refund_reason']
  resource = hash['resource']
  status = hash['status']
  if hash['txnr_app_fee_refund']
    txnr_app_fee_refund = TransactionRecordNonExpanded.from_hash(hash['txnr_app_fee_refund'])
  end
  if hash['txnr_merchant_refund']
    txnr_merchant_refund = TransactionRecordNonExpanded.from_hash(hash['txnr_merchant_refund'])
  end
  custom_data = hash['custom_data']
  # Parameter is an array, so we need to iterate through it
  pending_reasons = nil
  unless hash['pending_reasons'].nil?
    pending_reasons = []
    hash['pending_reasons'].each do |structure|
      pending_reasons << (RefundPendingReason.from_hash(structure) if structure)
    end
  end
  api_version = hash['api_version']
  reference_id = hash['reference_id']

  # Create object from extracted values.
  RefundResp.new(amounts,
                 create_time,
                 failure_reason,
                 id,
                 order,
                 owner,
                 path,
                 payment,
                 payment_method,
                 refund_reason,
                 resource,
                 status,
                 txnr_app_fee_refund,
                 txnr_merchant_refund,
                 custom_data,
                 pending_reasons,
                 api_version,
                 reference_id)
end
names() click to toggle source

A mapping from model property names to API property names.

# File lib/beaver/models/refund_resp.rb, line 82
def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amounts'] = 'amounts'
  @_hash['create_time'] = 'create_time'
  @_hash['custom_data'] = 'custom_data'
  @_hash['failure_reason'] = 'failure_reason'
  @_hash['id'] = 'id'
  @_hash['order'] = 'order'
  @_hash['owner'] = 'owner'
  @_hash['path'] = 'path'
  @_hash['payment'] = 'payment'
  @_hash['payment_method'] = 'payment_method'
  @_hash['pending_reasons'] = 'pending_reasons'
  @_hash['refund_reason'] = 'refund_reason'
  @_hash['resource'] = 'resource'
  @_hash['status'] = 'status'
  @_hash['txnr_app_fee_refund'] = 'txnr_app_fee_refund'
  @_hash['txnr_merchant_refund'] = 'txnr_merchant_refund'
  @_hash['api_version'] = 'api_version'
  @_hash['reference_id'] = 'reference_id'
  @_hash
end
new(amounts = nil, create_time = nil, failure_reason = nil, id = nil, order = nil, owner = nil, path = nil, payment = nil, payment_method = nil, refund_reason = nil, resource = nil, status = nil, txnr_app_fee_refund = nil, txnr_merchant_refund = nil, custom_data = nil, pending_reasons = nil, api_version = nil, reference_id = nil) click to toggle source
# File lib/beaver/models/refund_resp.rb, line 105
def initialize(amounts = nil,
               create_time = nil,
               failure_reason = nil,
               id = nil,
               order = nil,
               owner = nil,
               path = nil,
               payment = nil,
               payment_method = nil,
               refund_reason = nil,
               resource = nil,
               status = nil,
               txnr_app_fee_refund = nil,
               txnr_merchant_refund = nil,
               custom_data = nil,
               pending_reasons = nil,
               api_version = nil,
               reference_id = nil)
  @amounts = amounts
  @create_time = create_time
  @custom_data = custom_data
  @failure_reason = failure_reason
  @id = id
  @order = order
  @owner = owner
  @path = path
  @payment = payment
  @payment_method = payment_method
  @pending_reasons = pending_reasons
  @refund_reason = refund_reason
  @resource = resource
  @status = status
  @txnr_app_fee_refund = txnr_app_fee_refund
  @txnr_merchant_refund = txnr_merchant_refund
  @api_version = api_version
  @reference_id = reference_id
end