Sha256: a47305d9a4d3f1ad4e068fd8a467b108f5dbd014b0a189d53bfa50a617d12783

Contents?: true

Size: 555 Bytes

Versions: 5

Compression:

Stored size: 555 Bytes

Contents

class StripeModelCallbacks::Subscription::StateCheckerService < StripeModelCallbacks::BaseService
  attr_reader :allowed, :state

  def initialize(allowed:, state:)
    @allowed = allowed
    @state = state.to_s
  end

  def perform
    if state.is_a?(Array)
      state.each do |state_i|
        response = Subscription::StateCheckerService.execute!(allowed: allowed, state: state_i)
        return response unless response.success?
      end
    elsif allowed.exclude?(state)
      return fail! ["Not allowed: #{state}"]
    end

    succeed!
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stripe_model_callbacks-0.1.7 app/services/stripe_model_callbacks/subscription/state_checker_service.rb
stripe_model_callbacks-0.1.6 app/services/stripe_model_callbacks/subscription/state_checker_service.rb
stripe_model_callbacks-0.1.5 app/services/stripe_model_callbacks/subscription/state_checker_service.rb
stripe_model_callbacks-0.1.4 app/services/stripe_model_callbacks/subscription/state_checker_service.rb
stripe_model_callbacks-0.1.3 app/services/stripe_model_callbacks/subscription/state_checker_service.rb