Module: Speechmatics::Configuration
- Included in:
- Speechmatics, User, User::Jobs
- Defined in:
- lib/speechmatics/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :user_id, :auth_token, :adapter, :endpoint, :user_agent ].freeze
- DEFAULT_ADAPTER =
Adapters are whatever Faraday supports - I like excon alot, so I’m defaulting it
:excon
- DEFAULT_ENDPOINT =
The api endpoint to get REST
'https://api.speechmatics.com/v1.0/'.freeze
- DEFAULT_USER_AGENT =
The value sent in the http header for ‘User-Agent’ if none is set
"Speechmatics Ruby Gem #{Speechmatics::VERSION}".freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow for global setting of configuration options.
- #options ⇒ Object
-
#reset! ⇒ Object
Reset configuration options to their defaults.
Class Method Details
.extended(base) ⇒ Object
30 31 32 |
# File 'lib/speechmatics/configuration.rb', line 30 def self.extended(base) base.reset! end |
.keys ⇒ Object
35 36 37 |
# File 'lib/speechmatics/configuration.rb', line 35 def keys VALID_OPTIONS_KEYS end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow for global setting of configuration options
26 27 28 |
# File 'lib/speechmatics/configuration.rb', line 26 def configure yield self end |
#options ⇒ Object
40 41 42 43 44 |
# File 'lib/speechmatics/configuration.rb', line 40 def = {} VALID_OPTIONS_KEYS.each { |k| [k] = send(k) } end |
#reset! ⇒ Object
Reset configuration options to their defaults
47 48 49 50 51 52 53 54 |
# File 'lib/speechmatics/configuration.rb', line 47 def reset! self.user_id = nil self.auth_token = nil self.adapter = DEFAULT_ADAPTER self.endpoint = DEFAULT_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self end |