Class: Radar::API::SecurityId

Inherits:
Thrift::Union
  • Object
show all
Includes:
Thrift::Struct_Union
Defined in:
lib/radar/api/radar_types.rb

Constant Summary collapse

STOCK =
1
FUND =
2
INDEX_LINKED_BOND =
3
FIELDS =
{
  STOCK => {:type => ::Thrift::Types::STRUCT, :name => 'stock', :class => ::Radar::API::StockId},
  FUND => {:type => ::Thrift::Types::STRUCT, :name => 'fund', :class => ::Radar::API::FundId},
  INDEX_LINKED_BOND => {:type => ::Thrift::Types::STRUCT, :name => 'index_linked_bond', :class => ::Radar::API::IndexLinkedBondId}
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.fund(val) ⇒ Object



122
123
124
# File 'lib/radar/api/radar_types.rb', line 122

def fund(val)
  SecurityId.new(:fund, val)
end

.index_linked_bond(val) ⇒ Object



126
127
128
# File 'lib/radar/api/radar_types.rb', line 126

def index_linked_bond(val)
  SecurityId.new(:index_linked_bond, val)
end

.stock(val) ⇒ Object



118
119
120
# File 'lib/radar/api/radar_types.rb', line 118

def stock(val)
  SecurityId.new(:stock, val)
end

Instance Method Details

#struct_fieldsObject



141
# File 'lib/radar/api/radar_types.rb', line 141

def struct_fields; FIELDS; end

#validateObject

Raises:

  • (StandardError)


143
144
145
# File 'lib/radar/api/radar_types.rb', line 143

def validate
  raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
end