Class: Consul::Async::JSONConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/consul/async/json_endpoint.rb

Overview

Configuration to apply to JSONEndpoints

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, debug: { network: false }, retry_duration: 10, min_duration: 10, retry_on_non_diff: 10, request_method: :get, json_body: nil, headers: {}, enable_gzip_compression: true, tls_cert_chain: nil, tls_private_key: nil, tls_verify_peer: true) ⇒ JSONConfiguration

Returns a new instance of JSONConfiguration.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/consul/async/json_endpoint.rb', line 13

def initialize(url:,
               debug: { network: false },
               retry_duration: 10,
               min_duration: 10,
               retry_on_non_diff: 10,
               request_method: :get,
               json_body: nil,
               headers: {},
               enable_gzip_compression: true,
               tls_cert_chain: nil,
               tls_private_key: nil,
               tls_verify_peer: true)
  @url = url
  @debug = debug
  @enable_gzip_compression = enable_gzip_compression
  @retry_duration = retry_duration
  @min_duration = min_duration
  @retry_on_non_diff = retry_on_non_diff
  @request_method = request_method
  @json_body = json_body
  @headers = headers
  @tls_cert_chain = tls_cert_chain
  @tls_private_key = tls_private_key
  @tls_verify_peer = tls_verify_peer
end

Instance Attribute Details

#debugObject (readonly)

Returns the value of attribute debug.



10
11
12
# File 'lib/consul/async/json_endpoint.rb', line 10

def debug
  @debug
end

#enable_gzip_compressionObject (readonly)

Returns the value of attribute enable_gzip_compression.



10
11
12
# File 'lib/consul/async/json_endpoint.rb', line 10

def enable_gzip_compression
  @enable_gzip_compression
end

#headersObject (readonly)

Returns the value of attribute headers.



10
11
12
# File 'lib/consul/async/json_endpoint.rb', line 10

def headers
  @headers
end

#json_bodyObject (readonly)

Returns the value of attribute json_body.



10
11
12
# File 'lib/consul/async/json_endpoint.rb', line 10

def json_body
  @json_body
end

#min_durationObject (readonly)

Returns the value of attribute min_duration.



10
11
12
# File 'lib/consul/async/json_endpoint.rb', line 10

def min_duration
  @min_duration
end

#request_methodObject (readonly)

Returns the value of attribute request_method.



10
11
12
# File 'lib/consul/async/json_endpoint.rb', line 10

def request_method
  @request_method
end

#retry_durationObject (readonly)

Returns the value of attribute retry_duration.



10
11
12
# File 'lib/consul/async/json_endpoint.rb', line 10

def retry_duration
  @retry_duration
end

#retry_on_non_diffObject (readonly)

Returns the value of attribute retry_on_non_diff.



10
11
12
# File 'lib/consul/async/json_endpoint.rb', line 10

def retry_on_non_diff
  @retry_on_non_diff
end

#tls_cert_chainObject (readonly)

Returns the value of attribute tls_cert_chain.



10
11
12
# File 'lib/consul/async/json_endpoint.rb', line 10

def tls_cert_chain
  @tls_cert_chain
end

#tls_private_keyObject (readonly)

Returns the value of attribute tls_private_key.



10
11
12
# File 'lib/consul/async/json_endpoint.rb', line 10

def tls_private_key
  @tls_private_key
end

#tls_verify_peerObject (readonly)

Returns the value of attribute tls_verify_peer.



10
11
12
# File 'lib/consul/async/json_endpoint.rb', line 10

def tls_verify_peer
  @tls_verify_peer
end

#urlObject (readonly)

Returns the value of attribute url.



10
11
12
# File 'lib/consul/async/json_endpoint.rb', line 10

def url
  @url
end

Instance Method Details

#create(_url) ⇒ Object



39
40
41
42
# File 'lib/consul/async/json_endpoint.rb', line 39

def create(_url)
  # here we assume we don't need to cache configuration
  self
end