Class: RightAws::Ec2::QEc2DescribeReservedInstancesOfferingsParser

Inherits:
RightAWSParser
  • Object
show all
Defined in:
lib/ec2/right_ec2_reserved_instances.rb

Overview

:nodoc:

Constant Summary

Constants inherited from RightAWSParser

RightAWSParser::DEFAULT_XML_LIBRARY

Instance Attribute Summary

Attributes inherited from RightAWSParser

#full_tag_name, #result, #tag, #xml_lib, #xmlpath

Instance Method Summary collapse

Methods inherited from RightAWSParser

#initialize, #method_missing, #parse, #tag_end, #tag_start, #tagtext, #text, xml_lib, xml_lib=

Constructor Details

This class inherits a constructor from RightAws::RightAWSParser

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RightAws::RightAWSParser

Instance Method Details

#resetObject



225
226
227
# File 'lib/ec2/right_ec2_reserved_instances.rb', line 225

def reset
  @result = { :items => [] }
end

#tagend(name) ⇒ Object



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/ec2/right_ec2_reserved_instances.rb', line 199

def tagend(name)
  case name
  when 'nextToken'                   then @result[:next_token]            = @text
  when 'reservedInstancesOfferingId' then @item[:aws_id]                  = @text
  when 'instanceType'                then @item[:aws_instance_type]       = @text
  when 'availabilityZone'            then @item[:aws_availability_zone]   = @text
  when 'duration'                    then @item[:aws_duration]            = @text.to_i
  when 'usagePrice'                  then @item[:aws_usage_price]         = @text.to_f
  when 'fixedPrice'                  then @item[:aws_fixed_price]         = @text.to_f
  when 'instanceTenancy'             then @item[:instance_tenancy]        = @text
  when 'currencyCode'                then @item[:currency_code]           = @text
  when 'productDescription'          then @item[:aws_product_description] = @text
  when 'offeringType'                then @item[:offering_type]           = @text
  when 'marketplace'                 then @item[:marketplace]             = (@text == 'true')
  else
    case full_tag_name
    when %r{/recurringCharges/item/frequency$}    then @recurring_charge[:frequency]  = @text
    when %r{/recurringCharges/item/amount$}       then @recurring_charge[:amount]     = @text
    when %r{/recurringCharges/item$}              then (@item[:recurring_charges]   ||= []) << @recurring_charge
    when %r{/pricingDetailsSet/item/price$}       then @pricing_details[:price]       = @text
    when %r{/pricingDetailsSet/item/count$}       then @pricing_details[:count]       = @text
    when %r{/pricingDetailsSet/item$}             then (@item[:pricing_details_set] ||= []) << @pricing_details
    when %r{/reservedInstancesOfferingsSet/item$} then @result[:items] << @item
    end
  end
end

#tagstart(name, attributes) ⇒ Object



192
193
194
195
196
197
198
# File 'lib/ec2/right_ec2_reserved_instances.rb', line 192

def tagstart(name, attributes)
  case full_tag_name
  when %r{/pricingDetailsSet/item$}             then @pricing_details  = {}
  when %r{/recurringCharges/item$}              then @recurring_charge = {}
  when %r{/reservedInstancesOfferingsSet/item$} then @item             = {}
  end
end