Class: SchwabRb::DataObjects::OptionDeliverable
- Inherits:
-
Object
- Object
- SchwabRb::DataObjects::OptionDeliverable
- Defined in:
- lib/schwab_rb/data_objects/instrument.rb
Instance Attribute Summary collapse
-
#deliverable ⇒ Object
readonly
Returns the value of attribute deliverable.
-
#deliverable_number ⇒ Object
readonly
Returns the value of attribute deliverable_number.
-
#deliverable_units ⇒ Object
readonly
Returns the value of attribute deliverable_units.
-
#root_symbol ⇒ Object
readonly
Returns the value of attribute root_symbol.
-
#strike_percent ⇒ Object
readonly
Returns the value of attribute strike_percent.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(root_symbol:, symbol:, deliverable_units:, deliverable_number:, strike_percent:, deliverable:) ⇒ OptionDeliverable
constructor
A new instance of OptionDeliverable.
- #to_h ⇒ Object
Constructor Details
#initialize(root_symbol:, symbol:, deliverable_units:, deliverable_number:, strike_percent:, deliverable:) ⇒ OptionDeliverable
Returns a new instance of OptionDeliverable.
75 76 77 78 79 80 81 82 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 75 def initialize(root_symbol:, symbol:, deliverable_units:, deliverable_number:, strike_percent:, deliverable:) @root_symbol = root_symbol @symbol = symbol @deliverable_units = deliverable_units @deliverable_number = deliverable_number @strike_percent = strike_percent @deliverable = deliverable end |
Instance Attribute Details
#deliverable ⇒ Object (readonly)
Returns the value of attribute deliverable.
62 63 64 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 62 def deliverable @deliverable end |
#deliverable_number ⇒ Object (readonly)
Returns the value of attribute deliverable_number.
62 63 64 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 62 def deliverable_number @deliverable_number end |
#deliverable_units ⇒ Object (readonly)
Returns the value of attribute deliverable_units.
62 63 64 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 62 def deliverable_units @deliverable_units end |
#root_symbol ⇒ Object (readonly)
Returns the value of attribute root_symbol.
62 63 64 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 62 def root_symbol @root_symbol end |
#strike_percent ⇒ Object (readonly)
Returns the value of attribute strike_percent.
62 63 64 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 62 def strike_percent @strike_percent end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
62 63 64 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 62 def symbol @symbol end |
Class Method Details
.build(data) ⇒ Object
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 64 def self.build(data) new( root_symbol: data.fetch(:rootSymbol, nil), symbol: data.fetch(:symbol, nil), strike_percent: data.fetch(:strikePercent, nil), deliverable_number: data.fetch(:deliverableNumber, nil), deliverable_units: data.fetch(:deliverableUnits), deliverable: data.fetch(:deliverable, nil).then { |d| d.nil? ? nil : Instrument.build(d) } ) end |
Instance Method Details
#to_h ⇒ Object
84 85 86 87 88 89 90 91 92 93 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 84 def to_h { rootSymbol: @root_symbol, symbol: @symbol, strikePercent: @strike_percent, deliverableNumber: @deliverable_number, deliverableUnits: @deliverable_units, deliverable: @deliverable&.to_h }.compact end |