Module: ClioClient::Api::Crudable
- Included in:
- Activity, CalendarEntry, ClientConnectPermission, Communication, Contact, Document, DocumentVersion, Group, Matter, Note, PracticeArea, Relationship, Task, TimelineEvent
- Defined in:
- lib/clio_client/api/crudable.rb
Instance Method Summary collapse
- #create(params = {}) ⇒ Object
- #destroy(id, params = {}) ⇒ Object
- #new(params = {}) ⇒ Object
- #update(id, params = {}) ⇒ Object
Instance Method Details
#create(params = {}) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/clio_client/api/crudable.rb', line 9 def create(params = {}) begin resource = params.is_a?(Array) ? create_plural(params) : create_singular(params) rescue ClioClient::UnknownResponse false end end |
#destroy(id, params = {}) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/clio_client/api/crudable.rb', line 26 def destroy(id, params = {}) begin session.delete("#{end_point_url}/#{id}", params, false) rescue ClioClient::UnknownResponse false end end |
#new(params = {}) ⇒ Object
5 6 7 |
# File 'lib/clio_client/api/crudable.rb', line 5 def new(params = {}) data_item(params) end |
#update(id, params = {}) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/clio_client/api/crudable.rb', line 17 def update(id, params = {}) begin response = session.put("#{end_point_url}/#{id}", {singular_resource => params}.to_json) data_item(response[singular_resource]) rescue ClioClient::UnknownResponse false end end |