1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
module Fog
module Parsers
module AWS
module Compute
class DescribeSpotPriceHistory < Fog::Parsers::Base
def reset
@spot_price = {}
@response = { 'spotPriceHistorySet' => [] }
end
def end_element(name)
case name
when 'availabilityZone', 'instanceType', 'productDescription'
@spot_price[name] = value
when 'item'
@response['spotPriceHistorySet'] << @spot_price
@spot_price = {}
when 'requestId', 'nextToken'
@response[name] = value
when 'spotPrice'
@spot_price[name] = value.to_f
when 'timestamp'
@spot_price[name] = Time.parse(value)
end
end
end
end
end
end
end
|