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'
DEFAULT_API_VERSION =
5

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_endpointObject



50
51
52
# File 'lib/pipl/configurable.rb', line 50

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

#api_keyObject

Returns the value of attribute api_key.



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

def api_key
  @api_key
end

#hide_sponsoredObject

Returns the value of attribute hide_sponsored.



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

def hide_sponsored
  @hide_sponsored
end

#infer_personsObject

Returns the value of attribute infer_persons.



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

def infer_persons
  @infer_persons
end

#live_feedsObject

Returns the value of attribute live_feeds.



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

def live_feeds
  @live_feeds
end

#match_requirementsObject

Returns the value of attribute match_requirements.



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

def match_requirements
  @match_requirements
end

#minimum_matchObject

Returns the value of attribute minimum_match.



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

def minimum_match
  @minimum_match
end

#minimum_probabilityObject

Returns the value of attribute minimum_probability.



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

def minimum_probability
  @minimum_probability
end

#show_sourcesObject

Returns the value of attribute show_sources.



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

def show_sources
  @show_sources
end

#source_category_requirementsObject

Returns the value of attribute source_category_requirements.



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

def source_category_requirements
  @source_category_requirements
end

#strict_validationObject

Returns the value of attribute strict_validation.



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

def strict_validation
  @strict_validation
end

#top_matchObject

Returns the value of attribute top_match.



12
13
14
# File 'lib/pipl/configurable.rb', line 12

def top_match
  @top_match
end

#user_agentObject

Returns the value of attribute user_agent.



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

def user_agent
  @user_agent
end

Class Method Details

.keysObject



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

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,
    :top_match
  ]
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



37
38
39
# File 'lib/pipl/configurable.rb', line 37

def configure
  yield self
end

#reset!Object Also known as: setup



41
42
43
44
45
46
# File 'lib/pipl/configurable.rb', line 41

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