Sha256: d2142f79d3ff60035a19726d55255b2379c52bf5ac9da77d239c7b97bc825ace

Contents?: true

Size: 585 Bytes

Versions: 4

Compression:

Stored size: 585 Bytes

Contents

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(symbol, range = nil)
        IEX::Api::News.get(symbol, range).map do |data|
          new data
        end
      rescue Faraday::ResourceNotFound => e
        raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iex-ruby-client-0.3.3 lib/iex/resources/news.rb
iex-ruby-client-0.3.2 lib/iex/resources/news.rb
iex-ruby-client-0.3.1 lib/iex/resources/news.rb
iex-ruby-client-0.3.0 lib/iex/resources/news.rb