Class: Opencrx::Account::AccountRecord
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Opencrx::Account::AccountRecord
show all
- Defined in:
- lib/opencrx.rb
Constant Summary
collapse
- BASEKEY =
"org.opencrx.kernel.account1"
Instance Method Summary
collapse
Constructor Details
Returns a new instance of AccountRecord.
109
110
111
112
|
# File 'lib/opencrx.rb', line 109
def initialize(attributes)
attributes = attributes[key] if attributes.has_key? key
super attributes
end
|
Instance Method Details
#key ⇒ Object
114
115
116
|
# File 'lib/opencrx.rb', line 114
def key
"#{BASEKEY}.#{ActiveSupport::Inflector.demodulize self.class}"
end
|
#save ⇒ Object
118
119
120
121
122
123
124
|
# File 'lib/opencrx.rb', line 118
def save
if has_key?('href')
Opencrx::Account.put(fetch('href'), xml)
else
Opencrx::Account.post(xml)
end
end
|
#xml ⇒ Object
126
127
128
|
# File 'lib/opencrx.rb', line 126
def xml
__getobj__.except('owner', 'owningUser', 'owningGroup', 'href', 'version').to_xml(root: key)
end
|