Class: Pina::UploadedDocument
- Inherits:
-
Object
- Object
- Pina::UploadedDocument
- Defined in:
- lib/pina/uploaded_document.rb
Class Method Summary collapse
- .all(page = nil) ⇒ Object
- .create(uploaded_document) ⇒ Object
- .find(id) ⇒ Object
- .update(id, uploaded_document) ⇒ Object
- .where(hash, _page = nil) ⇒ Object
Class Method Details
.all(page = nil) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/pina/uploaded_document.rb', line 36 def all(page = nil) response = Pina::RestAdapter.get(:uploaded_documents, page) return Pina::Collections::UploadedDocument.new(attributes(response)) if response.ok? response end |
.create(uploaded_document) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/pina/uploaded_document.rb', line 7 def create(uploaded_document) response = Pina::RestAdapter.post(:uploaded_documents, uploaded_document, multipart: true) if response.ok? Pina::Models::UploadedDocument.new(attributes(response)) else Pina::Models::Error.new(attributes_for_error(response)) end end |
.find(id) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/pina/uploaded_document.rb', line 17 def find(id) response = Pina::RestAdapter.get(:uploaded_documents, id) if response.ok? Pina::Models::UploadedDocument.new(attributes(response)) else Pina::Models::Error.new(attributes_for_error(response)) end end |
.update(id, uploaded_document) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/pina/uploaded_document.rb', line 45 def update(id, uploaded_document) response = Pina::RestAdapter.patch(:uploaded_documents, id, uploaded_document) if response.ok? Pina::Models::UploadedDocument.new(attributes(response)) else Pina::Models::Error.new(attributes_for_error(response)) end end |
.where(hash, _page = nil) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/pina/uploaded_document.rb', line 27 def where(hash, _page = nil) response = Pina::RestAdapter.get(:uploaded_documents, hash) return Pina::Collections::UploadedDocument.new(attributes(response)) if response.ok? response end |