Class: Discogs::Search
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#exactresult_size ⇒ Object
size of exact search phrase matches.
-
#exactresults ⇒ Object
results that match the search phrase exactly.
-
#result_size ⇒ Object
size of fuzzy matches.
-
#results ⇒ Object
fuzzy results.
-
#search_type ⇒ Object
Returns the value of attribute search_type.
Attributes inherited from Base
#api_key, #request_string, #request_type
Instance Method Summary collapse
-
#best_match ⇒ Object
use the exact results to get more data using another api call based on the result type.
-
#initialize(request_string) ⇒ Search
constructor
A new instance of Search.
Methods inherited from Base
Constructor Details
#initialize(request_string) ⇒ Search
Returns a new instance of Search.
10 11 12 13 14 |
# File 'lib/search.rb', line 10 def initialize(request_string) @request_string = request_string @search_type = 'all' # search_type doesn't seem to make any difference as of API v 1.0 super end |
Instance Attribute Details
#exactresult_size ⇒ Object
size of exact search phrase matches
17 18 19 |
# File 'lib/search.rb', line 17 def exactresult_size @exactresult_size end |
#exactresults ⇒ Object
results that match the search phrase exactly
27 28 29 |
# File 'lib/search.rb', line 27 def exactresults @exactresults end |
#result_size ⇒ Object
size of fuzzy matches
22 23 24 |
# File 'lib/search.rb', line 22 def result_size @result_size end |
#results ⇒ Object
fuzzy results
39 40 41 |
# File 'lib/search.rb', line 39 def results @results end |
#search_type ⇒ Object
Returns the value of attribute search_type.
4 5 6 |
# File 'lib/search.rb', line 4 def search_type @search_type end |
Instance Method Details
#best_match ⇒ Object
use the exact results to get more data using another api call based on the result type
52 53 54 55 56 57 58 |
# File 'lib/search.rb', line 52 def best_match first_result = exactresults.first if first_result.artist? artist = Discogs::Artist.new(api_key, first_result.title) artist.releases[0,5] end end |