Sha256: 792707bcf2798b872bff0d8a2116b895bf2a4e8611ab52e0e20fa395e6c234ad

Contents?: true

Size: 916 Bytes

Versions: 4

Compression:

Stored size: 916 Bytes

Contents

module Rentvine
  class Client
    module VendorTrades
      def vendor_trades(args = {})
        results = process_request(:get, 'maintenance/vendor-trades', params: args)
        return results if results.is_a?(RentvineError)

        results.map { |result| Rentvine::VendorTrade.new(result[:vendor_trade]) }
      end
      alias list_vendor_trades vendor_trades

      def vendor_trade(vendor_trade_id)
        result = process_request(:get, "maintenance/vendor-trades/#{vendor_trade_id}")
        return result if result.is_a?(RentvineError)

        Rentvine::VendorTrade.new(result[:vendor_trade])
      end

      def save_vendor_trade(vendor_trade_model)
        result = process_request(:post, '/maintenance/vendor-trades', body: vendor_trade_model.to_rentvine_hash)
        return result if result.is_a?(RentvineError)

        Rentvine::VendorTrade.new(result[:vendor_trade])
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rentvine-0.3.1 lib/rentvine/client/vendor_trades.rb
rentvine-0.3.0 lib/rentvine/client/vendor_trades.rb
rentvine-0.2.0 lib/rentvine/client/vendor_trades.rb
rentvine-0.1.0 lib/rentvine/client/vendor_trades.rb