class JarvisbotSongfinder::UrlQuery
Responsible for handling URL based requests
UrlQuery.new("https://www.youtube.com/watch?v=QSBco8kVuZM").track.length # => 172
Public Class Methods
new(url, config: JarvisbotSongfinder.configuration)
click to toggle source
# File lib/jarvisbot_songfinder/helpers/url_query.rb, line 8 def initialize(url, config: JarvisbotSongfinder.configuration) @config = config @url = url @provider = select_provider end
Public Instance Methods
track()
click to toggle source
# File lib/jarvisbot_songfinder/helpers/url_query.rb, line 14 def track @provider end
Private Instance Methods
select_provider()
click to toggle source
# File lib/jarvisbot_songfinder/helpers/url_query.rb, line 20 def select_provider provider = Provider.available_providers.find do |p| p::URL_REGEX.match @url end provider.nil? ? UnknownProvider.new : provider.new(@url, config: @config) end