Class: ImageInspectorClient::Client
- Inherits:
- 
      Object
      
        - Object
- ImageInspectorClient::Client
 
- Defined in:
- lib/image-inspector-client.rb
Overview
module entry point
Instance Method Summary collapse
- #fetch_metadata ⇒ Object
- #fetch_oscap_arf ⇒ Object
- 
  
    
      #initialize(uri, version = 'v1', ssl_options: {         client_cert: nil,         client_key:  nil,         ca_file:     nil,         cert_store:  nil,         verify_ssl:  OpenSSL::SSL::VERIFY_PEER       }, auth_options: {         username:          nil,         password:          nil,         bearer_token:      nil       }, http_proxy_uri: nil)  ⇒ Client 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Client. 
Constructor Details
#initialize(uri, version = 'v1', ssl_options: { client_cert: nil, client_key: nil, ca_file: nil, cert_store: nil, verify_ssl: OpenSSL::SSL::VERIFY_PEER }, auth_options: { username: nil, password: nil, bearer_token: nil }, http_proxy_uri: nil) ⇒ Client
Returns a new instance of Client.
| 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # File 'lib/image-inspector-client.rb', line 9 def initialize( uri, version = 'v1', ssl_options: { client_cert: nil, client_key: nil, ca_file: nil, cert_store: nil, verify_ssl: OpenSSL::SSL::VERIFY_PEER }, auth_options: { username: nil, password: nil, bearer_token: nil }, http_proxy_uri: nil ) @endpoint = URI.parse("#{uri}/api/#{version}") @auth_options = @ssl_options = @http_proxy_uri = http_proxy_uri @headers = {} end | 
Instance Method Details
#fetch_metadata ⇒ Object
| 39 40 41 42 43 44 45 46 47 | # File 'lib/image-inspector-client.rb', line 39 def exception_handler do RecursiveOpenStruct.new( JSON.parse( RestClient::Resource.new(@endpoint, )['metadata'].get(http_headers) ) ) end end | 
#fetch_oscap_arf ⇒ Object
| 33 34 35 36 37 | # File 'lib/image-inspector-client.rb', line 33 def fetch_oscap_arf exception_handler do RestClient::Resource.new(@endpoint, )['openscap'].get(http_headers).body end end |