Class: Raas::DepositResponseModel

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/raas/models/deposit_response_model.rb

Overview

Represents the response from a place deposit call

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(amount = nil, amount_charged = nil, created_date = nil, fee_percent = nil, reference_deposit_id = nil, status = nil) ⇒ DepositResponseModel

Returns a new instance of DepositResponseModel.



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/raas/models/deposit_response_model.rb', line 44

def initialize(amount = nil,
               amount_charged = nil,
               created_date = nil,
               fee_percent = nil,
               reference_deposit_id = nil,
               status = nil)
  @amount = amount
  @amount_charged = amount_charged
  @created_date = created_date
  @fee_percent = fee_percent
  @reference_deposit_id = reference_deposit_id
  @status = status
end

Instance Attribute Details

#amountFloat

The funding amount

Returns:

  • (Float)


10
11
12
# File 'lib/raas/models/deposit_response_model.rb', line 10

def amount
  @amount
end

#amount_chargedFloat

The amount charged, after fees

Returns:

  • (Float)


14
15
16
# File 'lib/raas/models/deposit_response_model.rb', line 14

def amount_charged
  @amount_charged
end

#created_dateDateTime

The date the transaction was created

Returns:

  • (DateTime)


18
19
20
# File 'lib/raas/models/deposit_response_model.rb', line 18

def created_date
  @created_date
end

#fee_percentFloat

The processing fee percentage

Returns:

  • (Float)


22
23
24
# File 'lib/raas/models/deposit_response_model.rb', line 22

def fee_percent
  @fee_percent
end

#reference_deposit_idString

The deposit reference id

Returns:



26
27
28
# File 'lib/raas/models/deposit_response_model.rb', line 26

def reference_deposit_id
  @reference_deposit_id
end

#statusString

The status of the transaction

Returns:



30
31
32
# File 'lib/raas/models/deposit_response_model.rb', line 30

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/raas/models/deposit_response_model.rb', line 59

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount = hash['amount']
  amount_charged = hash['amountCharged']
  created_date = APIHelper.rfc3339(hash['createdDate']) if
    hash['createdDate']
  fee_percent = hash['feePercent']
  reference_deposit_id = hash['referenceDepositID']
  status = hash['status']

  # Create object from extracted values.
  DepositResponseModel.new(amount,
                           amount_charged,
                           created_date,
                           fee_percent,
                           reference_deposit_id,
                           status)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
42
# File 'lib/raas/models/deposit_response_model.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount'] = 'amount'
  @_hash['amount_charged'] = 'amountCharged'
  @_hash['created_date'] = 'createdDate'
  @_hash['fee_percent'] = 'feePercent'
  @_hash['reference_deposit_id'] = 'referenceDepositID'
  @_hash['status'] = 'status'
  @_hash
end