Class: Contactually::Contents

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

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Contents

Returns a new instance of Contents.



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

def initialize(master)
  @master = master
end

Instance Method Details

#create(params = {}) ⇒ Object



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

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

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



17
18
19
# File 'lib/contactually/contents.rb', line 17

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

#index(params = {}) ⇒ Object



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

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

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



21
22
23
24
# File 'lib/contactually/contents.rb', line 21

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

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



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

def update(id, params = {})
  @master.call("contents/#{id}.json", :put, params)
end