Module: UU::Finman::Account
- Extended by:
- Account
- Included in:
- Account
- Defined in:
- lib/uu/finman/account.rb,
lib/uu/finman/account/account_type.rb,
lib/uu/finman/account/account_state.rb,
lib/uu/finman/account/account_create.rb,
lib/uu/finman/account/account_set_state.rb,
lib/uu/finman/account/account_attributes.rb,
lib/uu/finman/account/account_set_attributes.rb
Overview
Module of Account
Defined Under Namespace
Classes: AccountAttributes, AccountCreate, AccountSetAttributes, AccountSetState, AccountState, AccountType
Constant Summary
- PATH =
Service path
'uu/finman/account/Account'
Instance Method Summary (collapse)
-
- (UU::OS::UESURI) create(location_uri, account)
Creates a new Account.
-
- (UU::Finman::Account::AccountAttributes) get_attributes(account_uri)
Obtains Account attributes from REST service and returns them.
-
- (UU::OS::UESURI) set_attributes(account_uri, account_set_attributes)
Sets attributes of Account.
-
- (Object) set_state(account_uri, state)
Sets state of Account.
Instance Method Details
- (UU::OS::UESURI) create(location_uri, account)
Creates a new Account. The command creates a new Account in a specified
location with passed DTO parameters.
Required attributes:
account_type, name, company_uri, location_uri, bank_account_number, account_currency_code (since version FINMAN3-15-8)
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/uu/finman/account.rb', line 47 def create(location_uri, account) svc = UU::OS::REST::RemoteClient.new(Account) account_create = UU::Finman::Account::AccountCreate.new(account) transaction = transform_account_to_dto(account_create).to_json UU::OS::QoS::QoSHandler.auto_retry do res = svc.post('create', location_uri, transaction) return UU::OS::UESURI.new(res) end end |
- (UU::Finman::Account::AccountAttributes) get_attributes(account_uri)
Obtains Account attributes from REST service and returns them
71 72 73 74 75 76 77 78 79 |
# File 'lib/uu/finman/account.rb', line 71 def get_attributes(account_uri) svc = UU::OS::REST::RemoteClient.new(Account) UU::OS::QoS::QoSHandler.auto_retry do attrs_string = svc.get('getAttributes', account_uri) attrs = JSON.parse(attrs_string, :symbolize_names => true) attrs = remove_invalid_keys(attrs) return UU::Finman::Account::AccountAttributes.new(attrs) end end |
- (UU::OS::UESURI) set_attributes(account_uri, account_set_attributes)
Sets attributes of Account.
96 97 98 99 100 101 102 103 104 105 |
# File 'lib/uu/finman/account.rb', line 96 def set_attributes(account_uri, account_set_attributes) svc = UU::OS::REST::RemoteClient.new(Account) a_attrs = UU::Finman::Account::AccountSetAttributes.new(account_set_attributes) transaction = transform_account_to_dto(a_attrs).to_json UU::OS::QoS::QoSHandler.auto_retry do res = svc.post('setAttributes', account_uri, transaction) return UU::OS::UESURI.new(res) end end |
- (Object) set_state(account_uri, state)
Sets state of Account.
119 120 121 122 123 124 125 126 |
# File 'lib/uu/finman/account.rb', line 119 def set_state(account_uri, state) svc = UU::OS::REST::RemoteClient.new(Account) payload = UU::Finman::Account::AccountSetState.new(state).to_json UU::OS::QoS::QoSHandler.auto_retry do res = svc.post('setState', account_uri, payload) end end |