Class: LyricsSearch::SearchResults::SearchResult
- Inherits:
-
Object
- Object
- LyricsSearch::SearchResults::SearchResult
- Defined in:
- lib/lyrics_search/search_result.rb
Instance Attribute Summary collapse
-
#artist ⇒ Object
readonly
Returns the value of attribute artist.
-
#lyrics ⇒ Object
readonly
Returns the value of attribute lyrics.
-
#raw_result ⇒ Object
readonly
Returns the value of attribute raw_result.
-
#song ⇒ Object
readonly
Returns the value of attribute song.
Instance Method Summary collapse
- #get_result ⇒ Object
-
#initialize(result) ⇒ SearchResult
constructor
A new instance of SearchResult.
Constructor Details
#initialize(result) ⇒ SearchResult
Returns a new instance of SearchResult.
4 5 6 7 8 9 10 11 |
# File 'lib/lyrics_search/search_result.rb', line 4 def initialize(result) @artist, @song, @lyric_id, @lyric_checksum = result.values_at(:artist, :song, :lyric_id, :lyric_checksum) @raw_result = LyricsSearch::CHARTLYRICS_CLIENT.call(:get_lyric, message: {lyric_id: @lyric_id, lyric_check_sum: @lyric_checksum}). body.dig(:get_lyric_response, :get_lyric_result) @lyrics = @raw_result[:lyric] end |
Instance Attribute Details
#artist ⇒ Object (readonly)
Returns the value of attribute artist.
2 3 4 |
# File 'lib/lyrics_search/search_result.rb', line 2 def artist @artist end |
#lyrics ⇒ Object (readonly)
Returns the value of attribute lyrics.
2 3 4 |
# File 'lib/lyrics_search/search_result.rb', line 2 def lyrics @lyrics end |
#raw_result ⇒ Object (readonly)
Returns the value of attribute raw_result.
2 3 4 |
# File 'lib/lyrics_search/search_result.rb', line 2 def raw_result @raw_result end |
#song ⇒ Object (readonly)
Returns the value of attribute song.
2 3 4 |
# File 'lib/lyrics_search/search_result.rb', line 2 def song @song end |
Instance Method Details
#get_result ⇒ Object
13 14 15 |
# File 'lib/lyrics_search/search_result.rb', line 13 def get_result {artist: artist, song: song, lyrics: lyrics} end |