Class: AkamaiApi::ECCUParser

Inherits:
Object
  • Object
show all
Defined in:
lib/akamai_api/eccu_parser.rb

Overview

The ECCUParser class is used to create a XML request file starting from a url

Examples:

AkamaiApi::ECCUParser.new(foo/bar/*.png).xml

Constant Summary collapse

PLACEHOLDER =
"{YIELD}"
NOT_ALLOWED_EXTENSIONS =
%w[*]
NOT_ALLOWED_DIRS =
%w[. ..]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expression, revalidate_on = 'now') ⇒ ECCUParser

Returns a new instance of ECCUParser.



16
17
18
19
20
21
22
23
# File 'lib/akamai_api/eccu_parser.rb', line 16

def initialize expression, revalidate_on = 'now'
  raise "Expression can't be empty" if expression.empty?
  revalidate_on = revalidate_on.to_i if revalidate_on != 'now'
  @tokenizer = ECCU::Tokenizer.new expression
  @revalidate_on = revalidate_on
  @xml = "<?xml version=\"1.0\"?>\n<eccu>#{PLACEHOLDER}</eccu>"
  parse
end

Instance Attribute Details

#revalidate_onObject (readonly)

Returns the value of attribute revalidate_on.



14
15
16
# File 'lib/akamai_api/eccu_parser.rb', line 14

def revalidate_on
  @revalidate_on
end

#tokenizerObject (readonly)

Returns the value of attribute tokenizer.



14
15
16
# File 'lib/akamai_api/eccu_parser.rb', line 14

def tokenizer
  @tokenizer
end

#xmlObject (readonly)

Returns the value of attribute xml.



14
15
16
# File 'lib/akamai_api/eccu_parser.rb', line 14

def xml
  @xml
end