Sha256: 56644cb7f6a0dc01778afffd876171c7c1d4d0538a5315901dad0b9a41b41ce2

Contents?: true

Size: 641 Bytes

Versions: 5

Compression:

Stored size: 641 Bytes

Contents

require 'faraday'
require 'memoist'

module EveOnline
  class Base
    extend Memoist

    def url
      raise NotImplementedError
    end

    def user_agent
      "EveOnline API (https://github.com/biow0lf/eve_online) v#{ VERSION }"
    end

    def content
      faraday = Faraday.new

      faraday.headers[:user_agent] = user_agent
      faraday.options.timeout = 60
      faraday.options.open_timeout = 60

      faraday.get(url).body
    rescue Faraday::TimeoutError
      raise EveOnline::Exceptions::TimeoutException
    end
    memoize :content

    def response
      parser.parse(content)
    end
    memoize :response
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
eve_online-0.14.0 lib/eve_online/base.rb
eve_online-0.13.0 lib/eve_online/base.rb
eve_online-0.12.0 lib/eve_online/base.rb
eve_online-0.11.0 lib/eve_online/base.rb
eve_online-0.10.0 lib/eve_online/base.rb