Sha256: 1d3c13dc250944799b046a1384582e30b5aa3bfa0d52f65ec4b5de3a76d8b998

Contents?: true

Size: 561 Bytes

Versions: 1

Compression:

Stored size: 561 Bytes

Contents

# frozen_string_literal: true

module SolidusEasypost
  module Spree
    module StockLocationDecorator
      def easypost_address
        attributes = {
          street1: address1,
          street2: address2,
          city: city,
          zip: zipcode,
          phone: phone,
          name: name,
          company: name
        }

        attributes[:state] = state ? state.abbr : state_name
        attributes[:country] = country&.iso

        ::EasyPost::Address.create attributes
      end

      ::Spree::StockLocation.prepend self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_easypost-2.0.0 app/decorators/models/solidus_easypost/spree/stock_location_decorator.rb