Class: SchwabRb::DataObjects::OrderPreview::OrderValidationResult
- Inherits:
-
Object
- Object
- SchwabRb::DataObjects::OrderPreview::OrderValidationResult
- Defined in:
- lib/schwab_rb/data_objects/order_preview.rb
Defined Under Namespace
Classes: Reject
Instance Attribute Summary collapse
-
#is_valid ⇒ Object
readonly
Returns the value of attribute is_valid.
-
#rejects ⇒ Object
readonly
Returns the value of attribute rejects.
-
#warning_message ⇒ Object
readonly
Returns the value of attribute warning_message.
Instance Method Summary collapse
-
#initialize(attrs) ⇒ OrderValidationResult
constructor
A new instance of OrderValidationResult.
- #to_h ⇒ Object
Constructor Details
#initialize(attrs) ⇒ OrderValidationResult
Returns a new instance of OrderValidationResult.
114 115 116 117 118 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 114 def initialize(attrs) @is_valid = attrs[:isValid] = attrs[:warningMessage] @rejects = attrs[:rejects]&.map { |reject| Reject.new(reject) } || [] end |
Instance Attribute Details
#is_valid ⇒ Object (readonly)
Returns the value of attribute is_valid.
112 113 114 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 112 def is_valid @is_valid end |
#rejects ⇒ Object (readonly)
Returns the value of attribute rejects.
112 113 114 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 112 def rejects @rejects end |
#warning_message ⇒ Object (readonly)
Returns the value of attribute warning_message.
112 113 114 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 112 def end |
Instance Method Details
#to_h ⇒ Object
120 121 122 123 124 125 126 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 120 def to_h { isValid: @is_valid, warningMessage: , rejects: @rejects.map(&:to_h) } end |