Class: Spaceship::ConnectAPI::UserInvitation

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
spaceship/lib/spaceship/connect_api/models/user_invitation.rb

Defined Under Namespace

Modules: UserRole

Instance Attribute Summary collapse

Attributes included from Model

#id, #reverse_attr_map

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model

#attr_mapping, included, #initialize, #reverse_attr_mapping, #to_json, #update_attributes

Instance Attribute Details

#all_apps_visibleObject

Returns the value of attribute all_apps_visible.



11
12
13
# File 'spaceship/lib/spaceship/connect_api/models/user_invitation.rb', line 11

def all_apps_visible
  @all_apps_visible
end

#emailObject

Returns the value of attribute email.



9
10
11
# File 'spaceship/lib/spaceship/connect_api/models/user_invitation.rb', line 9

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



7
8
9
# File 'spaceship/lib/spaceship/connect_api/models/user_invitation.rb', line 7

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



8
9
10
# File 'spaceship/lib/spaceship/connect_api/models/user_invitation.rb', line 8

def last_name
  @last_name
end

#provisioning_allowedObject

Returns the value of attribute provisioning_allowed.



12
13
14
# File 'spaceship/lib/spaceship/connect_api/models/user_invitation.rb', line 12

def provisioning_allowed
  @provisioning_allowed
end

#rolesObject

Returns the value of attribute roles.



10
11
12
# File 'spaceship/lib/spaceship/connect_api/models/user_invitation.rb', line 10

def roles
  @roles
end

Class Method Details

.all(client: nil, filter: {}, includes: nil, sort: nil) ⇒ Object

Managing invitations



45
46
47
48
49
# File 'spaceship/lib/spaceship/connect_api/models/user_invitation.rb', line 45

def self.all(client: nil, filter: {}, includes: nil, sort: nil)
  client ||= Spaceship::ConnectAPI
  resps = client.get_user_invitations(filter: filter, includes: includes, sort: sort).all_pages
  return resps.flat_map(&:to_models)
end

.create(client: nil, email: nil, first_name: nil, last_name: nil, roles: [], provisioning_allowed: nil, all_apps_visible: nil) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
# File 'spaceship/lib/spaceship/connect_api/models/user_invitation.rb', line 56

def self.create(client: nil, email: nil, first_name: nil, last_name: nil, roles: [], provisioning_allowed: nil, all_apps_visible: nil)
  client ||= Spaceship::ConnectAPI
  resp = client.post_user_invitation(
    email: email,
    first_name: first_name,
    last_name: last_name,
    roles: roles,
    provisioning_allowed: provisioning_allowed,
    all_apps_visible: all_apps_visible
  )
  return resp.to_models.first
end

.find(client: nil, email: nil, includes: nil) ⇒ Object



51
52
53
54
# File 'spaceship/lib/spaceship/connect_api/models/user_invitation.rb', line 51

def self.find(client: nil, email: nil, includes: nil)
  client ||= Spaceship::ConnectAPI
  return all(client: client, filter: { email: email }, includes: includes)
end

.typeObject



37
38
39
# File 'spaceship/lib/spaceship/connect_api/models/user_invitation.rb', line 37

def self.type
  return "userInvitations"
end

Instance Method Details

#delete!(client: nil) ⇒ Object



69
70
71
72
# File 'spaceship/lib/spaceship/connect_api/models/user_invitation.rb', line 69

def delete!(client: nil)
  client ||= Spaceship::ConnectAPI
  client.delete_user_invitation(user_invitation_id: id)
end