Module: HelpScoutDocs::Configurable
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_password ⇒ Object
Returns the value of attribute api_password.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#middleware ⇒ Object
Returns the value of attribute middleware.
Class Method Summary collapse
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block.
- #credentials? ⇒ Boolean
- #reset! ⇒ Object (also: #setup)
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/help_scout_docs/configurable.rb', line 7 def api_key @api_key end |
#api_password ⇒ Object
Returns the value of attribute api_password.
7 8 9 |
# File 'lib/help_scout_docs/configurable.rb', line 7 def api_password @api_password end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
7 8 9 |
# File 'lib/help_scout_docs/configurable.rb', line 7 def endpoint @endpoint end |
#middleware ⇒ Object
Returns the value of attribute middleware.
7 8 9 |
# File 'lib/help_scout_docs/configurable.rb', line 7 def middleware @middleware end |
Class Method Details
.keys ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/help_scout_docs/configurable.rb', line 12 def keys @keys ||= [ :api_key, :api_password, :endpoint, :middleware ] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block
25 26 27 28 29 |
# File 'lib/help_scout_docs/configurable.rb', line 25 def configure yield self validate_credential_type! self end |
#credentials? ⇒ Boolean
41 42 43 |
# File 'lib/help_scout_docs/configurable.rb', line 41 def credentials? credentials.values.all? end |
#reset! ⇒ Object Also known as: setup
31 32 33 34 35 36 |
# File 'lib/help_scout_docs/configurable.rb', line 31 def reset! HelpScoutDocs::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", HelpScoutDocs::Default.[key]) end self end |