Module: Surveygizmo::Configurable

Included in:
Surveygizmo, API
Defined in:
lib/surveygizmo/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connection_optionsObject

Returns the value of attribute connection_options


6
7
8
# File 'lib/surveygizmo/configurable.rb', line 6

def connection_options
  @connection_options
end

#endpointObject

Returns the value of attribute endpoint


6
7
8
# File 'lib/surveygizmo/configurable.rb', line 6

def endpoint
  @endpoint
end

#middlewareObject

Returns the value of attribute middleware


6
7
8
# File 'lib/surveygizmo/configurable.rb', line 6

def middleware
  @middleware
end

#password=(value) ⇒ Object (writeonly)

Sets the attribute password

Parameters:

  • value

    the value to set the attribute password to.


5
6
7
# File 'lib/surveygizmo/configurable.rb', line 5

def password=(value)
  @password = value
end

#user_agentObject

Returns the value of attribute user_agent


6
7
8
# File 'lib/surveygizmo/configurable.rb', line 6

def user_agent
  @user_agent
end

#username=(value) ⇒ Object (writeonly)

Sets the attribute username

Parameters:

  • value

    the value to set the attribute username to.


5
6
7
# File 'lib/surveygizmo/configurable.rb', line 5

def username=(value)
  @username = value
end

Class Method Details

.keysObject


9
10
11
12
13
14
15
16
17
18
# File 'lib/surveygizmo/configurable.rb', line 9

def keys
  @keys ||= [
    :username,
    :password,
    :endpoint,
    :user_agent,
    :connection_options,
    :middleware
  ]
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:


21
22
23
# File 'lib/surveygizmo/configurable.rb', line 21

def configure
  yield self
end

#credentials?Boolean

Returns:

  • (Boolean)

26
27
28
# File 'lib/surveygizmo/configurable.rb', line 26

def credentials?
  credentials.values.all?
end

#reset!Object Also known as: setup


30
31
32
33
34
35
# File 'lib/surveygizmo/configurable.rb', line 30

def reset!
  Surveygizmo::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", Surveygizmo::Default.options[key])
  end
  self
end