Sha256: efa318e2a18619d965fa1c7eaf3e74c53bbcb5ad0ef6c832ae0b5ed40a30ff3b
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
require 'memoist' require 'active_support/time' module EveOnline module ESI class Base extend Memoist attr_reader :token, :parser def initialize(token = nil) @token = token @parser = JSON end def url raise NotImplementedError end def scope 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.authorization(:Bearer, token) if token 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 private def parse_datetime_with_timezone(value) ActiveSupport::TimeZone['UTC'].parse(value) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eve_online-0.12.0 | lib/eve_online/esi/base.rb |
eve_online-0.11.0 | lib/eve_online/esi/base.rb |