Sha256: 564ab24c22e7e2cb89731b819b55b5c0d3c94613b30b0603b3fd28a8c973bfb8

Contents?: true

Size: 900 Bytes

Versions: 5

Compression:

Stored size: 900 Bytes

Contents

# frozen_string_literal: true

require_relative '../api_resource'

module ErpIntegration
  module Fulfil
    module Resources
      class CustomerShipmentReturn < ApiResource
        self.model_name = 'stock.shipment.out.return'

        def generate_shipping_label(id)
          client.put("model/#{model_name}/#{id}/generate_shipping_labels")
          true
        # Workaround: Fulfil api does not return a json when status code is 200 (a.k.a. "Ok")
        # and faraday is having an error when trying to parse it. Let's skip the parse error
        # and move on.
        rescue Faraday::ParsingError
          true
        end

        def create_default_package(id)
          client.put("model/#{model_name}/#{id}/create_default_packages")
        end

        def create_package(id, options)
          client.put("model/#{model_name}/#{id}", options)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
erp_integration-0.31.0 lib/erp_integration/fulfil/resources/customer_shipment_return.rb
erp_integration-0.30.0 lib/erp_integration/fulfil/resources/customer_shipment_return.rb
erp_integration-0.29.0 lib/erp_integration/fulfil/resources/customer_shipment_return.rb
erp_integration-0.28.1 lib/erp_integration/fulfil/resources/customer_shipment_return.rb
erp_integration-0.28.0 lib/erp_integration/fulfil/resources/customer_shipment_return.rb