Class: KodiClient::KodiResponse

Inherits:
Object
  • Object
show all
Includes:
Extensions::Comparable
Defined in:
lib/kodi_client/kodi_response.rb

Overview

represents a kodi response

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Extensions::Comparable

#==, #compare

Constructor Details

#initialize(hash) ⇒ KodiResponse

Returns a new instance of KodiResponse.



10
11
12
13
14
15
# File 'lib/kodi_client/kodi_response.rb', line 10

def initialize(hash)
  @id = hash['id']
  @jsonrpc = hash['jsonrpc']
  @result = hash['result']
  @error = KodiError.new(hash['error']) unless hash['error'].nil?
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



8
9
10
# File 'lib/kodi_client/kodi_response.rb', line 8

def error
  @error
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/kodi_client/kodi_response.rb', line 8

def id
  @id
end

#jsonrpcObject (readonly)

Returns the value of attribute jsonrpc.



8
9
10
# File 'lib/kodi_client/kodi_response.rb', line 8

def jsonrpc
  @jsonrpc
end

#resultObject (readonly)

Returns the value of attribute result.



8
9
10
# File 'lib/kodi_client/kodi_response.rb', line 8

def result
  @result
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/kodi_client/kodi_response.rb', line 17

def error?
  !@error.nil?
end