Class: QBittorrent::WebApi::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/qbittorrent/web_api/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(is_success, response, message = nil) ⇒ Response

Returns a new instance of Response.



6
7
8
9
10
11
12
13
14
15
# File 'lib/qbittorrent/web_api/response.rb', line 6

def initialize(is_success, response, message = nil)
  @is_success = is_success
  @response = response
  @message = message
  @data = begin
    JSON.parse(response.to_s)
  rescue StandardError => _e
    response.to_s
  end
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



4
5
6
# File 'lib/qbittorrent/web_api/response.rb', line 4

def data
  @data
end

#is_successObject

Returns the value of attribute is_success.



4
5
6
# File 'lib/qbittorrent/web_api/response.rb', line 4

def is_success
  @is_success
end

#messageObject

Returns the value of attribute message.



4
5
6
# File 'lib/qbittorrent/web_api/response.rb', line 4

def message
  @message
end

#responseObject

Returns the value of attribute response.



4
5
6
# File 'lib/qbittorrent/web_api/response.rb', line 4

def response
  @response
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/qbittorrent/web_api/response.rb', line 17

def success?
  is_success
end