Class: Morpheus::ReadInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::ReadInterface
- Defined in:
- lib/morpheus/api/read_interface.rb
Overview
Interface class to be subclassed by interfaces that are read-only and only provide list() and get() methods, not full CRUD Subclasses must override the base_path method
Direct Known Subclasses
AuditInterface, BackupServiceTypesInterface, BackupTypesInterface, CredentialTypesInterface, IntegrationTypesInterface, InvoiceLineItemsInterface, LoadBalancerTypesInterface, NetworkPoolServerTypesInterface, NetworkSecurityServerTypesInterface, NetworkServerTypesInterface, SecurityPackageTypesInterface, StorageServerTypesInterface, StorageVolumeTypesInterface, VdiAllocationsInterface
Instance Method Summary collapse
-
#base_path ⇒ Object
subclasses should override in your interface Example: "/api/things".
- #get(id, params = {}, headers = {}) ⇒ Object
- #list(params = {}, headers = {}) ⇒ Object
Instance Method Details
#base_path ⇒ Object
subclasses should override in your interface Example: "/api/things"
10 11 12 13 |
# File 'lib/morpheus/api/read_interface.rb', line 10 def base_path raise "#{self.class} has not defined base_path!" if @options[:base_path].nil? @options[:base_path] end |
#get(id, params = {}, headers = {}) ⇒ Object
19 20 21 22 |
# File 'lib/morpheus/api/read_interface.rb', line 19 def get(id, params={}, headers={}) validate_id!(id) execute(method: :get, url: "#{base_path}/#{CGI::escape(id.to_s)}", params: params, headers: headers) end |
#list(params = {}, headers = {}) ⇒ Object
15 16 17 |
# File 'lib/morpheus/api/read_interface.rb', line 15 def list(params={}, headers={}) execute(method: :get, url: "#{base_path}", params: params, headers: headers) end |