Class: Dynamicloud::API::RecordImpl
- Inherits:
-
Object
- Object
- Dynamicloud::API::RecordImpl
- Defined in:
- lib/dynamic_api.rb
Overview
This class represents a record in Dynamicloud
Instance Method Summary collapse
-
#add_value(attribute, value) ⇒ Object
Adds a new value paired with attribute.
-
#get_value(attribute) ⇒ Object
gets the value paired with attribute.
-
#get_values(attribute) ⇒ Object
get the values paired with attribute.
-
#initialize ⇒ RecordImpl
constructor
A new instance of RecordImpl.
Constructor Details
#initialize ⇒ RecordImpl
Returns a new instance of RecordImpl.
243 244 245 |
# File 'lib/dynamic_api.rb', line 243 def initialize @map = {} end |
Instance Method Details
#add_value(attribute, value) ⇒ Object
Adds a new value paired with attribute
278 279 280 |
# File 'lib/dynamic_api.rb', line 278 def add_value(attribute, value) @map[attribute] = value end |
#get_value(attribute) ⇒ Object
gets the value paired with attribute
250 251 252 253 254 255 256 257 258 259 |
# File 'lib/dynamic_api.rb', line 250 def get_value(attribute) obj = @map[attribute] if obj if obj.is_a?(String) return obj.to_s end end raise IllegalStateException, "The attribute #{attribute} doesn't have a paired string." end |
#get_values(attribute) ⇒ Object
get the values paired with attribute
264 265 266 267 268 269 270 271 272 273 |
# File 'lib/dynamic_api.rb', line 264 def get_values(attribute) obj = @map[attribute] if obj if obj.respond_to?(:each) return obj end end raise IllegalStateException, "Tha attribute #{attribute} doesn't have a paired string array." end |