module GooglePlus::Config

Defines constants and methods related to configuration

Constants

DEFAULT_ADAPTER

The HTTP connection adapter that will be used to connect if none is set

DEFAULT_CONNECTION_OPTIONS

The Faraday connection options if none is set

DEFAULT_CONSUMER_KEY

The consumer key if none is set

DEFAULT_CONSUMER_SECRET

The consumer secret if none is set

DEFAULT_ENDPOINT

The endpoint that will be used to connect if none is set

@note This is configurable in case you want to use HTTP instead of HTTPS, specify a different API version, or use a GooglePlus-compatible endpoint.

DEFAULT_GATEWAY

The gateway server if none is set

DEFAULT_MEDIA_ENDPOINT

This endpoint will be used by default when updating statuses with media

DEFAULT_OAUTH_TOKEN

The oauth token if none is set

DEFAULT_OAUTH_TOKEN_SECRET

The oauth token secret if none is set

DEFAULT_PROXY

The proxy server if none is set

DEFAULT_SEARCH_ENDPOINT

The search endpoint that will be used to connect if none is set

@note This is configurable in case you want to use HTTP instead of HTTPS or use a GooglePlus-compatible endpoint. @see status.net/wiki/GooglePlus-compatible_API

DEFAULT_USER_AGENT

The value sent in the 'User-Agent' header if none is set

VALID_OPTIONS_KEYS

An array of valid keys in the options hash when configuring a {GooglePlus::API}

Public Class Methods

extended(base) click to toggle source

When this module is extended, set all configuration options to their default values

# File lib/google_plus/config.rb, line 67
def self.extended(base)
  base.reset
end

Public Instance Methods

configure() { |self| ... } click to toggle source

Convenience method to allow configuration options to be set in a block

# File lib/google_plus/config.rb, line 72
def configure
  yield self
  self
end
options() click to toggle source

Create a hash of options and their values

# File lib/google_plus/config.rb, line 78
def options
  options = {}
  VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}
  options
end
reset() click to toggle source

Reset all configuration options to defaults

# File lib/google_plus/config.rb, line 85
def reset
  self.adapter            = DEFAULT_ADAPTER
  self.connection_options = DEFAULT_CONNECTION_OPTIONS
  self.consumer_key       = DEFAULT_CONSUMER_KEY
  self.consumer_secret    = DEFAULT_CONSUMER_SECRET
  self.endpoint           = DEFAULT_ENDPOINT
  self.gateway            = DEFAULT_GATEWAY
  self.media_endpoint     = DEFAULT_MEDIA_ENDPOINT
  self.oauth_token        = DEFAULT_OAUTH_TOKEN
  self.oauth_token_secret = DEFAULT_OAUTH_TOKEN_SECRET
  self.proxy              = DEFAULT_PROXY
  self.search_endpoint    = DEFAULT_SEARCH_ENDPOINT
  self.user_agent         = DEFAULT_USER_AGENT
  self
end