Sha256: 810646e5feca3ee2185162456338e6b58333e484e7817e25c805ba0e8b56b0ef

Contents?: true

Size: 556 Bytes

Versions: 3

Compression:

Stored size: 556 Bytes

Contents

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

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

  def execute
    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.include?(state)
      return fail! ["Not allowed: #{state}"]
    end

    succeed!
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stripe_model_callbacks-0.1.2 app/services/stripe_model_callbacks/subscription/state_checker_service.rb
stripe_model_callbacks-0.1.1 app/services/stripe_model_callbacks/subscription/state_checker_service.rb
stripe_model_callbacks-0.1.0 app/services/stripe_model_callbacks/subscription/state_checker_service.rb