Class: Unit::DepositAccount

Inherits:
APIResource show all
Includes:
ResourceOperations::Create, ResourceOperations::Find, ResourceOperations::List, ResourceOperations::Save
Defined in:
lib/unit-ruby/deposit_account.rb

Instance Attribute Summary

Attributes inherited from APIResource

#id, #raw_data, #relationships, #type

Instance Method Summary collapse

Methods included from ResourceOperations::Find

included

Methods included from ResourceOperations::Save

#save

Methods included from ResourceOperations::Create

included

Methods included from ResourceOperations::List

included

Methods inherited from APIResource

#as_json_api, attribute, #attributes, belongs_to, build_resource_from_json_api, #clear_attributes!, connection, #dirty?, #dirty_attributes, has_many, #initialize, #mark_as_clean!, #mark_attribute_as_dirty, path, resource_path, #resource_type, resources_path, #schema, schema, #update_attribute, #update_resource_from_json_api

Constructor Details

This class inherits a constructor from Unit::APIResource

Instance Method Details

#ach_limitsObject



41
42
43
# File 'lib/unit-ruby/deposit_account.rb', line 41

def ach_limits
  limits.ach_limits
end

#add_customer(customer_id) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/unit-ruby/deposit_account.rb', line 24

def add_customer(customer_id)
  self.class.connection.post(
    "accounts/#{id}/relationships/customers",
    {
      data: [{ type: 'customer', id: customer_id }]
    }
  )

  self.class.find(id)
end

#card_limitsObject



45
46
47
# File 'lib/unit-ruby/deposit_account.rb', line 45

def card_limits
  limits.card_limits
end

#check_deposit_limitsObject



49
50
51
# File 'lib/unit-ruby/deposit_account.rb', line 49

def check_deposit_limits
  limits.check_deposit_limits
end

#limitsObject



35
36
37
38
39
# File 'lib/unit-ruby/deposit_account.rb', line 35

def limits
  @limits ||= Types::AccountLimits.cast(
    self.class.connection.get("accounts/#{id}/limits")
  )
end