Class: MoexIss::Market::Stocks

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/moex_iss/market/stocks.rb

Direct Known Subclasses

History::Stocks

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Stocks

Returns a new instance of Stocks.



10
11
12
13
14
15
# File 'lib/moex_iss/market/stocks.rb', line 10

def initialize(response)
  @response = response
  @stocks_map = {}

  create_instances_stock
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



8
9
10
# File 'lib/moex_iss/market/stocks.rb', line 8

def response
  @response
end

Instance Method Details

#create_instances_stockObject



17
18
19
20
21
22
23
# File 'lib/moex_iss/market/stocks.rb', line 17

def create_instances_stock
  @response.each do |data|
    method = data["securities"]["SECID"].downcase.to_sym

    setup_method(method, data)
  end
end

#eachObject



25
26
27
# File 'lib/moex_iss/market/stocks.rb', line 25

def each
  @stocks_map.values.each { |stock| yield stock }
end