Class: IEX::Resources::Dividends

Inherits:
IEX::Resource show all
Defined in:
lib/iex/resources/dividends.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Dividends

Returns a new instance of Dividends


16
17
18
19
20
# File 'lib/iex/resources/dividends.rb', line 16

def initialize(data)
  super
  # TODO: require Hashie >= 2.5.8, see https://github.com/intridea/hashie/pull/457
  self['amount_dollar'] = Base.to_dollar(amount: amount, ignore_cents: false)
end

Class Method Details

.get(stock_symbol, range = nil) ⇒ Object


22
23
24
25
26
27
28
# File 'lib/iex/resources/dividends.rb', line 22

def self.get(stock_symbol, range = nil)
  Base.symbol(stock_symbol) do
    IEX::Api::Dividends.get(stock_symbol, range).map do |data|
      new data
    end
  end
end