Sha256: 2425e9aaa04f0e3047cbd410095bdb3e6c7a5e23589dff3d2724839979a04a3b

Contents?: true

Size: 788 Bytes

Versions: 1

Compression:

Stored size: 788 Bytes

Contents

module Transmission
  module Model
    class Session
      class SessionError < StandardError; end

      attr_accessor :attributes

      def initialize(session_object)
        @attributes = session_object
      end

      def version
        @attributes['version'].split(' ').first
      end

      def rpc_version
        @attributes['rpc-version']
      end

      class << self
        def get(options = {})
          rpc = options[:connector] || connector
          session_body = rpc.get_session options
          session_stats_body = rpc.get_session_stats options
          merged_body = session_body.merge(session_stats_body)
          Session.new merged_body
        end

        def connector
          Transmission::Config.get_connector
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
transmission-rpc-ruby-0.1.0 lib/transmission/model/session.rb