Class: SchwabRb::DataObjects::Account
- Inherits:
-
Object
- Object
- SchwabRb::DataObjects::Account
- Defined in:
- lib/schwab_rb/data_objects/account.rb
Instance Attribute Summary collapse
-
#account_number ⇒ Object
readonly
Returns the value of attribute account_number.
-
#current_balances ⇒ Object
readonly
Returns the value of attribute current_balances.
-
#initial_balances ⇒ Object
readonly
Returns the value of attribute initial_balances.
-
#is_closing_only_restricted ⇒ Object
readonly
Returns the value of attribute is_closing_only_restricted.
-
#is_day_trader ⇒ Object
readonly
Returns the value of attribute is_day_trader.
-
#pfcb_flag ⇒ Object
readonly
Returns the value of attribute pfcb_flag.
-
#positions ⇒ Object
readonly
Returns the value of attribute positions.
-
#projected_balances ⇒ Object
readonly
Returns the value of attribute projected_balances.
-
#round_trips ⇒ Object
readonly
Returns the value of attribute round_trips.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type:, account_number:, round_trips:, is_day_trader:, is_closing_only_restricted:, pfcb_flag:, initial_balances:, current_balances:, projected_balances:, positions: []) ⇒ Account
constructor
A new instance of Account.
Constructor Details
#initialize(type:, account_number:, round_trips:, is_day_trader:, is_closing_only_restricted:, pfcb_flag:, initial_balances:, current_balances:, projected_balances:, positions: []) ⇒ Account
Returns a new instance of Account.
263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/schwab_rb/data_objects/account.rb', line 263 def initialize(type:, account_number:, round_trips:, is_day_trader:, is_closing_only_restricted:, pfcb_flag:, initial_balances:, current_balances:, projected_balances:, positions: []) @type = type @account_number = account_number @round_trips = round_trips @is_day_trader = is_day_trader @is_closing_only_restricted = is_closing_only_restricted @pfcb_flag = pfcb_flag @positions = positions @initial_balances = initial_balances @current_balances = current_balances @projected_balances = projected_balances end |
Instance Attribute Details
#account_number ⇒ Object (readonly)
Returns the value of attribute account_number.
277 278 279 |
# File 'lib/schwab_rb/data_objects/account.rb', line 277 def account_number @account_number end |
#current_balances ⇒ Object (readonly)
Returns the value of attribute current_balances.
277 278 279 |
# File 'lib/schwab_rb/data_objects/account.rb', line 277 def current_balances @current_balances end |
#initial_balances ⇒ Object (readonly)
Returns the value of attribute initial_balances.
277 278 279 |
# File 'lib/schwab_rb/data_objects/account.rb', line 277 def initial_balances @initial_balances end |
#is_closing_only_restricted ⇒ Object (readonly)
Returns the value of attribute is_closing_only_restricted.
277 278 279 |
# File 'lib/schwab_rb/data_objects/account.rb', line 277 def is_closing_only_restricted @is_closing_only_restricted end |
#is_day_trader ⇒ Object (readonly)
Returns the value of attribute is_day_trader.
277 278 279 |
# File 'lib/schwab_rb/data_objects/account.rb', line 277 def is_day_trader @is_day_trader end |
#pfcb_flag ⇒ Object (readonly)
Returns the value of attribute pfcb_flag.
277 278 279 |
# File 'lib/schwab_rb/data_objects/account.rb', line 277 def pfcb_flag @pfcb_flag end |
#positions ⇒ Object (readonly)
Returns the value of attribute positions.
277 278 279 |
# File 'lib/schwab_rb/data_objects/account.rb', line 277 def positions @positions end |
#projected_balances ⇒ Object (readonly)
Returns the value of attribute projected_balances.
277 278 279 |
# File 'lib/schwab_rb/data_objects/account.rb', line 277 def projected_balances @projected_balances end |
#round_trips ⇒ Object (readonly)
Returns the value of attribute round_trips.
277 278 279 |
# File 'lib/schwab_rb/data_objects/account.rb', line 277 def round_trips @round_trips end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
277 278 279 |
# File 'lib/schwab_rb/data_objects/account.rb', line 277 def type @type end |
Class Method Details
.build(data) ⇒ Object
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/schwab_rb/data_objects/account.rb', line 246 def build(data) data = data[:securitiesAccount] if data.key?(:securitiesAccount) new( type: data.fetch(:type), account_number: data.fetch(:accountNumber), round_trips: data.fetch(:roundTrips), is_day_trader: data.fetch(:isDayTrader), is_closing_only_restricted: data.fetch(:isClosingOnlyRestricted), pfcb_flag: data.fetch(:pfcbFlag), positions: data.fetch(:positions, []).map { |position| Position.build(position) }, initial_balances: InitialBalances.build(data.fetch(:initialBalances)), current_balances: CurrentBalances.build(data.fetch(:currentBalances)), projected_balances: ProjectedBalances.build(data.fetch(:projectedBalances)) ) end |