Sha256: 13be288578da2456a31e83a837f969f50a74035e9d44178f566bb92cf9e7f2f5

Contents?: true

Size: 855 Bytes

Versions: 5

Compression:

Stored size: 855 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  module Adaptors
    module Stripe
      module Operation
        module Mixin
          def self.included(base)
            base.include Adaptors::Operation::Mixin
            base.include InstanceMethods # To ensure these override parent methods
          end

          module InstanceMethods
            def stripe_resource_type
              @stripe_resource_type ||= ledger_serializer.class.stripe_resource_type
            end

            def perform
              adaptor.wrap_perform do
                super
              end
            rescue ::Stripe::StripeError => e
              case e.code
              when 'resource_missing'
                failure(e)
              else
                raise e
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ledger_sync-1.3.5 lib/ledger_sync/adaptors/stripe/operation.rb
ledger_sync-1.3.4 lib/ledger_sync/adaptors/stripe/operation.rb
ledger_sync-1.3.3 lib/ledger_sync/adaptors/stripe/operation.rb
ledger_sync-1.3.2 lib/ledger_sync/adaptors/stripe/operation.rb
ledger_sync-1.3.1 lib/ledger_sync/adaptors/stripe/operation.rb