class Mopidy::Response

Public Class Methods

new(response) click to toggle source
# File lib/mopidy/response.rb, line 3
def initialize(response)
  @response = response
end

Public Instance Methods

body() click to toggle source
# File lib/mopidy/response.rb, line 11
def body
  has_error?(@response) ? parse_error(@response) : parse_response(@response)
end
status() click to toggle source
# File lib/mopidy/response.rb, line 7
def status
  @response.code
end

Private Instance Methods

has_error?(response) click to toggle source
# File lib/mopidy/response.rb, line 17
def has_error?(response)
  response.parsed_response['result'].nil?
end
parse_error(response) click to toggle source
# File lib/mopidy/response.rb, line 25
def parse_error(response)
  response.parsed_response['error']
end
parse_response(response) click to toggle source
# File lib/mopidy/response.rb, line 21
def parse_response(response)
  response.parsed_response['result']
end