Module: Chute::Configuration
- Included in:
- Chute
- Defined in:
- lib/chute/configuration.rb
Constant Summary collapse
- VALID_CONNECTION_KEYS =
[:api_endpoint, :auth_endpoint, :upload_endpoint].freeze
- VALID_OPTIONS_KEYS =
[:app_id, :app_secret, :access_token].freeze
- VALID_CONFIG_KEYS =
VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS
- DEFAULT_API_ENDPOINT =
'https://api.getchute.com'
- DEFAULT_AUTH_ENDPOINT =
'https://getchute.com/auth'
- DEFAULT_UPLOAD_ENDPOINT =
'http://upload.getchute.com'
- DEFAULT_APP_ID =
'app_id'
- DEFAULT_APP_SECRET =
'app_secret'
- DEFAULT_ACCESS_TOKEN =
'access_token'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
27 28 29 |
# File 'lib/chute/configuration.rb', line 27 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
23 24 25 |
# File 'lib/chute/configuration.rb', line 23 def configure yield(self) end |
#options ⇒ Object
19 20 21 |
# File 'lib/chute/configuration.rb', line 19 def Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ] end |
#reset ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/chute/configuration.rb', line 31 def reset self.api_endpoint = DEFAULT_API_ENDPOINT self.auth_endpoint = DEFAULT_AUTH_ENDPOINT self.upload_endpoint = DEFAULT_UPLOAD_ENDPOINT self.app_id = DEFAULT_APP_ID self.app_secret = DEFAULT_APP_SECRET self.access_token = DEFAULT_ACCESS_TOKEN end |