Class: Fog::Parsers::Compute::Voxel::VoxcloudStatus

Inherits:
Base
  • Object
show all
Defined in:
lib/fog/parsers/compute/voxel/voxcloud_status.rb

Instance Method Summary collapse

Instance Method Details

#end_element(name) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fog/parsers/compute/voxel/voxcloud_status.rb', line 27

def end_element(name)
  case name
  when "device"
    @response["devices"] << @device
    @device = {}
  when "id", "status"
    @device[name] = value
  when "last_update"
    @device[name] = Time.at(value.to_i)
  end
end

#resetObject



6
7
8
9
# File 'lib/fog/parsers/compute/voxel/voxcloud_status.rb', line 6

def reset
  @response = { "devices" => [] }
  @device = {}
end

#start_element(name, attrs = []) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/parsers/compute/voxel/voxcloud_status.rb', line 11

def start_element(name, attrs = [])
  super

  case name
  when "rsp"
    @response["stat"] = attr_value("stat", attrs)
  when "err"
    @response["err"] = {
      "code"  => attr_value("code", attrs),
      "msg"   => attr_value("msg", attrs)
    }
  when "device"
    @device = {}
  end
end