Class: Flipper::Api::V1::Actions::Actors

Inherits:
Action
  • Object
show all
Defined in:
lib/flipper/api/v1/actions/actors.rb

Constant Summary

Constants inherited from Action

Action::VALID_REQUEST_METHOD_NAMES

Instance Attribute Summary

Attributes inherited from Action

#flipper, #request

Instance Method Summary collapse

Methods inherited from Action

#halt, #header, #initialize, #json_error_response, #json_response, route, route_match?, route_regex, #run, run, #run_other_action, #status

Constructor Details

This class inherits a constructor from Flipper::Api::Action

Instance Method Details

#getObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/flipper/api/v1/actions/actors.rb', line 11

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