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,
lib/ivapi/client/hosting.rb

Defined Under Namespace

Classes: Account, Base, Hosting, Server

Instance Attribute Summary

Attributes included from Configuration

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

Instance Method Summary collapse

Methods included from Configuration

#configure, each_key, keys, #reset!

Methods included from Authentication

#authenticated?, #authentication

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



18
19
20
21
22
23
24
25
# File 'lib/ivapi/client.rb', line 18

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

Instance Method Details

#accountObject



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

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

#hosting(hosting_id = @hosting_id) ⇒ Object



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

def hosting(hosting_id = @hosting_id)
  Ivapi::Client::Hosting.new(self, hosting_id)
end

#same_options?(opts) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/ivapi/client.rb', line 39

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

#server(server_id = @server_id) ⇒ Object



35
36
37
# File 'lib/ivapi/client.rb', line 35

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