Class: Fog::Parsers::Compute::AWS::DescribeVolumeStatus

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

Instance Attribute Summary

Attributes inherited from Base

#response

Instance Method Summary collapse

Methods inherited from Base

#attr_value, #characters, #initialize, #value

Constructor Details

This class inherits a constructor from Fog::Parsers::Base

Instance Method Details

#end_element(name) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fog/aws/parsers/compute/describe_volume_status.rb', line 33

def end_element(name)
  case name
  #Simple closers
  when 'details'
    @inside = nil
  when 'volumeStatus'
    @inside = nil
  when 'eventSet'
    @inside = nil
  when 'actionSet'
    @inside = nil
  when 'item'
    @response['volumeStatusSet'] << @volume if @inside.nil?
  #Top level
  when 'nextToken', 'requestId'
    @response[name] = value
  # Volume Stuff
  when 'volumeId', 'availabilityZone'
    @volume[name] = value
  #The mess...
  when 'name', 'status'
    case @inside
    when :details
      @volume['volumeStatus']['details'] << {name => value }
    when :volume_status
      @volume['volumeStatus'][name] = value
    end
  when 'code', 'eventId', 'eventType', 'description'
    @volume["#{@inside}Set"][name] = value.strip
  when 'notAfter', 'notBefore'
    @volume["#{@inside}Set"][name] = Time.parse(value)
  end
end

#new_volumeObject



7
8
9
# File 'lib/fog/aws/parsers/compute/describe_volume_status.rb', line 7

def new_volume
  @volume = { 'volumeStatus' => { 'details' => [] }, 'eventSet' => {}, 'actionSet' => {} }
end

#resetObject



11
12
13
14
15
# File 'lib/fog/aws/parsers/compute/describe_volume_status.rb', line 11

def reset
  @volume_status = {}
  @response = { 'volumeStatusSet' => [] }
  @inside = nil
end

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



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fog/aws/parsers/compute/describe_volume_status.rb', line 17

def start_element(name, attrs=[])
  super
  case name
  when 'item'
    new_volume if @inside.nil?
  when 'volumeStatus'
    @inside = :volume_status
  when 'details'
    @inside = :details
  when 'eventSet'
    @inside = :event
  when 'actionSet'
    @inside = :action
  end
end