Class: Fog::Compute::ProfitBricks::Share
- Inherits:
-
Models::ProfitBricks::Base
- Object
- Model
- Models::ProfitBricks::Base
- Fog::Compute::ProfitBricks::Share
- Includes:
- Helpers::ProfitBricks::DataHelper
- Defined in:
- lib/fog/profitbricks/models/compute/share.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(attributes = {}) ⇒ Share
constructor
A new instance of Share.
- #save ⇒ Object
- #update ⇒ Object
Methods included from Helpers::ProfitBricks::DataHelper
Methods inherited from Models::ProfitBricks::Base
#failed?, #ready?, #request_status, #wait_for
Constructor Details
#initialize(attributes = {}) ⇒ Share
Returns a new instance of Share.
22 23 24 |
# File 'lib/fog/profitbricks/models/compute/share.rb', line 22 def initialize(attributes = {}) super end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
20 21 22 |
# File 'lib/fog/profitbricks/models/compute/share.rb', line 20 def @options end |
Instance Method Details
#delete ⇒ Object
53 54 55 56 57 |
# File 'lib/fog/profitbricks/models/compute/share.rb', line 53 def delete requires :group_id, :resource_id service.delete_share(group_id, resource_id) true end |
#save ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fog/profitbricks/models/compute/share.rb', line 26 def save requires :group_id, :resource_id = {} [:editPrivilege] = edit_privilege if edit_privilege [:sharePrivilege] = share_privilege if share_privilege data = service.add_share(group_id, resource_id, ).body data['group_id'] = group_id data['resource_id'] = resource_id merge_attributes(flatten(data)) true end |
#update ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fog/profitbricks/models/compute/share.rb', line 41 def update requires :group_id, :resource_id = {} [:editPrivilege] = edit_privilege if [true, false].include?(edit_privilege) [:sharePrivilege] = share_privilege if [true, false].include?(share_privilege) data = service.update_share(group_id, resource_id, ) merge_attributes(flatten(data.body)) true end |