Sha256: d093e37cb5c506d47746d1f7390de8c63fbbd46c7003f82bb8160ed606d81989

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

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

        results.map { |result| Rentvine::WorkOrderStatus.new(result[:work_order_status]) }
      end
      alias list_work_order_statuses work_order_statuses

      def work_order_status(work_order_status_id)
        result = process_request(:get, "maintenance/work-order/statuses/#{work_order_status_id}")
        return result if result.is_a?(RentvineError)

        Rentvine::WorkOrderStatus.new(result[:work_order_status])
      end

      def save_work_order_status(work_order_status_model)
        result = process_request(
          :post, '/maintenance/work-order/statuses',
          body: work_order_status_model.to_rentvine_hash
        )
        return result if result.is_a?(RentvineError)

        Rentvine::WorkOrderStatus.new(result[:work_order_status])
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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