Method: CIMI::Service::Base.resource_attributes

Defined in:
lib/cimi/service/base.rb

.resource_attributes(context) ⇒ Object

A hash of the attributes that need to be mentioned in the given context



146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/cimi/service/base.rb', line 146

def self.resource_attributes(context)
  .keys.map do |k|
    a = model_class.schema.attributes.find { |a| a.name == k }
    raise "No attribute named #{k} defined" unless a
    constr = [k][:constraints].call(context)
    {
      :name => a.name,
      :namespace => "http://deltacloud.org/cimi/#{model_name}/#{a.name}",
      :type => [k][:type],
      :required => a.required? ? 'true' : 'false',
      :constraints => constr.map { |v| { :value => v } }
    }
  end
end