Class: DBus::Systemd::Importd::Manager
- Inherits:
-
Object
- Object
- DBus::Systemd::Importd::Manager
- Includes:
- Mixin::MethodMissing, Mixin::Properties
- Defined in:
- lib/dbus/systemd/importd/manager.rb
Constant Summary collapse
- NODE =
'/org/freedesktop/import1'- INTERFACE =
'org.freedesktop.import1.Manager'- TRANSFER_INDICES =
{ id: 0, operation: 1, remote_file: 2, image_name: 3, progress: 4, object_path: 5 }
Instance Attribute Summary collapse
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Attributes included from Mixin::MethodMissing
Instance Method Summary collapse
- #get_transfer_by_path(path) ⇒ Object
-
#initialize(bus = Systemd::Helpers.system_bus) ⇒ Manager
constructor
A new instance of Manager.
- #map_transfer(transfer_array) ⇒ Object
- #transfer(id) ⇒ Object
- #transfers ⇒ Object
Methods included from Mixin::Properties
Methods included from Mixin::MethodMissing
#method_missing, #respond_to_missing?
Constructor Details
#initialize(bus = Systemd::Helpers.system_bus) ⇒ Manager
Returns a new instance of Manager.
28 29 30 31 32 |
# File 'lib/dbus/systemd/importd/manager.rb', line 28 def initialize(bus = Systemd::Helpers.system_bus) @service = bus.service(Importd::INTERFACE) @object = @service.object(NODE) .tap(&:introspect) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class DBus::Systemd::Mixin::MethodMissing
Instance Attribute Details
#service ⇒ Object (readonly)
Returns the value of attribute service.
26 27 28 |
# File 'lib/dbus/systemd/importd/manager.rb', line 26 def service @service end |
Instance Method Details
#get_transfer_by_path(path) ⇒ Object
42 43 44 45 46 |
# File 'lib/dbus/systemd/importd/manager.rb', line 42 def get_transfer_by_path(path) obj = @service.object(path) .tap(&:introspect) Transfer.new(obj.Get(Transfer::INTERFACE, 'Id').first, self) end |
#map_transfer(transfer_array) ⇒ Object
48 49 50 |
# File 'lib/dbus/systemd/importd/manager.rb', line 48 def map_transfer(transfer_array) Systemd::Helpers.map_array(transfer_array, TRANSFER_INDICES) end |
#transfer(id) ⇒ Object
38 39 40 |
# File 'lib/dbus/systemd/importd/manager.rb', line 38 def transfer(id) Transfer.new(id, self) end |
#transfers ⇒ Object
34 35 36 |
# File 'lib/dbus/systemd/importd/manager.rb', line 34 def transfers self.ListTransfers.first.map { |t| map_transfer(t) } end |