Method: HaveAPI::Action#initialize

Defined in:
lib/haveapi/action.rb

#initialize(request, version, params, body, context) ⇒ Action

Returns a new instance of Action.



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/haveapi/action.rb', line 292

def initialize(request, version, params, body, context)
  super()
  @request = request
  @version = version
  @params = params
  @params.update(body) if body
  @context = context
  @context.action = self.class
  @context.action_instance = self
  @metadata = {}
  @reply_meta = { object: {}, global: {} }
  @flags = {}

  class_auth = self.class.authorization

  @authorization = if class_auth
                     class_auth.clone
                   else
                     Authorization.new {}
                   end

  self.class.add_pre_authorize_blocks(@authorization, @context)
end