Class: Transmission::Model::SessionStats

Inherits:
Object
  • Object
show all
Defined in:
lib/transmission/model/session_stats.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session_object, connector) ⇒ SessionStats

Returns a new instance of SessionStats.



7
8
9
10
# File 'lib/transmission/model/session_stats.rb', line 7

def initialize(session_object, connector)
  @attributes = session_object
  @connector = connector
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



5
6
7
# File 'lib/transmission/model/session_stats.rb', line 5

def attributes
  @attributes
end

#connectorObject

Returns the value of attribute connector.



5
6
7
# File 'lib/transmission/model/session_stats.rb', line 5

def connector
  @connector
end

Class Method Details

.connectorObject



23
24
25
# File 'lib/transmission/model/session_stats.rb', line 23

def connector
  Transmission::Config.get_connector
end

.get(options = {}) ⇒ Object



17
18
19
20
21
# File 'lib/transmission/model/session_stats.rb', line 17

def get(options = {})
  rpc = options[:connector] || connector
  body = rpc.get_session_stats options[:fields]
  SessionStats.new body, rpc
end

Instance Method Details

#to_jsonObject



12
13
14
# File 'lib/transmission/model/session_stats.rb', line 12

def to_json
  @attributes
end