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 This is tricky, this adds these attr_accessors to the CLASS



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

def api_key
  @api_key
end

#oauth_keyObject

This is our API key. We aren’t really using it anywhere, but you could imagine using it with HTTP requests This is tricky, this adds these attr_accessors to the CLASS



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

def oauth_key
  @oauth_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:



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

def configure
  yield self
end

#resetObject

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



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

def reset
  self.api_key = nil
  self
end