Sha256: 1c6c26418895d9027dac83c62557153395089c757fea97170ddc5d2db895e0cd

Contents?: true

Size: 767 Bytes

Versions: 1

Compression:

Stored size: 767 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ledger_sync-stripe-0.1.0 lib/ledger_sync/stripe/operation.rb