class RMD::NCT::Getter::KeyFromUrl
Constants
- ROOT_URL
Public Instance Methods
fetch()
click to toggle source
# File lib/rmd/nct/getter/key_from_url.rb, line 9 def fetch if key if response['error_message'] == 'Success' @data_link = response['data']['stream_url'] else @errors = "#{response['error_message']}: #{new_link}" end else @errors = "The url does not contain the key." end end
Private Instance Methods
new_link()
click to toggle source
# File lib/rmd/nct/getter/key_from_url.rb, line 34 def new_link "#{ROOT_URL}/#{key}" end
page()
click to toggle source
# File lib/rmd/nct/getter/key_from_url.rb, line 38 def page @page ||= agent.get(new_link) end
response()
click to toggle source
# File lib/rmd/nct/getter/key_from_url.rb, line 23 def response @response ||= JSON.parse(page.body) end
uncached_key()
click to toggle source
# File lib/rmd/nct/getter/key_from_url.rb, line 27 def uncached_key uri = URI.parse(url) if data = /\.(\S+)\./.match(uri.path) data.to_a.last end end