Class: Eventifier::API::Base

Inherits:
Object
  • Object
show all
Includes:
Sliver::Action
Defined in:
lib/eventifier/api/base.rb

Instance Method Summary collapse

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/eventifier/api/base.rb', line 13

def call
  response.status ||= 200
  response.body   ||= {}
  response.headers['Content-Type'] ||= 'application/json'

  if response.body.is_a?(String)
    response.body = [response.body]
  else
    response.body = [JSON.generate(response.body)]
  end
end

#skip?Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
11
# File 'lib/eventifier/api/base.rb', line 4

def skip?
  return false if user

  response.status = 403
  response.body   = ['Forbidden']

  true
end