Sha256: 8d0b786e1f7e88b33b4d848ce613c5b6ac1ec0da3d3201c50c22f7140486bbf6
Contents?: true
Size: 1.23 KB
Versions: 3
Compression:
Stored size: 1.23 KB
Contents
require 'pina/models/processed_document' require 'pina/collections/processed_document' module Pina class ProcessedDocument class << self def new(params = nil) Pina::Models::ProcessedDocument.new(params) end def find(id) response = Pina::RestAdapter.get(:processed_documents, id) return Pina::Models::ProcessedDocument.new(attributes(response)) if response.ok? response end def where(hash, _page = nil) response = Pina::RestAdapter.get(:processed_documents, hash) return Pina::Collections::ProcessedDocument.new(attributes(response)) if response.ok? response end def all(page = nil) response = Pina::RestAdapter.get(:processed_documents, page) return Pina::Collections::ProcessedDocument.new(attributes(response)) if response.ok? response end def delete(id) response = Pina::RestAdapter.delete(:processed_documents, id) return Pina::Models::ProcessedDocument.new(attributes(response)) if response.ok? response end private def attributes(response) response.to_hash.merge(response: response) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pina-0.14.4 | lib/pina/processed_document.rb |
pina-0.14.3 | lib/pina/processed_document.rb |
pina-0.14.2 | lib/pina/processed_document.rb |