Class: Fog::Compute::Brightbox::Collaborations

Inherits:
Fog::Collection show all
Defined in:
lib/fog/brightbox/models/compute/collaborations.rb

Instance Attribute Summary

Attributes inherited from Fog::Collection

#service

Instance Method Summary collapse

Methods inherited from Fog::Collection

#clear, #create, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#allObject



10
11
12
13
# File 'lib/fog/brightbox/models/compute/collaborations.rb', line 10

def all
  data = service.list_collaborations
  load(data)
end

#destroyObject



39
40
41
42
43
# File 'lib/fog/brightbox/models/compute/collaborations.rb', line 39

def destroy
  requires :identity
  service.destroy_collaboration(identity)
  true
end

#get(identifier) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/fog/brightbox/models/compute/collaborations.rb', line 15

def get(identifier)
  return nil if identifier.nil? || identifier == ""
  data = service.get_collaboration(identifier)
  new(data)
rescue Excon::Errors::NotFound
  nil
end

#invite(email, role) ⇒ Fog::Compute::Brightbox::Collaboration

Invites a user (via an email) to collaborate on the currently scoped account at the role level.

Parameters:

  • email (String)

    The email address to use for the invitation

  • role (String)

    The role being granted. Only (admin is currently supported

Returns:



31
32
33
34
35
36
37
# File 'lib/fog/brightbox/models/compute/collaborations.rb', line 31

def invite(email, role)
  return nil if email.nil? || email == ""
  return nil if role.nil? || role == ""
  options = {:email => email, :role => role}
  data = service.create_collaboration(options)
  new(data)
end