class Gracenote::Response
Attributes
response[R]
Public Class Methods
new(response)
click to toggle source
# File lib/gracenote/response.rb, line 14 def initialize(response) @response = response end
Public Instance Methods
album()
click to toggle source
# File lib/gracenote/response.rb, line 34 def album albums[0] end
albums()
click to toggle source
# File lib/gracenote/response.rb, line 30 def albums ok? ? wrap_array(params["album"]).map { |attrs| Album.new(attrs) } : [] end
body()
click to toggle source
# File lib/gracenote/response.rb, line 18 def body response.body end
error?()
click to toggle source
# File lib/gracenote/response.rb, line 46 def error? body["RESPONSES"]["RESPONSE"]["STATUS"] == "ERROR" end
message()
click to toggle source
# File lib/gracenote/response.rb, line 50 def message error? && body["RESPONSES"]["MESSAGE"] end
no_match?()
click to toggle source
# File lib/gracenote/response.rb, line 42 def no_match? body["RESPONSES"]["RESPONSE"]["STATUS"] == "NO_MATCH" end
ok?()
click to toggle source
# File lib/gracenote/response.rb, line 38 def ok? body["RESPONSES"]["RESPONSE"]["STATUS"] == "OK" end
params()
click to toggle source
# File lib/gracenote/response.rb, line 26 def params recursive_downcase_keys body["RESPONSES"]["RESPONSE"].reject { |k,v| k == "STATUS" } end
range()
click to toggle source
# File lib/gracenote/response.rb, line 22 def range Range.new(range_body) if range_body end
Private Instance Methods
range_body()
click to toggle source
# File lib/gracenote/response.rb, line 56 def range_body recursive_downcase_keys body["RESPONSES"]["RESPONSE"]["RANGE"], numerify_values: true end