Class: Pagelime::Clients::XmlS3Storage

Inherits:
Object
  • Object
show all
Defined in:
lib/pagelime/clients/xml_s3_storage.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ XmlS3Storage

Returns a new instance of XmlS3Storage.



8
9
10
11
12
13
14
# File 'lib/pagelime/clients/xml_s3_storage.rb', line 8

def initialize(options = {})
  @options = {
    :account_key    => ENV['PAGELIME_ACCOUNT_KEY'],
    :account_secret => ENV['PAGELIME_ACCOUNT_SECRET'],
    :api_version    => ENV['PAGELIME_RACK_API_VERSION']
  }.merge(options)
end

Instance Method Details

#fetch_path(page_path) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/pagelime/clients/xml_s3_storage.rb', line 27

def fetch_path(page_path)
  
  Pagelime.logger.debug "PAGELIME CMS RACK PLUGIN: NO '#{page_path}' CACHE... loading XML"
  
  content = request_content("/cms_assets/heroku/#{@options[:account_key]}/pages#{page_path}.xml")
  
  Pagelime.logger.debug "PAGELIME CMS RACK PLUGIN: Content: #{content.inspect}"
  
  content
end

#fetch_sharedObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/pagelime/clients/xml_s3_storage.rb', line 16

def fetch_shared

  Pagelime.logger.debug "PAGELIME CMS RACK PLUGIN: NO SHARED CACHE... loading XML"
  
  content = request_content("/cms_assets/heroku/#{@options[:account_key]}/shared-regions.xml")
  
  Pagelime.logger.debug "PAGELIME CMS RACK PLUGIN: Shared content: #{content.inspect}"
  
  content
end