Module: Pipl::Configurable

Included in:
Pipl, Client
Defined in:
lib/pipl/configurable.rb

Constant Summary collapse

SHOW_SOURCES_ALL =
'all'
SHOW_SOURCES_MATCHING =
'matching'
SHOW_SOURCES_NONE =
'false'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_endpointObject


47
48
49
# File 'lib/pipl/configurable.rb', line 47

def api_endpoint
  File.join(@api_endpoint, '')
end

#api_keyObject

Returns the value of attribute api_key.


9
10
11
# File 'lib/pipl/configurable.rb', line 9

def api_key
  @api_key
end

#hide_sponsoredObject

Returns the value of attribute hide_sponsored.


9
10
11
# File 'lib/pipl/configurable.rb', line 9

def hide_sponsored
  @hide_sponsored
end

#infer_personsObject

Returns the value of attribute infer_persons.


10
11
12
# File 'lib/pipl/configurable.rb', line 10

def infer_persons
  @infer_persons
end

#live_feedsObject

Returns the value of attribute live_feeds.


9
10
11
# File 'lib/pipl/configurable.rb', line 9

def live_feeds
  @live_feeds
end

#match_requirementsObject

Returns the value of attribute match_requirements.


10
11
12
# File 'lib/pipl/configurable.rb', line 10

def match_requirements
  @match_requirements
end

#minimum_matchObject

Returns the value of attribute minimum_match.


9
10
11
# File 'lib/pipl/configurable.rb', line 9

def minimum_match
  @minimum_match
end

#minimum_probabilityObject

Returns the value of attribute minimum_probability.


9
10
11
# File 'lib/pipl/configurable.rb', line 9

def minimum_probability
  @minimum_probability
end

#show_sourcesObject

Returns the value of attribute show_sources.


9
10
11
# File 'lib/pipl/configurable.rb', line 9

def show_sources
  @show_sources
end

#source_category_requirementsObject

Returns the value of attribute source_category_requirements.


10
11
12
# File 'lib/pipl/configurable.rb', line 10

def source_category_requirements
  @source_category_requirements
end

#strict_validationObject

Returns the value of attribute strict_validation.


10
11
12
# File 'lib/pipl/configurable.rb', line 10

def strict_validation
  @strict_validation
end

#user_agentObject

Returns the value of attribute user_agent.


10
11
12
# File 'lib/pipl/configurable.rb', line 10

def user_agent
  @user_agent
end

Class Method Details

.keysObject

[View source]

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/pipl/configurable.rb', line 15

def keys
  @keys ||= [
      :api_key,
      :minimum_probability,
      :minimum_match,
      :hide_sponsored,
      :live_feeds,
      :show_sources,
      :match_requirements,
      :source_category_requirements,
      :infer_persons,
      :strict_validation,
      :api_endpoint,
      :user_agent
  ]
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:

[View source]

34
35
36
# File 'lib/pipl/configurable.rb', line 34

def configure
  yield self
end

#reset!Object Also known as: setup

[View source]

38
39
40
41
42
43
# File 'lib/pipl/configurable.rb', line 38

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