Class: Realm

Inherits:
BaseModel show all
Defined in:
lib/deltacloud/models/realm.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

attr_accessor, attributes, #attributes, #id, #to_entity

Constructor Details

#initialize(init = nil) ⇒ Realm

Returns a new instance of Realm.



25
26
27
28
# File 'lib/deltacloud/models/realm.rb', line 25

def initialize(init=nil)
  super(init)
  self.resource_types ||= []
end

Instance Attribute Details

#limitObject

Returns the value of attribute limit.



21
22
23
# File 'lib/deltacloud/models/realm.rb', line 21

def limit
  @limit
end

#nameObject

Returns the value of attribute name.



20
21
22
# File 'lib/deltacloud/models/realm.rb', line 20

def name
  @name
end

#resource_typesObject

Returns the value of attribute resource_types.



23
24
25
# File 'lib/deltacloud/models/realm.rb', line 23

def resource_types
  @resource_types
end

#stateObject

Returns the value of attribute state.



22
23
24
# File 'lib/deltacloud/models/realm.rb', line 22

def state
  @state
end

Instance Method Details

#to_hash(context) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/deltacloud/models/realm.rb', line 30

def to_hash(context)
  r = {
    :id => self.id,
    :href => context.realm_url(self.id),
    :name => name,
    :state => state,
    :limit => limit
  }
  r.merge!({:resource_types => resource_types}) if resource_types
  r
end