Method: Reve::API#initialize

Defined in:
lib/reve.rb

#initialize(keyid = "", key = "", charid = "") ⇒ API

Create a new API instance. current_time and cached_until are meaningful only for the LAST call made. Expects:

  • keyid ( Integer | String ) - Your Key ID (or legacy key UserID)

  • key ( String ) - Your API key verification code (or legacy API Key)

  • charid ( Integer | String ) - Default characterID for calls requiring it.

If you are using legacy key ids, you must explicitly set the cak attribute on the returned API instance to false.

NOTE: All values passed to the constructor are typecasted to a String for safety.



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/reve.rb', line 144

def initialize(keyid = "", key = "", charid = "")
  @keyid  = (keyid || "").to_s
  @key    = (key    || "").to_s
  @charid = (charid || "").to_s
  @cak    = true
  @save_path = nil
  
  @max_tries = 3
  @timeout = 20

  @current_time = nil
  @cached_until = nil
  @last_hash = nil
  @last_xml  = nil
  @reve_version = File.read(File.join(File.dirname(__FILE__),'../','VERSION')).chomp
  @http_user_agent = "Reve v#{@reve_version}; http://github.com/lisa/reve"
end