Sha256: ed83c033387c1422e8af8d6cde3a880c15a1e38b2782e342ef8d43fd08a42f65

Contents?: true

Size: 878 Bytes

Versions: 7

Compression:

Stored size: 878 Bytes

Contents

module Rentvine
  class Client
    module WorkOrders
      def work_orders(args = {})
        results = process_request(:get, 'maintenance/work-orders', params: args)
        return results if results.is_a?(RentvineError)

        results.map { |result| Rentvine::WorkOrder.new(result[:work_order]) }
      end
      alias list_work_orders work_orders

      def work_order(work_order_id)
        result = process_request(:get, "maintenance/work-orders/#{work_order_id}")
        return result if result.is_a?(RentvineError)

        Rentvine::WorkOrder.new(result[:work_order])
      end

      def save_work_order(work_order_model)
        result = process_request(:post, '/maintenance/work-orders', body: work_order_model.to_rentvine_hash)
        return result if result.is_a?(RentvineError)

        Rentvine::WorkOrder.new(result[:work_order])
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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