Class: WireClient::Account

Inherits:
Object
  • Object
show all
Extended by:
Converter
Includes:
ActiveModel::Validations
Defined in:
lib/wire_client/account/account.rb

Direct Known Subclasses

CreditorAccount, DebtorAccount

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Converter

convert

Constructor Details

#initialize(attributes = {}) ⇒ Account

Returns a new instance of Account.



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/wire_client/account/account.rb', line 32

def initialize(attributes = {})
  attributes.each do |name, value|
    public_send("#{name}=", value)
  end

  @currency ||= 'USD'
  @country ||= 'US'
  @country_subdivision ||= 'MA' if self.country == 'US'
  @schema_code ||= 'CUST'
  @clear_system_code ||= 'USABA'
  custom_defaults if self.respond_to? :custom_defaults
end

Instance Attribute Details

#account_numberObject

Returns the value of attribute account_number.



9
10
11
# File 'lib/wire_client/account/account.rb', line 9

def 
  @account_number
end

#bicObject

Returns the value of attribute bic.



9
10
11
# File 'lib/wire_client/account/account.rb', line 9

def bic
  @bic
end

#charge_bearerObject

Returns the value of attribute charge_bearer.



9
10
11
# File 'lib/wire_client/account/account.rb', line 9

def charge_bearer
  @charge_bearer
end

#clear_system_codeObject

Returns the value of attribute clear_system_code.



9
10
11
# File 'lib/wire_client/account/account.rb', line 9

def clear_system_code
  @clear_system_code
end

#countryObject

Returns the value of attribute country.



9
10
11
# File 'lib/wire_client/account/account.rb', line 9

def country
  @country
end

#country_subdivisionObject

Returns the value of attribute country_subdivision.



9
10
11
# File 'lib/wire_client/account/account.rb', line 9

def country_subdivision
  @country_subdivision
end

#currencyObject

Returns the value of attribute currency.



9
10
11
# File 'lib/wire_client/account/account.rb', line 9

def currency
  @currency
end

#ibanObject

Returns the value of attribute iban.



9
10
11
# File 'lib/wire_client/account/account.rb', line 9

def iban
  @iban
end

#identifierObject

Returns the value of attribute identifier.



9
10
11
# File 'lib/wire_client/account/account.rb', line 9

def identifier
  @identifier
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/wire_client/account/account.rb', line 9

def name
  @name
end

#schema_codeObject

Returns the value of attribute schema_code.



9
10
11
# File 'lib/wire_client/account/account.rb', line 9

def schema_code
  @schema_code
end

#wire_routing_numberObject

Returns the value of attribute wire_routing_number.



9
10
11
# File 'lib/wire_client/account/account.rb', line 9

def wire_routing_number
  @wire_routing_number
end

Instance Method Details

#country_subdivision_abbrObject



45
46
47
48
49
50
# File 'lib/wire_client/account/account.rb', line 45

def country_subdivision_abbr
  if @country == 'US' && !@country_subdivision.match(/\A[A-Z]{2,2}\z/)
    return US_STATES[@country_subdivision]
  end
  @country_subdivision
end

#country_subdivision_nameObject



52
53
54
55
56
57
# File 'lib/wire_client/account/account.rb', line 52

def country_subdivision_name
  if @country == 'US' && @country_subdivision.match(/\A[A-Z]{2,2}\z/)
    return US_STATES.key(@country_subdivision)
  end
  @country_subdivision
end