class ProfitBricks::Share

Share class

Public Class Methods

create(group_id, resource_id, options = {}) click to toggle source

Create a new share.

# File lib/profitbricks/share.rb, line 30
def create(group_id, resource_id, options = {})
  response = ProfitBricks.request(
    method: :post,
    path: "/um/groups/#{group_id}/shares/#{resource_id}",
    expects: 202,
    body: { properties: options}.to_json
  )
  add_parent_identities(response)
  instantiate_objects(response)
end
delete(group_id,resource_id) click to toggle source

Delete the share.

# File lib/profitbricks/share.rb, line 7
def delete(group_id,resource_id)
  response = ProfitBricks.request(
    method: :delete,
    path: "/um/groups/#{group_id}/shares/#{resource_id}",
    expects: 202
  )
  return true
end
get(group_id, share_id, options = {}) click to toggle source

Retrieve a share under a group.

# File lib/profitbricks/share.rb, line 54
def get(group_id, share_id, options = {})
  response = ProfitBricks.request(
    method: :get,
    path: "/um/groups/#{group_id}/shares/#{share_id}",
    expects: 200,
    query: options
  )
  add_parent_identities(response)
  instantiate_objects(response)
end
list(group_id, options = {}) click to toggle source

List all shares under a group.

# File lib/profitbricks/share.rb, line 42
def list(group_id, options = {})
  response = ProfitBricks.request(
    method: :get,
    path: "/um/groups/#{group_id}/shares",
    expects: 200,
    query: options
  )
  add_parent_identities(response)
  instantiate_objects(response)
end
update(group_id, resource_id, options = {}) click to toggle source

Update the share.

# File lib/profitbricks/share.rb, line 17
def update(group_id, resource_id, options = {})
  response = ProfitBricks.request(
    method: :put,
    path: "/um/groups/#{group_id}/shares/#{resource_id}",
    expects: 202,
    body: { properties: options }.to_json
  )

  add_parent_identities(response)
  instantiate_objects(response)
end