Class: Purest::Host
- Inherits:
-
APIMethods
- Object
- Rest
- APIMethods
- Purest::Host
- Defined in:
- lib/purest/host.rb
Constant Summary collapse
- GET_PARAMS =
%i[action all chap connect names personality private protect shared space].freeze
Instance Method Summary collapse
- #create(options = nil) ⇒ Object
- #delete(options = nil) ⇒ Object
-
#get(options = nil) ⇒ Object
Get a list of hosts, GET.
- #update(options = nil) ⇒ Object
Methods inherited from APIMethods
Methods inherited from Rest
access_method?, #authenticated?, #concat_url, #initialize, #logout, method_missing, #use_named_parameter
Constructor Details
This class inherits a constructor from Purest::Rest
Instance Method Details
#create(options = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/purest/host.rb', line 16 def create( = nil) # The API doesn't accept some of these options in the HTTP body # during a POST, so we remove them from the options hash after # creating a path to append to the base URL in APIMethods.create if [:name] && [:volume] appended_path = "#{.delete(:name)}/volume/#{.delete(:volume)}" elsif [:name] && [:protection_group] appended_path = "#{.delete(:name)}/pgroup/#{.delete(:protection_group)}" end super(, 'host', appended_path) end |
#delete(options = nil) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/purest/host.rb', line 32 def delete( = nil) if [:name] && [:volume] appended_path = "#{.delete(:name)}/volume/#{.delete(:volume)}" elsif [:name] && [:protection_group] appended_path = "#{.delete(:name)}/pgroup/#{.delete(:protection_group)}" end super(, 'host', appended_path) end |
#get(options = nil) ⇒ Object
Get a list of hosts, GET
12 13 14 |
# File 'lib/purest/host.rb', line 12 def get( = nil) super(, 'host', GET_PARAMS, [:show_volume]) end |
#update(options = nil) ⇒ Object
28 29 30 |
# File 'lib/purest/host.rb', line 28 def update( = nil) super(, 'host') end |