Sha256: 0d65209026d89cc4e4bbb33d7b2e6646dae22cf9f13e0e4579e304a271de4be2

Contents?: true

Size: 827 Bytes

Versions: 4

Compression:

Stored size: 827 Bytes

Contents

# encoding: utf-8
module ContactData
  class Contact
    BASE = :contacts

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

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

      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
contact-data-0.4.9 lib/contact-data/contact.rb
contact-data-0.4.8 lib/contact-data/contact.rb
contact-data-0.4.6 lib/contact-data/contact.rb
contact-data-0.4.5 lib/contact-data/contact.rb