Class: ClowderCommonRuby::AppMetadata

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/clowder-common-ruby/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ AppMetadata

Returns a new instance of AppMetadata.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/clowder-common-ruby/types.rb', line 91

def initialize(attributes)
  super
  raise 'The input argument (attributes) must be a hash' if (!attributes || !attributes.is_a?(Hash))

  attributes = attributes.each_with_object({}) do |(k, v), h|
    warn "The input [#{k}] is invalid" unless valid_keys.include?(k.to_sym)
    h[k.to_sym] = v
  end

  @deployments = []
  attributes.fetch(:deployments, []).each do |attr|
    @deployments << DeploymentMetadata.new(attr)
  end
end

Instance Attribute Details

#deploymentsObject

Returns the value of attribute deployments.



89
90
91
# File 'lib/clowder-common-ruby/types.rb', line 89

def deployments
  @deployments
end

Instance Method Details

#valid_keysObject



106
107
108
109
110
111
112
# File 'lib/clowder-common-ruby/types.rb', line 106

def valid_keys
  [].tap do |keys|
    keys << :name
    keys << :envName
    keys << :deployments
  end
end