Module: Ivapi::Configuration

Included in:
Ivapi, Client
Defined in:
lib/ivapi/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_endpointObject

Returns the value of attribute api_endpoint.



8
9
10
# File 'lib/ivapi/configuration.rb', line 8

def api_endpoint
  @api_endpoint
end

#connection_optionsObject

Returns the value of attribute connection_options.



8
9
10
# File 'lib/ivapi/configuration.rb', line 8

def connection_options
  @connection_options
end

#hosting_idObject

Returns the value of attribute hosting_id.



8
9
10
# File 'lib/ivapi/configuration.rb', line 8

def hosting_id
  @hosting_id
end

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/ivapi/configuration.rb', line 8

def password
  @password
end

#server_idObject

Returns the value of attribute server_id.



8
9
10
# File 'lib/ivapi/configuration.rb', line 8

def server_id
  @server_id
end

#user_agentObject

Returns the value of attribute user_agent.



8
9
10
# File 'lib/ivapi/configuration.rb', line 8

def user_agent
  @user_agent
end

#usernameObject

Returns the value of attribute username.



8
9
10
# File 'lib/ivapi/configuration.rb', line 8

def username
  @username
end

#web_endpointObject

Returns the value of attribute web_endpoint.



8
9
10
# File 'lib/ivapi/configuration.rb', line 8

def web_endpoint
  @web_endpoint
end

Class Method Details

.each_key(&block) ⇒ Object



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

def self.each_key(&block)
  keys.each(&block)
end

.keysObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ivapi/configuration.rb', line 11

def self.keys
  @keys ||= %i[
    api_endpoint
    username
    middleware
    password
    user_agent
    connection_options
    server_id
    hosting_id
  ]
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



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

def configure
  yield self
  true
end

#reset!Object Also known as: setup

Reset configuration options to default values



34
35
36
37
38
39
# File 'lib/ivapi/configuration.rb', line 34

def reset!
  Ivapi::Configuration.each_key do |key|
    instance_variable_set(:"@#{key}", Ivapi::Default.options[key])
  end
  self
end