Module: GaExampleGem::Configuration

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

Overview

This is the configuration module that allows us to setup an api_key using a pattern close to the Twitter or MtGox gem

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_keyObject

This is our API key. We aren’t really using it anywhere, but you could imagine using it with HTTP requests



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

def api_key
  @api_key
end

Instance Method Details

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

This yields a block that can be iterated on Its useful for being able to set values to the attr_accessor

Yields:

  • (_self)

Yield Parameters:



16
17
18
# File 'lib/ga_example_gem/configuration.rb', line 16

def configure
  yield self
end

#resetObject

This reset our API key and is called when the client is initialized



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

def reset
  self.api_key = nil
  self
end