Sha256: 0ee04356808c4731c6ee11530716fa971b060f381c112b5d92db4f73288ccb8c

Contents?: true

Size: 788 Bytes

Versions: 3

Compression:

Stored size: 788 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
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
erp_integration-0.27.0 lib/erp_integration/fulfil/resources/customer_shipment_return.rb
erp_integration-0.26.0 lib/erp_integration/fulfil/resources/customer_shipment_return.rb
erp_integration-0.25.0 lib/erp_integration/fulfil/resources/customer_shipment_return.rb