class Clearbit::Prospector

Public Class Methods

[](values)
Alias for: find
find(values) click to toggle source
# 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
Also aliased as: []

Public Instance Methods

email() click to toggle source
# File lib/clearbit/prospector.rb, line 30
def email
  self[:email] || email_response.email
end
verified() click to toggle source
# File lib/clearbit/prospector.rb, line 34
def verified
  self[:verified] || email_response.verified
end
Also aliased as: verified?
verified?()
Alias for: verified

Protected Instance Methods

email_response() click to toggle source
# File lib/clearbit/prospector.rb, line 42
def email_response
  @email_response ||= begin
    response = self.class.get(uri(:email))
    Mash.new(response.decoded)
  end
end