Class: Contactually::Buckets

Inherits:
Object
  • Object
show all
Defined in:
lib/contactually/buckets.rb

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Buckets



3
4
5
# File 'lib/contactually/buckets.rb', line 3

def initialize(master)
  @master = master
end

Instance Method Details

#contacts(id, params = {}) ⇒ Object



35
36
37
38
# File 'lib/contactually/buckets.rb', line 35

def contacts(id, params = {})
  hash = @master.call("buckets/#{id}/contacts.json", :get, params)
  Contactually::Utils.contacts_hash_to_objects(hash)
end

#count(params = { limit: 1 }) ⇒ Object



45
46
47
# File 'lib/contactually/buckets.rb', line 45

def count(params = { limit: 1 })
  @master.call('buckets.json', :get, params)["meta"]["total"]
end

#create(params = {}) ⇒ Object



7
8
9
10
# File 'lib/contactually/buckets.rb', line 7

def create(params = {})
  hash = @master.call('buckets.json', :post, params)
  Contactually::Utils.build_bucket(hash)
end

#destroy(id, params = {}) ⇒ Object



12
13
14
# File 'lib/contactually/buckets.rb', line 12

def destroy(id, params = {})
  @master.call("buckets/#{id}.json", :delete, {})
end

#destroy_multiple(params = {}) ⇒ Object



16
17
18
# File 'lib/contactually/buckets.rb', line 16

def destroy_multiple(params = {})
  @master.call('buckets.json', :delete, params)
end

#index(params = {}) ⇒ Object



30
31
32
33
# File 'lib/contactually/buckets.rb', line 30

def index(params = {})
  hash = @master.call('buckets.json', :get, params)
  Contactually::Utils.buckets_hash_to_objects(hash)
end

#search(params = {}) ⇒ Object



40
41
42
43
# File 'lib/contactually/buckets.rb', line 40

def search(params = {})
  hash = @master.call('buckets/search.json', :get, params)
  Contactually::Utils.buckets_hash_to_objects(hash)
end

#show(id, params = {}) ⇒ Object



20
21
22
23
# File 'lib/contactually/buckets.rb', line 20

def show(id, params = {})
  hash = @master.call("buckets/#{id}.json", :get, params)
  Contactually::Utils.build_bucket(hash)
end

#update(id, params = {}) ⇒ Object



25
26
27
28
# File 'lib/contactually/buckets.rb', line 25

def update(id, params = {})
  hash = @master.call("buckets/#{id}.json", :put, params)
  Contactually::Utils.build_bucket(hash);
end