Class: RubyRest::Client::Atom
- Defined in:
- lib/rubyrest/client.rb
Instance Method Summary collapse
- #hidrate_data(response) ⇒ Object
-
#initialize(host, port) ⇒ Atom
constructor
A new instance of Atom.
- #serialize_data(hash) ⇒ Object
Methods inherited from Abstract
#create, #dashboard, #delete, #encode_path, #http, #prepare_headers, #retrieve, #to_query_string, #update
Constructor Details
#initialize(host, port) ⇒ Atom
Returns a new instance of Atom.
122 123 124 125 |
# File 'lib/rubyrest/client.rb', line 122 def initialize( host, port ) super( host, port ) @format = "atom" end |
Instance Method Details
#hidrate_data(response) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/rubyrest/client.rb', line 127 def hidrate_data( response ) begin REXML::Document.new( response.body ) if response.body rescue => e puts "unable to parse response body: " + e. puts "---- response body ----" puts response.body puts "-----------------------" return nil end end |
#serialize_data(hash) ⇒ Object
139 140 141 142 143 144 |
# File 'lib/rubyrest/client.rb', line 139 def serialize_data( hash ) doc = REXML::Document.new content = doc.add_element( "entry" ).add_element( "rubyrest:content" ) hash.each { |name,value| content.add_element( name.to_s ).add_text( value.to_s ) } return doc end |