From: Michal Fojtik <mfoj...@redhat.com>
Signed-off-by: Michal fojtik <mfoj...@redhat.com> --- .../lib/deltacloud/client/models/instance_address.rb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/client/lib/deltacloud/client/models/instance_address.rb b/client/lib/deltacloud/client/models/instance_address.rb index f40c264..1099c8b 100644 --- a/client/lib/deltacloud/client/models/instance_address.rb +++ b/client/lib/deltacloud/client/models/instance_address.rb @@ -14,10 +14,18 @@ # under the License. module Deltacloud::Client - class InstanceAddress < OpenStruct + class InstanceAddress - attr_reader :type - attr_reader :value + attr_reader :type, :value + + def initialize(type, value) + @type = type + @value = value + end + + def [](attr) + instance_variable_get("@#{attr}") + end def to_s @value @@ -25,10 +33,7 @@ module Deltacloud::Client def self.convert(address_xml_block) address_xml_block.map do |addr| - new( - :type => addr['type'], - :value => addr.text - ) + new(addr['type'].to_sym, addr.text) end end end -- 1.8.1.4