Class: Apia::Request

Inherits:
Rack::Request
  • Object
show all
Defined in:
lib/apia/request.rb

Direct Known Subclasses

MockRequest

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#apiObject

Returns the value of attribute api.



10
11
12
# File 'lib/apia/request.rb', line 10

def api
  @api
end

#api_pathObject

Returns the value of attribute api_path.



18
19
20
# File 'lib/apia/request.rb', line 18

def api_path
  @api_path
end

#argumentsObject



24
25
26
# File 'lib/apia/request.rb', line 24

def arguments
  @arguments ||= {}
end

#authenticatorObject

Returns the value of attribute authenticator.



15
16
17
# File 'lib/apia/request.rb', line 15

def authenticator
  @authenticator
end

#controllerObject

Returns the value of attribute controller.



11
12
13
# File 'lib/apia/request.rb', line 11

def controller
  @controller
end

#endpointObject

Returns the value of attribute endpoint.



12
13
14
# File 'lib/apia/request.rb', line 12

def endpoint
  @endpoint
end

#identityObject

Returns the value of attribute identity.



13
14
15
# File 'lib/apia/request.rb', line 13

def identity
  @identity
end

#namespaceObject

Returns the value of attribute namespace.



16
17
18
# File 'lib/apia/request.rb', line 16

def namespace
  @namespace
end

#routeObject

Returns the value of attribute route.



17
18
19
# File 'lib/apia/request.rb', line 17

def route
  @route
end

Class Method Details

.empty(options: {}) ⇒ Object



20
21
22
# File 'lib/apia/request.rb', line 20

def self.empty(options: {})
  new(options)
end

Instance Method Details

#body?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/apia/request.rb', line 38

def body?
  has_header?('rack.input')
end

#headersObject



28
29
30
# File 'lib/apia/request.rb', line 28

def headers
  @headers ||= RequestHeaders.create_from_request(self)
end

#json_bodyObject



32
33
34
35
36
# File 'lib/apia/request.rb', line 32

def json_body
  return @json_body if instance_variable_defined?('@json_body')

  @json_body = get_json_body_from_body || get_json_body_from_params
end

#paramsObject



42
43
44
45
46
# File 'lib/apia/request.rb', line 42

def params
  return {} unless body?

  super
end