Class: ContactData::Contact

Inherits:
Object
  • Object
show all
Defined in:
lib/contact-data/contact.rb

Constant Summary collapse

BASE =
:contacts

Class Method Summary collapse

Class Method Details

.from(source, slug, options = {}) ⇒ Object



14
15
16
17
18
# File 'lib/contact-data/contact.rb', line 14

def from(source, slug, options = {})
  options[:base] ||= BASE
  options[:params] ||= { source: source, slug: slug }
  Fetcher.get(:from, options)
end

.from_domain(domain, options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/contact-data/contact.rb', line 20

def from_domain(domain, options = {})
  explicit_contact_type = options.delete(:contact_type)

  options[:base] ||= BASE
  options[:api_base] ||= 'api/v3'
  options[:params] ||= { domain: domain }
  options[:params][:contact_type] ||= explicit_contact_type if explicit_contact_type

  Fetcher.get(:from_domain, options)
end

.search(name, options = {}) ⇒ Object



8
9
10
11
12
# File 'lib/contact-data/contact.rb', line 8

def search(name, options = {})
  options[:base] ||= BASE
  options[:params] ||= { name: name }
  Fetcher.get(:search, options)
end