Sha256: 117c10c2f41586d536b673a5f22f627b86c5a521d1917f521f957a022ec55d25
Contents?: true
Size: 967 Bytes
Versions: 3
Compression:
Stored size: 967 Bytes
Contents
require 'pina/models/receivable' require 'pina/collections/receivable' module Pina class Receivable class << self def new(params = nil) Pina::Models::Receivable.new(params) end def find(id) response = Pina::RestAdapter.get(:receivables, id) return Pina::Models::Receivable.new(attributes(response)) if response.ok? response end def where(hash, _page = nil) response = Pina::RestAdapter.get(:receivables, hash) return Pina::Collections::Receivable.new(attributes(response)) if response.ok? response end def all(page = nil) response = Pina::RestAdapter.get(:receivables, page) return Pina::Collections::Receivable.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/receivable.rb |
pina-0.14.3 | lib/pina/receivable.rb |
pina-0.14.2 | lib/pina/receivable.rb |