class Beaver::Recoveries

Recoveries Model.

Attributes

amount[RW]

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

api_version[RW]

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

complete_time[RW]

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

create_time[RW]

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

currency[RW]

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

custom_data[RW]

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

failure_reason[RW]

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

id[RW]

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

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]

payout_method[RW]

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

pending_reasons[RW]

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

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 [StatusEnum]

txnr_failure[RW]

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

txnr_recovery[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/recoveries.rb, line 130
def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount = hash['amount']
  create_time = hash['create_time']
  currency = hash['currency']
  if hash['failure_reason']
    failure_reason = RecoveryFailureReason.from_hash(hash['failure_reason'])
  end
  id = hash['id']
  owner = OwnerIsAccount.from_hash(hash['owner']) if hash['owner']
  path = hash['path']
  if hash['payout_method']
    payout_method = PayoutMethodNonExpanded.from_hash(hash['payout_method'])
  end
  resource = hash['resource']
  status = hash['status']
  if hash['txnr_failure']
    txnr_failure = TransactionRecordNonExpanded.from_hash(hash['txnr_failure'])
  end
  if hash['txnr_recovery']
    txnr_recovery = TransactionRecordNonExpanded.from_hash(hash['txnr_recovery'])
  end
  complete_time = hash['complete_time']
  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 << (RecoveryPendingReason.from_hash(structure) if structure)
    end
  end
  api_version = hash['api_version']

  # Create object from extracted values.
  Recoveries.new(amount,
                 create_time,
                 currency,
                 failure_reason,
                 id,
                 owner,
                 path,
                 payout_method,
                 resource,
                 status,
                 txnr_failure,
                 txnr_recovery,
                 complete_time,
                 custom_data,
                 pending_reasons,
                 api_version)
end
names() click to toggle source

A mapping from model property names to API property names.

# File lib/beaver/models/recoveries.rb, line 74
def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount'] = 'amount'
  @_hash['complete_time'] = 'complete_time'
  @_hash['create_time'] = 'create_time'
  @_hash['currency'] = 'currency'
  @_hash['custom_data'] = 'custom_data'
  @_hash['failure_reason'] = 'failure_reason'
  @_hash['id'] = 'id'
  @_hash['owner'] = 'owner'
  @_hash['path'] = 'path'
  @_hash['payout_method'] = 'payout_method'
  @_hash['pending_reasons'] = 'pending_reasons'
  @_hash['resource'] = 'resource'
  @_hash['status'] = 'status'
  @_hash['txnr_failure'] = 'txnr_failure'
  @_hash['txnr_recovery'] = 'txnr_recovery'
  @_hash['api_version'] = 'api_version'
  @_hash
end
new(amount = nil, create_time = nil, currency = nil, failure_reason = nil, id = nil, owner = nil, path = nil, payout_method = nil, resource = nil, status = nil, txnr_failure = nil, txnr_recovery = nil, complete_time = nil, custom_data = nil, pending_reasons = nil, api_version = nil) click to toggle source
# File lib/beaver/models/recoveries.rb, line 95
def initialize(amount = nil,
               create_time = nil,
               currency = nil,
               failure_reason = nil,
               id = nil,
               owner = nil,
               path = nil,
               payout_method = nil,
               resource = nil,
               status = nil,
               txnr_failure = nil,
               txnr_recovery = nil,
               complete_time = nil,
               custom_data = nil,
               pending_reasons = nil,
               api_version = nil)
  @amount = amount
  @complete_time = complete_time
  @create_time = create_time
  @currency = currency
  @custom_data = custom_data
  @failure_reason = failure_reason
  @id = id
  @owner = owner
  @path = path
  @payout_method = payout_method
  @pending_reasons = pending_reasons
  @resource = resource
  @status = status
  @txnr_failure = txnr_failure
  @txnr_recovery = txnr_recovery
  @api_version = api_version
end