Sha256: 80eeb8af79a4e2498ef56110153a274767b20940367eef8cde41f1543da7694e
Contents?: true
Size: 858 Bytes
Versions: 3
Compression:
Stored size: 858 Bytes
Contents
#!/usr/bin/env ruby require File.expand_path(File.dirname(__FILE__) + '/../spec/spec_helper') class Base include ROXML xml_convention :dasherize xml_namespace 'aws' end class WeatherObservation < Base xml_name 'ob' xml_reader :temperature, :as => Float, :from => 'aws:temp' xml_reader :feels_like, :as => Integer xml_reader :current_condition #, :attributes => {:icon => String} # pending end class Weather < Base xml_reader :observation, WeatherObservation, :required => true end unless defined?(Spec) current_weather = Weather.from_xml(xml_for('current_weather')).observation puts "temperature: #{current_weather.temperature}" puts "feels_like: #{current_weather.feels_like}" puts "current_condition: #{current_weather.current_condition}" # puts "current_condition.icon: #{current_weather.current_condition.icon}" # pending end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
Empact-roxml-2.4.3 | examples/current_weather.rb |
roxml-2.4.2 | examples/current_weather.rb |
roxml-2.4.3 | examples/current_weather.rb |