Class: Enklawa::Api::Request
- Inherits:
-
Object
- Object
- Enklawa::Api::Request
- Defined in:
- lib/enklawa/api/request.rb
Instance Method Summary collapse
- #get! ⇒ Object
-
#initialize(url) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(url) ⇒ Request
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/enklawa/api/request.rb', line 7 def initialize(url) @info_xml_url = File.join([url, "info.xml"]) @main_page_url = url @cache_key = url.gsub(/[^a-z]/i,"") + ".yml" @cache = YAML::load_file(@cache_key) if File.exists?(@cache_key) @cache ||= { 'images' => {}, 'durations' => {} } end |
Instance Method Details
#get! ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/enklawa/api/request.rb', line 18 def get! @response = Response.new get_info! get_programs! get_episodes! File.open(@cache_key, 'w') {|f| f.write @cache.to_yaml } @response end |