Class: SchwabRb::DataObjects::OrderPreview::OrderValidationResult

Inherits:
Object
  • Object
show all
Defined in:
lib/schwab_rb/data_objects/order_preview.rb

Defined Under Namespace

Classes: Reject

Instance Attribute Summary collapse

Instance Method Summary collapse

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]
  @warning_message = attrs[:warningMessage]
  @rejects = attrs[:rejects]&.map { |reject| Reject.new(reject) } || []
end

Instance Attribute Details

#is_validObject (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

#rejectsObject (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_messageObject (readonly)

Returns the value of attribute warning_message.



112
113
114
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 112

def warning_message
  @warning_message
end

Instance Method Details

#to_hObject



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: @warning_message,
    rejects: @rejects.map(&:to_h)
  }
end