class Desmoservice::Ventilation
Attributes
error[R]
root[R]
sectors[R]
Public Class Methods
new()
click to toggle source
# File lib/ventilation.rb, line 6 def initialize @sectors = Array.new end
Public Instance Methods
get_sector_by_id(id)
click to toggle source
# File lib/ventilation.rb, line 34 def get_sector_by_id(id) @sectors.each do |sector| if sector.id == id return sector end subsector = sector.get_subsector_by_id(id) if not subsector.nil? return subsector end end return nil end
has_error?()
click to toggle source
# File lib/ventilation.rb, line 30 def has_error? return (not error.nil?) end
parse_json(json_string)
click to toggle source
# File lib/ventilation.rb, line 10 def parse_json(json_string) data = JSON.parse(json_string) if data.has_key?('ventilation') @error = nil ventilation = data['ventilation'] if ventilation.has_key?('secteurArray') ventilation['secteurArray'].each {|v| @sectors << Sector.new(v)} end if ventilation.has_key?('root') @root = Term.new(ventilation['root']) end else if data.has_key?('error') @error = Error.from_json_hash(data['error']) else @error = Error.new("responseError", "response", json_string) end end end