Class: RightAws::AcfInterface::AcfDistributionListParser

Inherits:
RightAWSParser show all
Defined in:
lib/acf/right_acf_interface.rb

Overview


PARSERS:

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

:nodoc:



379
380
381
# File 'lib/acf/right_acf_interface.rb', line 379

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

#tagend(name) ⇒ Object



388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/acf/right_acf_interface.rb', line 388

def tagend(name)
  case name
    when 'Marker'      then @result[:marker]       = @text
    when 'NextMarker'  then @result[:next_marker]  = @text
    when 'MaxItems'    then @result[:max_items]    = @text.to_i
    when 'IsTruncated' then @result[:is_truncated] = @text == 'true' ? true : false
    when 'Id'               then @distribution[:aws_id]             = @text
    when 'Status'           then @distribution[:status]             = @text
    when 'LastModifiedTime' then @distribution[:last_modified_time] = Time.parse(@text)
    when 'DomainName'       then @distribution[:domain_name]        = @text
    when 'Origin'           then @distribution[:origin]             = @text
    when 'Comment'          then @distribution[:comment]            = AcfInterface::unescape(@text)
    when 'CallerReference'  then @distribution[:caller_reference]   = @text
    when 'CNAME'            then @distribution[:cnames]            << @text
    when 'Enabled'          then @distribution[:enabled]            = @text == 'true' ? true : false
    when 'Bucket'           then @distribution[:logging][:bucket]   = @text
    when 'Prefix'           then @distribution[:logging][:prefix]   = @text
  end
  if name == 'DistributionSummary' || name == 'Distribution' ||
    (name == 'DistributionConfig' && @xmlpath.blank?)
    @result[:distributions] << @distribution
  end
end

#tagstart(name, attributes) ⇒ Object



382
383
384
385
386
387
# File 'lib/acf/right_acf_interface.rb', line 382

def tagstart(name, attributes)
  if name == 'DistributionSummary' || name == 'Distribution' ||
    (name == 'DistributionConfig' && @xmlpath.blank?)
    @distribution = { :cnames  => [], :logging => {} }
  end
end