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

Inherits:
Base
  • Object
show all
Defined in:
lib/rackspace-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, #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
# File 'lib/rackspace-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/rackspace-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



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

def reset_granularity
    @granularity = {}
end

#reset_metricObject



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

def reset_metric
    @metric = {}
end

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



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

def start_element(name, attrs = [])
  super
  case name
  when 'Granularities'
    @in_granularities = true
  when 'Metrics'
    @in_metrics = true
  end
end