Class: DhanHQ::Models::MultiOrder::Leg

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/DhanHQ/models/multi_order.rb

Overview

One leg's result within a DhanHQ::Models::MultiOrder response.

Constant Summary

Constants included from ResponseHelper

ResponseHelper::STATUS_ERROR_FALLBACK

Instance Attribute Summary

Attributes inherited from BaseModel

#attributes, #errors

Instance Method Summary collapse

Methods inherited from BaseModel

all, api, api_type, #assign_attributes, attributes, create, #delete, #destroy, find, #id, #initialize, #new_record?, #optionchain_api?, parse_collection_response, #persisted?, resource, resource_path, #save, #save!, #to_request_params, #update, #valid?, validate_attributes, validation_contract, #validation_contract, where

Methods included from APIHelper

#handle_response

Methods included from AttributeHelper

#camelize_keys, #deep_camelize_keys, #inspect, #normalize_keys, #snake_case, #titleize_keys

Methods included from ValidationHelper

#valid?, #validate!, #validate_params!

Methods included from RequestHelper

#build_from_response

Constructor Details

This class inherits a constructor from DhanHQ::BaseModel

Instance Method Details

#accepted?Boolean

Returns True when the exchange accepted this leg.

Returns:

  • (Boolean)

    True when the exchange accepted this leg.



46
47
48
# File 'lib/DhanHQ/models/multi_order.rb', line 46

def accepted?
  !order_id.nil? && !rejected?
end

#rejected?Boolean

Returns True when this leg was rejected.

Returns:

  • (Boolean)

    True when this leg was rejected.



51
52
53
# File 'lib/DhanHQ/models/multi_order.rb', line 51

def rejected?
  order_status.to_s == DhanHQ::Constants::OrderStatus::REJECTED
end

#to_promptObject

Returns a concise prompt-friendly summary of the leg.



56
57
58
# File 'lib/DhanHQ/models/multi_order.rb', line 56

def to_prompt
  "seq=#{sequence} order_id=#{order_id} status=#{order_status}"
end