Sha256: cfd34e4d92bb78405f26180095be3a16b91f4cf34d414ba92b9ddaf4c9a25052

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

# frozen_string_literal: true

require 'forwardable'

module SolidusEasypost
  class ReturnAuthorization
    extend Forwardable

    attr_reader :return_authorization

    def_delegators :@return_authorization, :stock_location, :order, :inventory_units

    def initialize(return_authorization)
      @return_authorization = return_authorization
    end

    def easypost_shipment
      @easypost_shipment ||= ShipmentBuilder.from_return_authorization(self)
    end

    def return_label(rate)
      easypost_shipment.buy(rate) unless easypost_shipment.postage_label

      easypost_shipment.postage_label
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_easypost-3.0.0 app/models/solidus_easypost/return_authorization.rb