Class: RMC::BackupSystems
- Inherits:
-
Object
- Object
- RMC::BackupSystems
- Defined in:
- lib/rmc/backup_systems.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #create_system(data) ⇒ Object
- #get_system(id) ⇒ Object
-
#initialize(connection) ⇒ BackupSystems
constructor
A new instance of BackupSystems.
- #list_systems ⇒ Object
Constructor Details
#initialize(connection) ⇒ BackupSystems
Returns a new instance of BackupSystems.
7 8 9 |
# File 'lib/rmc/backup_systems.rb', line 7 def initialize(connection) @connection = connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
5 6 7 |
# File 'lib/rmc/backup_systems.rb', line 5 def connection @connection end |
Instance Method Details
#create_system(data) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rmc/backup_systems.rb', line 32 def create_system(data) response = @connection.request( url: "/backup-systems", method: :post, payload: { backupSystem: data } ) get_system(response['backupSystem']['id']) end |
#get_system(id) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/rmc/backup_systems.rb', line 24 def get_system(id) response = @connection.request( url: "/backup-systems/#{id}", ) RMC::Item::BackupSystem.new(@connection, response['backupSystem']) end |
#list_systems ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rmc/backup_systems.rb', line 11 def list_systems response = @connection.request( url: "/backup-systems", ) backup_systems = [] response['backupSystems'].each do |_data| backup_systems << RMC::Item::BackupSystem.new(@connection, _data) end backup_systems end |