Class: Ivapi::Client

Inherits:
Object
  • Object
show all
Includes:
Authentication, Configuration
Defined in:
lib/ivapi/client.rb,
lib/ivapi/client/base.rb,
lib/ivapi/client/server.rb,
lib/ivapi/client/account.rb

Defined Under Namespace

Classes: Account, Base, Server

Instance Attribute Summary

Attributes included from Configuration

#api_endpoint, #connection_options, #password, #server_id, #user_agent, #username, #web_endpoint

Instance Method Summary collapse

Methods included from Configuration

#configure, keys, #reset!

Methods included from Authentication

#authenticated?, #authentication

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



15
16
17
18
19
20
21
22
# File 'lib/ivapi/client.rb', line 15

def initialize(options = {})
  # Use options passed in, but fall back to module defaults
  Ivapi::Configuration.keys.each do |key|
    instance_variable_set(
      :"@#{key}", options[key] || Ivapi.instance_variable_get(:"@#{key}")
    )
  end
end

Instance Method Details

#accountObject



24
25
26
# File 'lib/ivapi/client.rb', line 24

def 
  Ivapi::Client::Account.new(self)
end

#same_options?(opts) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/ivapi/client.rb', line 32

def same_options?(opts)
  opts.hash == options.hash
end

#server(server_id = @server_id) ⇒ Object



28
29
30
# File 'lib/ivapi/client.rb', line 28

def server(server_id = @server_id)
  Ivapi::Client::Server.new(self, server_id)
end