Class: SabnzbdPlusModel::Mapper
- Inherits:
-
Object
- Object
- SabnzbdPlusModel::Mapper
- Defined in:
- lib/sabnzbd_plus/model/mapper.rb
Overview
Map API calls into useful data getting methods, that return objects
Instance Method Summary (collapse)
-
- (SabnzbdPlusModel::Queue) current_queue
Get the current items in the queue.
-
- (SabnzbdPlusModel::History) history
Get the current items in the history.
-
- (Mapper) initialize(api = SabnzbdPlusModelApi::Api.new)
constructor
Set the API.
Constructor Details
- (Mapper) initialize(api = SabnzbdPlusModelApi::Api.new)
Set the API
17 18 19 |
# File 'lib/sabnzbd_plus/model/mapper.rb', line 17 def initialize(api = SabnzbdPlusModelApi::Api.new) @api = api end |
Instance Method Details
- (SabnzbdPlusModel::Queue) current_queue
Get the current items in the queue
24 25 26 27 |
# File 'lib/sabnzbd_plus/model/mapper.rb', line 24 def current_queue query = @api.queue return Queue.from_hash(query["queue"]) end |
- (SabnzbdPlusModel::History) history
Get the current items in the history
32 33 34 35 |
# File 'lib/sabnzbd_plus/model/mapper.rb', line 32 def history query = @api.history return History.from_hash(query["history"]) end |