Sha256: ed0e212c09a8d3b843816e73ef0efaca364af9d9952eb86a4c4d8d716a5c81c6

Contents?: true

Size: 636 Bytes

Versions: 7

Compression:

Stored size: 636 Bytes

Contents

# frozen_string_literal: true

module SolidusSubscriptions
  module ChurnBuster
    class SubscriptionCustomerSerializer < Serializer
      def to_h
        {
          source: 'in_house',
          source_id: object.id,
          email: object.user.email,
          properties: {
            name: name
          },
        }
      end

      private

      def name
        if ::Spree.solidus_gem_version < Gem::Version.new('2.11.0')
          "#{object.shipping_address_to_use.first_name} #{object.shipping_address_to_use.last_name}"
        else
          object.shipping_address_to_use.name
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb
solidus_subscriptions-2.0.1 lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb
solidus_subscriptions-2.0.0 lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb
solidus_subscriptions-1.1.0 lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb
solidus_subscriptions-1.0.1 lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb
solidus_subscriptions-1.0.0 lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb
solidus_subscriptions-1.0.0.rc1 lib/solidus_subscriptions/churn_buster/subscription_customer_serializer.rb