Module: PagerDuty::Configurable

Included in:
PagerDuty, Client
Defined in:
lib/pager_duty/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_endpointObject

Returns the value of attribute api_endpoint.



3
4
5
# File 'lib/pager_duty/configurable.rb', line 3

def api_endpoint
  @api_endpoint
end

#api_tokenObject

Returns the value of attribute api_token.



3
4
5
# File 'lib/pager_duty/configurable.rb', line 3

def api_token
  @api_token
end

#connection_optionsObject

Returns the value of attribute connection_options.



3
4
5
# File 'lib/pager_duty/configurable.rb', line 3

def connection_options
  @connection_options
end

#default_media_typeObject

Returns the value of attribute default_media_type.



3
4
5
# File 'lib/pager_duty/configurable.rb', line 3

def default_media_type
  @default_media_type
end

#middlewareObject

Returns the value of attribute middleware.



3
4
5
# File 'lib/pager_duty/configurable.rb', line 3

def middleware
  @middleware
end

#user_agentObject

Returns the value of attribute user_agent.



3
4
5
# File 'lib/pager_duty/configurable.rb', line 3

def user_agent
  @user_agent
end

Class Method Details

.keysObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/pager_duty/configurable.rb', line 6

def keys
  @keys ||= [
    :api_token,
    :api_endpoint,
    :default_media_type,
    :user_agent,
    :middleware,
    :connection_options
  ]
end

Instance Method Details

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

Set configuration options using a block

Yields:

  • (_self)

Yield Parameters:



19
20
21
# File 'lib/pager_duty/configurable.rb', line 19

def configure
  yield self
end

#reset!Object Also known as: setup

Reset configuration options to default values



24
25
26
27
28
29
# File 'lib/pager_duty/configurable.rb', line 24

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