Class: Sabnzbd::Utils
- Inherits:
-
Object
- Object
- Sabnzbd::Utils
- Defined in:
- lib/sabnzbd/utils.rb
Instance Attribute Summary collapse
-
#sabnzbd ⇒ Object
Returns the value of attribute sabnzbd.
Instance Method Summary collapse
-
#initialize(parent) ⇒ Utils
constructor
A new instance of Utils.
- #slot_positions ⇒ Object
- #switch(slot_a, slot_b) ⇒ Object
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
#sabnzbd ⇒ Object
Returns the value of attribute sabnzbd.
3 4 5 |
# File 'lib/sabnzbd/utils.rb', line 3 def sabnzbd @sabnzbd end |
Instance Method Details
#slot_positions ⇒ Object
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 |