Sha256: d8fb278ddfdf23416c630c01fcfb00815949487533acc1b75db30634e6aeeedc

Contents?: true

Size: 1.01 KB

Versions: 53

Compression:

Stored size: 1.01 KB

Contents

require 'flipper/api/action'
require 'flipper/api/v1/decorators/actor'

module Flipper
  module Api
    module V1
      module Actions
        class Actors < Api::Action
          route %r{\A/actors/(?<flipper_id>.*)/?\Z}

          def get
            keys = params['keys']
            features = if keys
                         names = keys.split(',')
                         if names.empty?
                           []
                         else
                           flipper.preload(names)
                         end
                       else
                         flipper.features
                       end

            actor = Flipper::Actor.new(flipper_id)
            decorated_actor = Decorators::Actor.new(actor, features)
            json_response(decorated_actor.as_json)
          end

          private

          def flipper_id
            match = request.path_info.match(self.class.route_regex)
            match ? match[:flipper_id] : nil
          end
        end
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
flipper-api-1.3.2 lib/flipper/api/v1/actions/actors.rb
flipper-api-1.3.1 lib/flipper/api/v1/actions/actors.rb
flipper-api-1.3.0 lib/flipper/api/v1/actions/actors.rb
flipper-api-1.3.0.pre lib/flipper/api/v1/actions/actors.rb
flipper-api-1.2.2 lib/flipper/api/v1/actions/actors.rb
flipper-api-1.2.1 lib/flipper/api/v1/actions/actors.rb
flipper-api-1.2.0 lib/flipper/api/v1/actions/actors.rb
flipper-api-1.1.2 lib/flipper/api/v1/actions/actors.rb
flipper-api-1.1.1 lib/flipper/api/v1/actions/actors.rb
flipper-api-1.1.0 lib/flipper/api/v1/actions/actors.rb
flipper-api-1.0.0 lib/flipper/api/v1/actions/actors.rb
flipper-api-1.0.0.pre lib/flipper/api/v1/actions/actors.rb
flipper-api-0.28.3 lib/flipper/api/v1/actions/actors.rb
flipper-api-0.28.2 lib/flipper/api/v1/actions/actors.rb
flipper-api-0.28.1 lib/flipper/api/v1/actions/actors.rb
flipper-api-0.28.0 lib/flipper/api/v1/actions/actors.rb
flipper-api-0.27.1 lib/flipper/api/v1/actions/actors.rb
flipper-api-0.27.0 lib/flipper/api/v1/actions/actors.rb
flipper-api-0.26.2 lib/flipper/api/v1/actions/actors.rb
flipper-api-0.26.1 lib/flipper/api/v1/actions/actors.rb