Class: Dyndnsd::Responder::RestStyle

Inherits:
Object
  • Object
show all
Defined in:
lib/dyndnsd/responder/rest_style.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RestStyle

Returns a new instance of RestStyle.

Parameters:



7
8
9
# File 'lib/dyndnsd/responder/rest_style.rb', line 7

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Array{Integer,Hash{String => String},Array<String>}

Parameters:

  • env (Hash{String => String})

Returns:

  • (Array{Integer,Hash{String => String},Array<String>})


13
14
15
16
17
18
19
20
21
# File 'lib/dyndnsd/responder/rest_style.rb', line 13

def call(env)
  @app.call(env).tap do |status_code, headers, body|
    if headers.key?('X-DynDNS-Response')
      return decorate_dyndnsd_response(status_code, headers, body)
    else
      return decorate_other_response(status_code, headers, body)
    end
  end
end