Module: Vindi::Configuration

Included in:
Client
Defined in:
lib/vindi/configuration.rb

Overview

Configuration options for Client

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/vindi/configuration.rb', line 8

def api_endpoint
  @api_endpoint
end

#connection_optionsObject (readonly)

Returns the value of attribute connection_options.



7
8
9
# File 'lib/vindi/configuration.rb', line 7

def connection_options
  @connection_options
end

#default_media_typeObject

Returns the value of attribute default_media_type.



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

def default_media_type
  @default_media_type
end

#keyObject

Returns the value of attribute key.



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

def key
  @key
end

#middlewareObject (readonly)

Returns the value of attribute middleware.



7
8
9
# File 'lib/vindi/configuration.rb', line 7

def middleware
  @middleware
end

#user_agentObject (readonly)

Returns the value of attribute user_agent.



7
8
9
# File 'lib/vindi/configuration.rb', line 7

def user_agent
  @user_agent
end

Class Method Details

.keysObject



11
12
13
14
# File 'lib/vindi/configuration.rb', line 11

def keys
  @keys ||= [:key, :default_media_type, :api_endpoint, :user_agent,
             :middleware, :connection_options]
end

Instance Method Details

#configure(options = {}) {|_self| ... } ⇒ Vindi::Client

Initializes a new Client object

Parameters:

  • options (Hash) (defaults to: {})

Yields:

  • (_self)

Yield Parameters:

Returns:



21
22
23
24
25
26
27
# File 'lib/vindi/configuration.rb', line 21

def configure(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end

  yield(self) if block_given?
end

#reset!Object Also known as: setup



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

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