Class: AqumulateAPI::Transaction

Inherits:
Entity
  • Object
show all
Defined in:
lib/aqumulate_api/entities/transaction.rb

Constant Summary collapse

ATTR_MAP =
{
    id: 'TransactionId',
    account_id: 'AccountId',
    transaction_type: 'TransactionType',
    posted_date: 'PostedDate',
    origination_date: 'OriginationDate',
    amount: 'Amount',
    currency: 'CurCode',
    description: 'Description',
    code: 'TransactionCode',
    action: 'TransactionAction',
    date: 'TransactionDate',
    commision: 'Commission',
    ticker: 'Ticker',
    position_description: 'PosDescription',
    asset_id: 'AssetID',
    asset_type: 'AssetIDType',
    units: 'Units',
    price: 'Price',
    check_number: 'CheckNumber',
    created_on: 'CreatedOn'
}

Constants inherited from Entity

Entity::SOURCE_ASSOCIATIONS

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Entity

from_source, #initialize

Constructor Details

This class inherits a constructor from AqumulateAPI::Entity

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def 
  @account_id
end

#actionObject

Returns the value of attribute action.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def action
  @action
end

#amountObject

Returns the value of attribute amount.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def amount
  @amount
end

#asset_idObject

Returns the value of attribute asset_id.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def asset_id
  @asset_id
end

#asset_typeObject

Returns the value of attribute asset_type.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def asset_type
  @asset_type
end

#check_numberObject

Returns the value of attribute check_number.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def check_number
  @check_number
end

#codeObject

Returns the value of attribute code.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def code
  @code
end

#commissionObject

Returns the value of attribute commission.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def commission
  @commission
end

#created_onObject

Returns the value of attribute created_on.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def created_on
  @created_on
end

#currencyObject

Returns the value of attribute currency.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def currency
  @currency
end

#dateObject

Returns the value of attribute date.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def date
  @date
end

#descriptionObject

Returns the value of attribute description.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def description
  @description
end

#idObject

Returns the value of attribute id.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def id
  @id
end

#origination_dateObject

Returns the value of attribute origination_date.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def origination_date
  @origination_date
end

#position_descriptionObject

Returns the value of attribute position_description.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def position_description
  @position_description
end

#posted_dateObject

Returns the value of attribute posted_date.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def posted_date
  @posted_date
end

#priceObject

Returns the value of attribute price.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def price
  @price
end

#tickerObject

Returns the value of attribute ticker.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def ticker
  @ticker
end

#transaction_typeObject

Returns the value of attribute transaction_type.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def transaction_type
  @transaction_type
end

#unitsObject

Returns the value of attribute units.



27
28
29
# File 'lib/aqumulate_api/entities/transaction.rb', line 27

def units
  @units
end

Class Method Details

.fetch(advisor, account, start_date, end_date) ⇒ Array(Transaction)

Parameters:

  • advisor (Advisor)
  • account (Account)
  • start_date (Date)
  • end_date (Date)

Returns:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/aqumulate_api/entities/transaction.rb', line 36

def self.fetch(advisor, , start_date, end_date)
  body = {
      'SessionId' => advisor.session_id,
      'AccountId' => .id,
      'AccountType' => .,
      'ExtendedAccountType' => .,
      'StartDate' => start_date.strftime('%m/%d/%Y'),
      'EndDate' => end_date.strftime('%m/%d/%Y')
  }

  response = AggAccount.advisor_get_transactions_by_date(body)

  return [] unless response.has_key?('Transactions')

  response['Transactions'].map { |source| from_source(source) }
end