Module: AngellistApi::Configuration
- Included in:
- AngellistApi
- Defined in:
- lib/angellist_api/configuration.rb
Overview
Defines constants and methods related to configuration
Constant Summary collapse
- DEFAULT_ACCESS_TOKEN =
The access token if none is set
nil
- DEFAULT_ADAPTER =
The HTTP connection adapter that will be used to connect if none is set
:net_http
- DEFAULT_CONNECTION_OPTIONS =
The Faraday connection options if none are set
{}
- DEFAULT_ENDPOINT =
The endpoint that will be used to connect if none is set
"https://api.angel.co/"
- DEFAULT_GATEWAY =
The gateway server if none is set
nil
- DEFAULT_PROXY =
The proxy server if none is set
nil
- DEFAULT_USER_AGENT =
The value sent in the ‘User-Agent’ header if none is set
"AngellistApi Ruby Gem #{AngellistApi::VERSION}"
- VALID_OPTIONS_KEYS =
An array of valid keys in the options hash when configuring a API
[ :adapter, :connection_options, :endpoint, :gateway, :access_token, :proxy, :user_agent ]
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
41 42 43 |
# File 'lib/angellist_api/configuration.rb', line 41 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
46 47 48 |
# File 'lib/angellist_api/configuration.rb', line 46 def configure yield self end |
#options ⇒ Object
Create a hash of options and their values
51 52 53 54 55 |
# File 'lib/angellist_api/configuration.rb', line 51 def = {} VALID_OPTIONS_KEYS.each{|k| [k] = send(k)} end |
#reset ⇒ Object
Reset all configuration options to defaults
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/angellist_api/configuration.rb', line 58 def reset self.access_token = DEFAULT_ACCESS_TOKEN self.adapter = DEFAULT_ADAPTER self. = DEFAULT_CONNECTION_OPTIONS self.endpoint = DEFAULT_ENDPOINT self.gateway = DEFAULT_GATEWAY self.proxy = DEFAULT_PROXY self.user_agent = DEFAULT_USER_AGENT self end |