Class: Fog::Parsers::AWS::Compute::DescribeInstanceStatus
- Inherits:
-
Base
- Object
- Base
- Fog::Parsers::AWS::Compute::DescribeInstanceStatus
- Defined in:
- lib/fog/aws/parsers/compute/describe_instance_status.rb
Instance Method Summary collapse
- #end_element(name) ⇒ Object
- #new_instance! ⇒ Object
- #new_item! ⇒ Object
- #reset ⇒ Object
- #start_element(name, attrs = []) ⇒ Object
Instance Method Details
#end_element(name) ⇒ Object
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 66 67 68 |
# File 'lib/fog/aws/parsers/compute/describe_instance_status.rb', line 39 def end_element(name) case name #Simple closers when 'instanceId', 'availabilityZone' @instance[name] = value when 'nextToken', 'requestId' @response[name] = value when 'systemStatus', 'instanceState', 'instanceStatus', 'eventsSet' @inside = nil when 'item' case @inside when :eventsSet @instance['eventsSet'] << @item when :systemStatus, :instanceStatus @instance[@inside.to_s]['details'] << @item when nil @response['instanceStatusSet'] << @instance end @item = nil when 'code' case @inside when :eventsSet @item[name] = value when :instanceState @instance[@inside.to_s][name] = value.to_i end when 'description', 'notBefore', 'notAfter', 'name', 'status' @item.nil? ? (@instance[@inside.to_s][name] = value) : (@item[name] = value) end end |
#new_instance! ⇒ Object
6 7 8 |
# File 'lib/fog/aws/parsers/compute/describe_instance_status.rb', line 6 def new_instance! @instance = { 'instanceState' => {}, 'systemStatus' => { 'details' => [] }, 'instanceStatus' => { 'details' => [] }, 'eventsSet' => [] } end |
#new_item! ⇒ Object
10 11 12 |
# File 'lib/fog/aws/parsers/compute/describe_instance_status.rb', line 10 def new_item! @item = {} end |
#reset ⇒ Object
14 15 16 17 |
# File 'lib/fog/aws/parsers/compute/describe_instance_status.rb', line 14 def reset @response = { 'instanceStatusSet' => [] } @inside = nil end |
#start_element(name, attrs = []) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fog/aws/parsers/compute/describe_instance_status.rb', line 19 def start_element(name, attrs=[]) super case name when 'item' if @inside new_item! else new_instance! end when 'systemStatus' @inside = :systemStatus when 'instanceState' @inside = :instanceState when 'instanceStatus' @inside = :instanceStatus when 'eventsSet' @inside = :eventsSet end end |