Class: Clearbit::Prospector

Inherits:
Base show all
Defined in:
lib/clearbit/prospector.rb

Constant Summary

Constants inherited from Resource

Resource::OPTION_KEYS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

key, key=, #pending?, version=

Methods inherited from Resource

delete, endpoint, get, options, parse_values, path, post, put, request, uri, #uri, url

Methods inherited from Mash

#custom_reader, #custom_writer, #deep_merge, #deep_update, #delete, #dup, #fetch, #id, #initialize, #initializing_reader, #key?, #method_missing, new, #regular_dup, #replace, #respond_to?, #shallow_merge, #shallow_update, #type, #underbang_reader

Constructor Details

This class inherits a constructor from Clearbit::Mash

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Clearbit::Mash

Class Method Details

.find(values) ⇒ Object Also known as: []



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/clearbit/prospector.rb', line 10

def self.find(values)
  unless values.is_a?(Hash)
    values = {:id => values}
  end

  if id = values.delete(:id)
    response = get(id, values)

  else
    raise ArgumentError, 'Invalid values'
  end

  self.new(response)
rescue Nestful::ResourceNotFound
end

.search(values = {}) ⇒ Object



6
7
8
# File 'lib/clearbit/prospector.rb', line 6

def self.search(values = {})
  self.new get('search', values)
end

Instance Method Details

#emailObject



30
31
32
# File 'lib/clearbit/prospector.rb', line 30

def email
  self[:email] || email_response.email
end

#verifiedObject Also known as: verified?



34
35
36
# File 'lib/clearbit/prospector.rb', line 34

def verified
  self[:verified] || email_response.verified
end