Class: Contactually::Contents
- Inherits:
-
Object
- Object
- Contactually::Contents
- Defined in:
- lib/contactually/contents.rb
Instance Method Summary collapse
- #create(params = {}) ⇒ Object
- #destroy(id, params = {}) ⇒ Object
- #index(params = {}) ⇒ Object
-
#initialize(master) ⇒ Contents
constructor
A new instance of Contents.
- #show(id, params = {}) ⇒ Object
- #update(id, params = {}) ⇒ Object
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 |