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_endpoint ⇒ Object

Returns the value of attribute api_endpoint.



6
7
8
# File 'lib/ivapi/configuration.rb', line 6

def api_endpoint
  @api_endpoint
end

#connection_options ⇒ Object

Returns the value of attribute connection_options.



6
7
8
# File 'lib/ivapi/configuration.rb', line 6

def connection_options
  @connection_options
end

#hosting_id ⇒ Object

Returns the value of attribute hosting_id.



6
7
8
# File 'lib/ivapi/configuration.rb', line 6

def hosting_id
  @hosting_id
end

#password ⇒ Object

Returns the value of attribute password.



6
7
8
# File 'lib/ivapi/configuration.rb', line 6

def password
  @password
end

#server_id ⇒ Object

Returns the value of attribute server_id.



6
7
8
# File 'lib/ivapi/configuration.rb', line 6

def server_id
  @server_id
end

#user_agent ⇒ Object

Returns the value of attribute user_agent.



6
7
8
# File 'lib/ivapi/configuration.rb', line 6

def user_agent
  @user_agent
end

#username ⇒ Object

Returns the value of attribute username.



6
7
8
# File 'lib/ivapi/configuration.rb', line 6

def username
  @username
end

#web_endpoint ⇒ Object

Returns the value of attribute web_endpoint.



6
7
8
# File 'lib/ivapi/configuration.rb', line 6

def web_endpoint
  @web_endpoint
end

Class Method Details

.keys ⇒ Object



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

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:



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

def configure
  yield self
  true
end

#reset! ⇒ Object Also known as: setup

Reset configuration options to default values



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

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