Class: Riddl::Implementation

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/riddl/implementation.rb

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Implementation

Returns a new instance of Implementation.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ruby/riddl/implementation.rb', line 3

def initialize(request)
  @request = request

  @h =     request[:h]     # incoming riddl headers
  @p =     request[:p]     # incoming riddl parameters
  @r =     request[:r]     # the matching resource path (fixed)
  @s =     request[:s]     # the matching resource path schema (fixed)
  @match = request[:match] # the matching resource path schema for current resource, important for recursive
  @env =   request[:env]   # environment (all headers)
  @a =     request[:a]     # args to run command
  @m =     request[:m]     # get, put, post, ...

  @headers = []
end

Instance Method Details

#headersObject

riddl headers to return (additional headers not defined in description are okay too)



20
21
22
# File 'lib/ruby/riddl/implementation.rb', line 20

def headers                       # riddl headers to return (additional headers not defined in description are okay too)
  @headers
end

#responseObject

riddl parameters to return



17
18
19
# File 'lib/ruby/riddl/implementation.rb', line 17

def response                      # riddl parameters to return
  @response || []
end

#statusObject

return status



23
24
25
# File 'lib/ruby/riddl/implementation.rb', line 23

def status                        # return status
  @status || 200
end