Class: FanartTv::Configuration
- Inherits:
-
Object
- Object
- FanartTv::Configuration
- Defined in:
- lib/fanart_tv/configuration.rb
Constant Summary collapse
- DEFAULT_QUERY_INTERVAL =
1.5
- DEFAULT_TRIES_LIMIT =
5
- DEFAULT_CACHE_PATH =
File.join(File.dirname(__FILE__), "..", "tmp", "cache")
- DEFAULT_PERFORM_CACHING =
false
- DEFAULT_WEBSERVICE_URL_ARTIST =
"http://api.fanart.tv/webservice/artist/%{api_key}/%{musicbrainz_id}/JSON/%{type}/%{sort}/%{limit}/"
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#app_version ⇒ Object
Returns the value of attribute app_version.
-
#cache_path ⇒ Object
Returns the value of attribute cache_path.
-
#contact ⇒ Object
Returns the value of attribute contact.
-
#perform_caching ⇒ Object
Returns the value of attribute perform_caching.
-
#query_interval ⇒ Object
Returns the value of attribute query_interval.
-
#tries_limit ⇒ Object
Returns the value of attribute tries_limit.
-
#webservice_url_artist ⇒ Object
Returns the value of attribute webservice_url_artist.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #user_agent_string ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 18 19 20 |
# File 'lib/fanart_tv/configuration.rb', line 14 def initialize @webservice_url_artist = DEFAULT_WEBSERVICE_URL_ARTIST @query_interval = DEFAULT_QUERY_INTERVAL @tries_limit = DEFAULT_TRIES_LIMIT @cache_path = DEFAULT_CACHE_PATH @perform_caching = DEFAULT_PERFORM_CACHING end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/fanart_tv/configuration.rb', line 3 def api_key @api_key end |
#app_name ⇒ Object
Returns the value of attribute app_name.
3 4 5 |
# File 'lib/fanart_tv/configuration.rb', line 3 def app_name @app_name end |
#app_version ⇒ Object
Returns the value of attribute app_version.
3 4 5 |
# File 'lib/fanart_tv/configuration.rb', line 3 def app_version @app_version end |
#cache_path ⇒ Object
Returns the value of attribute cache_path.
3 4 5 |
# File 'lib/fanart_tv/configuration.rb', line 3 def cache_path @cache_path end |
#contact ⇒ Object
Returns the value of attribute contact.
3 4 5 |
# File 'lib/fanart_tv/configuration.rb', line 3 def contact @contact end |
#perform_caching ⇒ Object
Returns the value of attribute perform_caching.
3 4 5 |
# File 'lib/fanart_tv/configuration.rb', line 3 def perform_caching @perform_caching end |
#query_interval ⇒ Object
Returns the value of attribute query_interval.
3 4 5 |
# File 'lib/fanart_tv/configuration.rb', line 3 def query_interval @query_interval end |
#tries_limit ⇒ Object
Returns the value of attribute tries_limit.
3 4 5 |
# File 'lib/fanart_tv/configuration.rb', line 3 def tries_limit @tries_limit end |
#webservice_url_artist ⇒ Object
Returns the value of attribute webservice_url_artist.
3 4 5 |
# File 'lib/fanart_tv/configuration.rb', line 3 def webservice_url_artist @webservice_url_artist end |
Instance Method Details
#user_agent_string ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/fanart_tv/configuration.rb', line 27 def user_agent_string %w[ app_name app_version contact ].each do |param| raise "#{param} must be set" if instance_variable_get("@#{param}").nil? end "#{@app_name}/#{@app_version} ( #{@contact} )" end |