Class: JarvisbotSongfinder::Provider
- Inherits:
-
Object
- Object
- JarvisbotSongfinder::Provider
show all
- Defined in:
- lib/jarvisbot_songfinder/providers/provider.rb
Overview
Abstract class for concrete providers to inherit from (Template Method Pattern)
Class Attribute Summary collapse
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(config: JarvisbotSongfinder.configuration) ⇒ Provider
Returns a new instance of Provider.
12
13
14
15
|
# File 'lib/jarvisbot_songfinder/providers/provider.rb', line 12
def initialize(config: JarvisbotSongfinder.configuration)
@config = config
@errors = []
end
|
Class Attribute Details
.available_providers ⇒ Object
Returns the value of attribute available_providers.
8
9
10
|
# File 'lib/jarvisbot_songfinder/providers/provider.rb', line 8
def available_providers
@available_providers
end
|
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
11
12
13
|
# File 'lib/jarvisbot_songfinder/providers/provider.rb', line 11
def errors
@errors
end
|
Instance Method Details
#artist ⇒ Object
25
26
27
|
# File 'lib/jarvisbot_songfinder/providers/provider.rb', line 25
def artist
raise NotImplementedError
end
|
#explicit? ⇒ Boolean
43
44
45
|
# File 'lib/jarvisbot_songfinder/providers/provider.rb', line 43
def explicit?
raise NotImplementedError
end
|
#length ⇒ Object
17
18
19
|
# File 'lib/jarvisbot_songfinder/providers/provider.rb', line 17
def length
raise NotImplementedError
end
|
#provider ⇒ Object
29
30
31
|
# File 'lib/jarvisbot_songfinder/providers/provider.rb', line 29
def provider
raise NotImplementedError
end
|
#title ⇒ Object
21
22
23
|
# File 'lib/jarvisbot_songfinder/providers/provider.rb', line 21
def title
raise NotImplementedError
end
|
#url ⇒ Object
39
40
41
|
# File 'lib/jarvisbot_songfinder/providers/provider.rb', line 39
def url
raise NotImplementedError
end
|
#valid? ⇒ Boolean
33
34
35
36
37
|
# File 'lib/jarvisbot_songfinder/providers/provider.rb', line 33
def valid?
return false if @errors.any?
available_in_region? && length_valid? && in_music_category?
end
|