Class: MDQT::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/mdqt/client.rb,
lib/mdqt/client/metadata_file.rb,
lib/mdqt/client/identifier_utils.rb,
lib/mdqt/client/metadata_service.rb,
lib/mdqt/client/metadata_response.rb,
lib/mdqt/client/metadata_validator.rb

Defined Under Namespace

Modules: IdentifierUtils Classes: MetadataFile, MetadataResponse, MetadataService, MetadataValidator

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_url, options = {}) ⇒ Client

Returns a new instance of Client.



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/mdqt/client.rb', line 22

def initialize(base_url, options={})

  @base_url        = base_url
  @verbose         = options[:verbose] || false
  @explain         = options[:explain] || false
  @tls_cert_check  = options[:tls_risky] ? false : true
  @cache_type = options[:cache_type] || :none

  @md_service = MetadataService.new(@base_url, verbose: @verbose, cache_type: @cache_type, explain: @explain, tls_cert_check: tls_cert_check?)
  @md_service.tidy_cache!

end

Class Method Details

.verification_available?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/mdqt/client.rb', line 18

def self.verification_available?
  @xmlsig_available
end

Instance Method Details

#base_urlObject



51
52
53
# File 'lib/mdqt/client.rb', line 51

def base_url
  @base_url
end

#cache_reset!Object



71
72
73
# File 'lib/mdqt/client.rb', line 71

def cache_reset!
  md_service.purge_cache!
end

#cache_typeObject



67
68
69
# File 'lib/mdqt/client.rb', line 67

def cache_type
  @cache_type
end

#exists?(entity_id) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/mdqt/client.rb', line 43

def exists?(entity_id)
  md_service.exists?(entity_id)
end

#explain?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/mdqt/client.rb', line 59

def explain?
  @explain
end

#get_metadata(entity_id) ⇒ Object



39
40
41
# File 'lib/mdqt/client.rb', line 39

def (entity_id)
  md_service.get(entity_id)
end

#open_metadata(filename) ⇒ Object



35
36
37
# File 'lib/mdqt/client.rb', line 35

def (filename)
  MetadataFile.new(filename, verbose: @verbose)
end

#tls_cert_check?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/mdqt/client.rb', line 63

def tls_cert_check?
  @tls_cert_check
end

#transform_uri(uri) ⇒ Object



47
48
49
# File 'lib/mdqt/client.rb', line 47

def transform_uri(uri)
  MDQT::Client::IdentifierUtils.transform_uri(uri)
end

#verbose?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/mdqt/client.rb', line 55

def verbose?
  @verbose
end