Class: MusixMatch::API::Feedback

Inherits:
Base
  • Object
show all
Defined in:
lib/musix_match/api/feedback.rb

Defined Under Namespace

Classes: InvalidFeedbackTypeException

Constant Summary collapse

VALID_TYPES =
%w(wrong_attribution bad_characters lines_too_long wrong_verses wrong_formatting)

Constants inherited from Base

Base::API_URL

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#api_key, api_key, api_key=, get, #get, perform_get_request, url_for, url_path_for

Class Method Details

.post_feedback(track_id, lyrics_id, feedback) ⇒ Object



14
15
16
# File 'lib/musix_match/api/feedback.rb', line 14

def self.post_feedback(track_id, lyrics_id, feedback)
  Feedback.new.post_feedback(track_id, lyrics_id, feedback)
end

Instance Method Details

#post_feedback(track_id, lyrics_id, feedback) ⇒ Object



8
9
10
11
12
# File 'lib/musix_match/api/feedback.rb', line 8

def post_feedback(track_id, lyrics_id, feedback)
  raise InvalidFeedbackTypeException.new("Invalid feedback type. Try one of the following: #{VALID_TYPES.join(", ")}") unless VALID_TYPES.include?(feedback.to_s)
  response = get('track.lyrics.feedback.post', {:track_id => track_id, :lyrics_id => lyrics_id, :feedback => feedback})
  FeedbackResult.new(response)
end