Class: Sabnzbd::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/sabnzbd/utils.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Utils

Returns a new instance of Utils.



5
6
7
# File 'lib/sabnzbd/utils.rb', line 5

def initialize (parent)
  @sabnzbd = parent
end

Instance Attribute Details

#sabnzbdObject

Returns the value of attribute sabnzbd.



3
4
5
# File 'lib/sabnzbd/utils.rb', line 3

def sabnzbd
  @sabnzbd
end

Instance Method Details

#slot_positionsObject



9
10
11
12
13
14
15
16
# File 'lib/sabnzbd/utils.rb', line 9

def slot_positions
  return_hash = {}
  sabnzbd.slots(true).each do |s|
    return_hash[s.position] = s.nzo_id
  end

  return_hash
end

#switch(slot_a, slot_b) ⇒ Object



18
19
20
# File 'lib/sabnzbd/utils.rb', line 18

def switch(slot_a, slot_b)
  sabnzbd.make_request("/api?mode=switch&value=#{slot_a.nzo_id}&value2=#{slot_b.nzo_id}&apikey=#{sabnzbd.api_key}")
end