Class: Dyndnsd::Responder::DynDNSStyle

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ DynDNSStyle

Returns a new instance of DynDNSStyle.

Parameters:



7
8
9
# File 'lib/dyndnsd/responder/dyndns_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/dyndns_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