Class: Hoodoo::Services::Discovery::ForHTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/hoodoo/services/discovery/results/for_http.rb

Overview

Describe a resource endpoint location in a way that allows it to be contacted over HTTP.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource:, version:, endpoint_uri:, proxy_uri: nil, ca_file: nil, http_timeout: nil) ⇒ ForHTTP

Create an instance with named parameters as follows:

resource

See #resource.

version

See #version.

endpoint_uri

See #endpoint_uri.

proxy_uri

See #proxy_uri. Optional.

ca_file

See #ca_file. Optional.

http_timeout

See #http_timeout. Optional.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/hoodoo/services/discovery/results/for_http.rb', line 68

def initialize( resource:,
                version:,
                endpoint_uri:,
                proxy_uri:    nil,
                ca_file:      nil,
                http_timeout: nil )

  self.resource     = resource.to_sym
  self.version      = version.to_i
  self.endpoint_uri = endpoint_uri
  self.proxy_uri    = proxy_uri
  self.ca_file      = ca_file
  self.http_timeout = http_timeout
end

Instance Attribute Details

#ca_fileObject

An optional String indicating a relative or absolute file path to the location of a .pem format Certificate Authority file (trust store), which may include multliple certificates. The certificates in the file will be used by Net::HTTP to validate the SSL Ceritificate Chain presented by remote servers, when calling endpoints over HTTPS with Hoodoo::Client.

Default nil value should be used in nearly all cases and uses Ruby OpenSSL defaults which are generally Operating System provided.



51
52
53
# File 'lib/hoodoo/services/discovery/results/for_http.rb', line 51

def ca_file
  @ca_file
end

#endpoint_uriObject

Full URI (as a URI object) at which the resource endpoint implementation can be contacted.



31
32
33
# File 'lib/hoodoo/services/discovery/results/for_http.rb', line 31

def endpoint_uri
  @endpoint_uri
end

#http_timeoutObject

Optional Float indicating the Net::HTTP read timeout value. This operates at the HTTP transport level and is independent of any timeouts set within the API providing server.



57
58
59
# File 'lib/hoodoo/services/discovery/results/for_http.rb', line 57

def http_timeout
  @http_timeout
end

#proxy_uriObject

Full URI (as a URI object) of an HTTP proxy to use as an override to ENV['HTTP_PROXY'] which Ruby itself will otherwise read. Will be nil for no proxy override.



37
38
39
# File 'lib/hoodoo/services/discovery/results/for_http.rb', line 37

def proxy_uri
  @proxy_uri
end

#resourceObject

The resource name described, as a Symbol (e.g. :Purchase).



22
23
24
# File 'lib/hoodoo/services/discovery/results/for_http.rb', line 22

def resource
  @resource
end

#versionObject

Resource endpoint version, as an Integer (e.g. 2).



26
27
28
# File 'lib/hoodoo/services/discovery/results/for_http.rb', line 26

def version
  @version
end