class Contactually::Contacts

Public Class Methods

new(master) click to toggle source
# File lib/contactually/contacts.rb, line 3
def initialize(master)
  @master = master
end

Public Instance Methods

count(params = { limit: 1 }) click to toggle source
# File lib/contactually/contacts.rb, line 50
def count(params = { limit: 1 })
  @master.call('contacts.json', :get, params)["total_count"]
end
create(params = {}) click to toggle source
# File lib/contactually/contacts.rb, line 7
def create(params = {})
  hash = @master.call('contacts.json', :post, params)
  Contactually::Utils.build_contact(hash)
end
destroy(id, params = {}) click to toggle source
# File lib/contactually/contacts.rb, line 12
def destroy(id, params = {})
  @master.call("contacts/#{id}.json", :delete, {})
end
destroy_multiple(params = {}) click to toggle source
# File lib/contactually/contacts.rb, line 16
def destroy_multiple(params = {})
  @master.call('contacts.json', :delete, params)
end
index(params = {}) click to toggle source
# File lib/contactually/contacts.rb, line 40
def index(params = {})
  hash = @master.call('contacts.json', :get, params)
  Contactually::Utils.contacts_hash_to_objects(hash)
end
merge(params = {}) click to toggle source
# File lib/contactually/contacts.rb, line 25
def merge(params = {})
  hash = @master.call('contacts/merge.json', :post, params)
  Contactually::Utils.build_contact(hash)
end
show(id, params = {}) click to toggle source
# File lib/contactually/contacts.rb, line 20
def show(id, params = {})
  hash = @master.call("contacts/#{id}.json", :get, params)
  Contactually::Utils.build_contact(hash)
end
tags(id, params = {}) click to toggle source
# File lib/contactually/contacts.rb, line 30
def tags(id, params = {})
  params[:tags] = params[:tags].join(', ') if params[:tags].class == Array
  @master.call("contacts/#{id}/tags.json", :post, params)
end
update(id, params = {}) click to toggle source
# File lib/contactually/contacts.rb, line 35
def update(id, params = {})
  hash = @master.call("contacts/#{id}.json", :put, params)
  Contactually::Utils.build_contact(hash);
end