Class: Unit::Types::CardLimits

Inherits:
Object
  • Object
show all
Defined in:
lib/unit-ruby/types/card_limits.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(daily_withdrawal_limit:, daily_withdrawal_limit_used:, daily_deposit_limit:, daily_deposit_limit_used:, daily_purchase_limit:, daily_purchase_limit_used:, daily_transaction_limit:, daily_transaction_limit_used:) ⇒ CardLimits

Returns a new instance of CardLimits.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/unit-ruby/types/card_limits.rb', line 9

def initialize(daily_withdrawal_limit:, daily_withdrawal_limit_used:,
               daily_deposit_limit:, daily_deposit_limit_used:,
               daily_purchase_limit:, daily_purchase_limit_used:,
               daily_transaction_limit:, daily_transaction_limit_used:)
  @daily_withdrawal_limit = daily_withdrawal_limit
  @daily_withdrawal_limit_used = daily_withdrawal_limit_used
  @daily_deposit_limit = daily_deposit_limit
  @daily_deposit_limit_used = daily_deposit_limit_used
  @daily_purchase_limit = daily_purchase_limit
  @daily_purchase_limit_used = daily_purchase_limit_used
  @daily_transaction_limit = daily_transaction_limit
  @daily_transaction_limit_used = daily_transaction_limit_used
end

Instance Attribute Details

#daily_deposit_limitObject (readonly)

Returns the value of attribute daily_deposit_limit.



4
5
6
# File 'lib/unit-ruby/types/card_limits.rb', line 4

def daily_deposit_limit
  @daily_deposit_limit
end

#daily_deposit_limit_usedObject (readonly)

Returns the value of attribute daily_deposit_limit_used.



4
5
6
# File 'lib/unit-ruby/types/card_limits.rb', line 4

def daily_deposit_limit_used
  @daily_deposit_limit_used
end

#daily_purchase_limitObject (readonly)

Returns the value of attribute daily_purchase_limit.



4
5
6
# File 'lib/unit-ruby/types/card_limits.rb', line 4

def daily_purchase_limit
  @daily_purchase_limit
end

#daily_purchase_limit_usedObject (readonly)

Returns the value of attribute daily_purchase_limit_used.



4
5
6
# File 'lib/unit-ruby/types/card_limits.rb', line 4

def daily_purchase_limit_used
  @daily_purchase_limit_used
end

#daily_transaction_limitObject (readonly)

Returns the value of attribute daily_transaction_limit.



4
5
6
# File 'lib/unit-ruby/types/card_limits.rb', line 4

def daily_transaction_limit
  @daily_transaction_limit
end

#daily_transaction_limit_usedObject (readonly)

Returns the value of attribute daily_transaction_limit_used.



4
5
6
# File 'lib/unit-ruby/types/card_limits.rb', line 4

def daily_transaction_limit_used
  @daily_transaction_limit_used
end

#daily_withdrawal_limitObject (readonly)

Returns the value of attribute daily_withdrawal_limit.



4
5
6
# File 'lib/unit-ruby/types/card_limits.rb', line 4

def daily_withdrawal_limit
  @daily_withdrawal_limit
end

#daily_withdrawal_limit_usedObject (readonly)

Returns the value of attribute daily_withdrawal_limit_used.



4
5
6
# File 'lib/unit-ruby/types/card_limits.rb', line 4

def daily_withdrawal_limit_used
  @daily_withdrawal_limit_used
end

Class Method Details

.cast(val) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/unit-ruby/types/card_limits.rb', line 23

def self.cast(val)
  return val if val.is_a? self
  return nil if val.nil?

  new(
    daily_withdrawal_limit: val[:limits][:daily_withdrawal],
    daily_withdrawal_limit_used: val[:totals_daily][:withdrawals],
    daily_deposit_limit: val[:limits][:daily_deposit],
    daily_deposit_limit_used: val[:totals_daily][:deposits],
    daily_purchase_limit: val[:limits][:daily_purchase],
    daily_purchase_limit_used: val[:totals_daily][:purchases],
    daily_transaction_limit: val[:limits][:daily_card_transaction],
    daily_transaction_limit_used: val[:totals_daily][:card_transactions]
  )
end