Class: Idcf::Dns::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/idcf/dns/request.rb

Overview

  • Send HTTP request

  • Generate signatures

  • Set default expires

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, method, resource, parameters, headers) ⇒ Request

Returns a new instance of Request.



14
15
16
17
18
19
20
# File 'lib/idcf/dns/request.rb', line 14

def initialize(client, method, resource, parameters, headers)
  @client       = client
  @method       = method
  @resource     = resource
  @parameters   = parameters
  @headers      = headers
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



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

def client
  @client
end

#methodObject (readonly)

Returns the value of attribute method.



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

def method
  @method
end

#parametersObject (readonly)

Returns the value of attribute parameters.



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

def parameters
  @parameters
end

#resourceObject (readonly)

Returns the value of attribute resource.



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

def resource
  @resource
end

Instance Method Details

#headersObject



35
36
37
38
39
# File 'lib/idcf/dns/request.rb', line 35

def headers
  auth_headers.merge(
    @headers.reject { |key, _| key.to_s == "X-IDCF-Expires" }
  )
end

#sendObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/idcf/dns/request.rb', line 23

def send
  Response.new(
    client.connection.send(
      method,
      path,
      parameters,
      headers
    )
  )
end