Sha256: 585e89359d59801c6d6f2eba656006e519b3d1b51a9d9fd506591acfc6d26d5f

Contents?: true

Size: 757 Bytes

Versions: 7

Compression:

Stored size: 757 Bytes

Contents

module Rentvine
  class Client
    module Ledgers
      def ledgers(search)
        results = process_request(:get, 'accounting/ledgers', params: { search: search })
        return results if results.is_a?(RentvineError)

        results.map { |result| Rentvine::Ledger.new(result[:ledger]) }
      end
      alias list_ledgers ledgers

      def search_ledgers(args = {})
        results = process_request(:get, 'accounting/ledgers/search', params: args)
        return results if results.is_a?(RentvineError)

        results.map do |result|
          rvobj = Rentvine::Ledger.new(result[:ledger])
          rvobj.unit = Rentvine::Unit.new(result[:unit])
          rvobj.meta = { appends: [:unit] }
          rvobj
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rentvine-0.4.0 lib/rentvine/client/ledgers.rb
rentvine-0.3.3 lib/rentvine/client/ledgers.rb
rentvine-0.3.2 lib/rentvine/client/ledgers.rb
rentvine-0.3.1 lib/rentvine/client/ledgers.rb
rentvine-0.3.0 lib/rentvine/client/ledgers.rb
rentvine-0.2.0 lib/rentvine/client/ledgers.rb
rentvine-0.1.0 lib/rentvine/client/ledgers.rb