class IVLE::API

Attributes

api_key[RW]
password[RW]
username[RW]

Public Class Methods

new(*args) click to toggle source
# File lib/IVLE.rb, line 62
def initialize(*args)
  self.api_key  = args[0]

  if args.size == 2
    @access_token = args[1]
  elsif args.size == 3
    self.username = args[1]
    self.password = args[2]
  else
    raise ArgumentError "Expected 2 or 3 arguments, got #{args.size}"
  end
end

Public Instance Methods

api(method, params={}, verb=:get, add_auth=true) click to toggle source

I don't trust the API documentation so this is now public. Call this yourself if my implementation fails.

# File lib/IVLE.rb, line 77
def api(method, params={}, verb=:get, add_auth=true)
  params = add_auth(params) if add_auth
  resp = client.send(verb, "api/Lapi.svc/#{method}", params)
  format_response(resp.body)
end
api_post(method, params={}) click to toggle source
# File lib/IVLE.rb, line 83
def api_post(method, params={})
  api(method, params, :post)
end