Class: Fog::Parsers::AWS::AutoScaling::DescribeMetricCollectionTypes

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

Instance Attribute Summary

Attributes inherited from Base

#response

Instance Method Summary collapse

Methods inherited from Base

#attr_value, #characters, #end_element_namespace, #initialize, #start_element_namespace, #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
# File 'lib/fog/aws/parsers/auto_scaling/describe_metric_collection_types.rb', line 33

def end_element(name)
  case name
  when 'member'
    if @in_granularities
      @results['Granularities'] << @granularity
      reset_granularity
    elsif @in_metrics
      @results['Metrics'] << @metric
      reset_metric
    end

  when 'Granularity'
     @granularity[name] = value
  when 'Granularities'
     @in_granularities = false

  when 'Metric'
     @metric[name] = value
  when 'Metrics'
     @in_metrics = false

  when 'RequestId'
    @response['ResponseMetadata'][name] = value

  when 'DescribeMetricCollectionTypesResult'
    @response[name] = @results
  end
end

#resetObject



8
9
10
11
12
13
# File 'lib/fog/aws/parsers/auto_scaling/describe_metric_collection_types.rb', line 8

def reset
  reset_granularity
  reset_metric
  @results = { 'Granularities' => [], 'Metrics' => [] }
  @response = { 'DescribeMetricCollectionTypesResult' => {}, 'ResponseMetadata' => {} }
end

#reset_granularityObject



14
15
16
# File 'lib/fog/aws/parsers/auto_scaling/describe_metric_collection_types.rb', line 14

def reset_granularity
  @granularity = {}
end

#reset_metricObject



18
19
20
# File 'lib/fog/aws/parsers/auto_scaling/describe_metric_collection_types.rb', line 18

def reset_metric
  @metric = {}
end

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



22
23
24
25
26
27
28
29
30
31
# File 'lib/fog/aws/parsers/auto_scaling/describe_metric_collection_types.rb', line 22

def start_element(name, attrs = [])
  super

  case name
  when 'Granularities'
    @in_granularities = true
  when 'Metrics'
    @in_metrics = true
  end
end