Module: HelpScoutDocs::Configurable

Extended by:
Forwardable
Included in:
HelpScoutDocs
Defined in:
lib/help_scout_docs/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_keyObject

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_passwordObject

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

#endpointObject

Returns the value of attribute endpoint.



7
8
9
# File 'lib/help_scout_docs/configurable.rb', line 7

def endpoint
  @endpoint
end

#middlewareObject

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

.keysObject



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

Yields:

  • (_self)

Yield Parameters:



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

Returns:

  • (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.options[key])
  end
  self
end