Class: SchwabRb::DataObjects::OrderActivity
- Inherits:
-
Object
- Object
- SchwabRb::DataObjects::OrderActivity
- Defined in:
- lib/schwab_rb/data_objects/order.rb
Instance Attribute Summary collapse
-
#activity_id ⇒ Object
readonly
Returns the value of attribute activity_id.
-
#activity_type ⇒ Object
readonly
Returns the value of attribute activity_type.
-
#execution_legs ⇒ Object
readonly
Returns the value of attribute execution_legs.
-
#execution_type ⇒ Object
readonly
Returns the value of attribute execution_type.
-
#order_remaining_quantity ⇒ Object
readonly
Returns the value of attribute order_remaining_quantity.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(activity_type:, activity_id:, execution_type:, quantity:, order_remaining_quantity:, execution_legs:) ⇒ OrderActivity
constructor
A new instance of OrderActivity.
- #to_h ⇒ Object
Constructor Details
#initialize(activity_type:, activity_id:, execution_type:, quantity:, order_remaining_quantity:, execution_legs:) ⇒ OrderActivity
60 61 62 63 64 65 66 67 68 |
# File 'lib/schwab_rb/data_objects/order.rb', line 60 def initialize(activity_type:, activity_id:, execution_type:, quantity:, order_remaining_quantity:, execution_legs:) @activity_type = activity_type @activity_id = activity_id @execution_type = execution_type @quantity = quantity @order_remaining_quantity = order_remaining_quantity @execution_legs = execution_legs end |
Instance Attribute Details
#activity_id ⇒ Object (readonly)
Returns the value of attribute activity_id.
45 46 47 |
# File 'lib/schwab_rb/data_objects/order.rb', line 45 def activity_id @activity_id end |
#activity_type ⇒ Object (readonly)
Returns the value of attribute activity_type.
45 46 47 |
# File 'lib/schwab_rb/data_objects/order.rb', line 45 def activity_type @activity_type end |
#execution_legs ⇒ Object (readonly)
Returns the value of attribute execution_legs.
45 46 47 |
# File 'lib/schwab_rb/data_objects/order.rb', line 45 def execution_legs @execution_legs end |
#execution_type ⇒ Object (readonly)
Returns the value of attribute execution_type.
45 46 47 |
# File 'lib/schwab_rb/data_objects/order.rb', line 45 def execution_type @execution_type end |
#order_remaining_quantity ⇒ Object (readonly)
Returns the value of attribute order_remaining_quantity.
45 46 47 |
# File 'lib/schwab_rb/data_objects/order.rb', line 45 def order_remaining_quantity @order_remaining_quantity end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
45 46 47 |
# File 'lib/schwab_rb/data_objects/order.rb', line 45 def quantity @quantity end |
Class Method Details
.build(data) ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/schwab_rb/data_objects/order.rb', line 48 def build(data) new( activity_type: data[:activityType], activity_id: data[:activityId], execution_type: data[:executionType], quantity: data[:quantity], order_remaining_quantity: data[:orderRemainingQuantity], execution_legs: data.fetch(:executionLegs, []).map { |leg| ExecutionLeg.build(leg) } ) end |
Instance Method Details
#to_h ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/schwab_rb/data_objects/order.rb', line 70 def to_h { activityType: @activity_type, activityId: @activity_id, executionType: @execution_type, quantity: @quantity, orderRemainingQuantity: @order_remaining_quantity, executionLegs: @execution_legs.map(&:to_h) } end |