Sha256: 0d12f2f06a9f78ea224c606df8616de9887d5cb7695eb0270343c3d5322a2512

Contents?: true

Size: 844 Bytes

Versions: 8

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true

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

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

            def perform
              client.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

8 entries across 8 versions & 1 rubygems

Version Path
ledger_sync-1.6.0 lib/ledger_sync/ledgers/stripe/operation.rb
ledger_sync-1.5.2 lib/ledger_sync/ledgers/stripe/operation.rb
ledger_sync-1.5.1 lib/ledger_sync/ledgers/stripe/operation.rb
ledger_sync-1.5.0 lib/ledger_sync/ledgers/stripe/operation.rb
ledger_sync-1.4.4 lib/ledger_sync/ledgers/stripe/operation.rb
ledger_sync-1.4.2 lib/ledger_sync/ledgers/stripe/operation.rb
ledger_sync-1.4.1 lib/ledger_sync/ledgers/stripe/operation.rb
ledger_sync-1.4.0 lib/ledger_sync/ledgers/stripe/operation.rb