Sha256: d040ba7e4a88dd1bf60497b88a30c55d689d80ae1962b3bfc78e55159b61777d

Contents?: true

Size: 555 Bytes

Versions: 5

Compression:

Stored size: 555 Bytes

Contents

require_relative 'base'

module IEX
  module Resources
    class News < Resource
      property 'datetime', transform_with: ->(v) { DateTime.parse(v) }
      property 'headline'
      property 'source'
      property 'url'
      property 'summary'
      property 'related', transform_with: ->(v) { v.split(',') if v.is_a?(String) }

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
iex-ruby-client-0.4.4 lib/iex/resources/news.rb
iex-ruby-client-0.4.3 lib/iex/resources/news.rb
iex-ruby-client-0.4.2 lib/iex/resources/news.rb
iex-ruby-client-0.4.1 lib/iex/resources/news.rb
iex-ruby-client-0.4.0 lib/iex/resources/news.rb