Class: Egi::Fedcloud::Cloudhound::AppdbAppliance
- Inherits:
-
Object
- Object
- Egi::Fedcloud::Cloudhound::AppdbAppliance
- Defined in:
- lib/egi/fedcloud/cloudhound/appdb_appliance.rb
Instance Attribute Summary collapse
-
#checksum ⇒ Object
readonly
Returns the value of attribute checksum.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#mpuri ⇒ Object
readonly
Returns the value of attribute mpuri.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#published ⇒ Object
readonly
Returns the value of attribute published.
-
#sites ⇒ Object
readonly
Returns the value of attribute sites.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(element) ⇒ AppdbAppliance
constructor
A new instance of AppdbAppliance.
Constructor Details
#initialize(element) ⇒ AppdbAppliance
Returns a new instance of AppdbAppliance.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/egi/fedcloud/cloudhound/appdb_appliance.rb', line 10 def initialize(element) Egi::Fedcloud::Cloudhound::Log.debug "[#{self.class}] Initializing with #{element.inspect}" @identifier = element['identifier'] @version = element['version'] @url = element['url'] @checksum = element['checksum'] @format = element['format'] @owner = element['addedby'] ? element['addedby']['permalink'] : 'unknown' @published = element['published'] @mpuri = element['mpuri'] # and now the difficult part @sites = self.class.extract_sites(element['sites']) end |
Instance Attribute Details
#checksum ⇒ Object (readonly)
Returns the value of attribute checksum.
4 5 6 |
# File 'lib/egi/fedcloud/cloudhound/appdb_appliance.rb', line 4 def checksum @checksum end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
4 5 6 |
# File 'lib/egi/fedcloud/cloudhound/appdb_appliance.rb', line 4 def format @format end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
4 5 6 |
# File 'lib/egi/fedcloud/cloudhound/appdb_appliance.rb', line 4 def identifier @identifier end |
#mpuri ⇒ Object (readonly)
Returns the value of attribute mpuri.
4 5 6 |
# File 'lib/egi/fedcloud/cloudhound/appdb_appliance.rb', line 4 def mpuri @mpuri end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
4 5 6 |
# File 'lib/egi/fedcloud/cloudhound/appdb_appliance.rb', line 4 def owner @owner end |
#published ⇒ Object (readonly)
Returns the value of attribute published.
4 5 6 |
# File 'lib/egi/fedcloud/cloudhound/appdb_appliance.rb', line 4 def published @published end |
#sites ⇒ Object (readonly)
Returns the value of attribute sites.
7 8 9 |
# File 'lib/egi/fedcloud/cloudhound/appdb_appliance.rb', line 7 def sites @sites end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/egi/fedcloud/cloudhound/appdb_appliance.rb', line 4 def url @url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
4 5 6 |
# File 'lib/egi/fedcloud/cloudhound/appdb_appliance.rb', line 4 def version @version end |
Class Method Details
.extract_site_vos(element) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/egi/fedcloud/cloudhound/appdb_appliance.rb', line 41 def extract_site_vos(element) return [] if element.blank? vos = [] element.each do |service| vos << service['vos'].collect { |vo| vo['name'] } end vos.flatten! vos.compact! vos.uniq! vos end |
.extract_sites(element) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/egi/fedcloud/cloudhound/appdb_appliance.rb', line 28 def extract_sites(element) return [] if element.blank? element.collect do |site| st = {} st['name'] = site['name'] st['gocdb_link'] = site['url'] ? site['url']['portal'] : 'unknown' st['vos'] = extract_site_vos(site['services']) st end end |