Module: Picasa::Config
- Included in:
- Picasa
- Defined in:
- lib/picasa/config.rb
Overview
Defines constants and methods related to configuration
Constant Summary collapse
- VALID_OPTIONS_KEYS =
An array of valid keys in the options hash when configuring a API
[ :base_uri, :authorization_uri, :token_credential_uri, :client_id, :client_secret, :scope, :redirect_uri, :refresh_token, :access_token, :expires_in, :issued_at, :user_agent, :refreshed ].freeze
- DEFAULT_BASE_URI =
'https://picasaweb.google.com/data/'.freeze
- DEFAULT_AUTHORIZATION_URI =
'https://accounts.google.com/o/oauth2/auth'.freeze
- DEFAULT_TOKEN_CREDENTIAL_URI =
'https://accounts.google.com/o/oauth2/token'.freeze
- DEFAULT_CLIENT_ID =
nil
- DEFAULT_CLIENT_SECRET =
nil
- DEFAULT_SCOPE =
'https://picasaweb.google.com/data/'.freeze
- DEFAULT_REDIRECT_URI =
''
- DEFAULT_REFRESH_TOKEN =
nil
- DEFAULT_ACCESS_TOKEN =
nil
- DEFAULT_EXPIRES_IN =
nil
- DEFAULT_ISSUED_AT =
nil
- DEFAULT_USER_AGENT =
The value sent in the ‘User-Agent’ header if none is set
"Picasa Ruby Gem #{Picasa::Version}".freeze
- DEFAULT_REFRESHED =
false
Class Method Summary collapse
-
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default values.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block.
-
#options ⇒ Object
Create a hash of options and their values.
-
#reset ⇒ Object
Reset all configuration options to defaults.
Class Method Details
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default values
54 55 56 |
# File 'lib/picasa/config.rb', line 54 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block
59 60 61 62 |
# File 'lib/picasa/config.rb', line 59 def configure yield self self end |
#options ⇒ Object
Create a hash of options and their values
65 66 67 68 69 |
# File 'lib/picasa/config.rb', line 65 def = {} VALID_OPTIONS_KEYS.each{|k| [k] = send(k)} end |
#reset ⇒ Object
Reset all configuration options to defaults
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/picasa/config.rb', line 72 def reset self.base_uri = DEFAULT_BASE_URI self. = DEFAULT_AUTHORIZATION_URI self.token_credential_uri = DEFAULT_TOKEN_CREDENTIAL_URI self.client_id = DEFAULT_CLIENT_ID self.client_secret = DEFAULT_CLIENT_SECRET self.scope = DEFAULT_SCOPE self.redirect_uri = DEFAULT_REDIRECT_URI self.refresh_token = DEFAULT_REFRESH_TOKEN self.access_token = DEFAULT_ACCESS_TOKEN self.expires_in = DEFAULT_EXPIRES_IN self.issued_at = DEFAULT_ISSUED_AT self.user_agent = DEFAULT_USER_AGENT self.refreshed = DEFAULT_REFRESHED self end |