Module: Spaceship::ConnectAPI::Users::API

Defined in:
spaceship/lib/spaceship/connect_api/users/users.rb

Instance Method Summary collapse

Instance Method Details

#add_user_visible_apps(user_id: nil, app_ids: nil) ⇒ Object

Change app permissions for user



32
33
34
35
36
37
38
39
40
41
42
43
# File 'spaceship/lib/spaceship/connect_api/users/users.rb', line 32

def add_user_visible_apps(user_id: nil, app_ids: nil)
  body = {
    data: app_ids.map do |app_id|
      {
        type: "apps",
        id: app_id
      }
    end
  }

  users_request_client.post("users/#{user_id}/relationships/visibleApps", body)
end

#delete_user(user_id: nil) ⇒ Object

Delete existing user



27
28
29
# File 'spaceship/lib/spaceship/connect_api/users/users.rb', line 27

def delete_user(user_id: nil)
  users_request_client.delete("users/#{user_id}")
end

#delete_user_invitation(user_invitation_id: nil) ⇒ Object

Remove invited user from team (not yet accepted)



74
75
76
# File 'spaceship/lib/spaceship/connect_api/users/users.rb', line 74

def delete_user_invitation(user_invitation_id: nil)
  users_request_client.delete("userInvitations/#{user_invitation_id}")
end

#get_user_invitations(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

Get all invited users (not yet accepted)



50
51
52
53
# File 'spaceship/lib/spaceship/connect_api/users/users.rb', line 50

def get_user_invitations(filter: {}, includes: nil, limit: nil, sort: nil)
  params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  users_request_client.get("userInvitations", params)
end

#get_users(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

Get list of users



21
22
23
24
# File 'spaceship/lib/spaceship/connect_api/users/users.rb', line 21

def get_users(filter: {}, includes: nil, limit: nil, sort: nil)
  params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  users_request_client.get("users", params)
end

#post_user_invitation(email: nil, first_name: nil, last_name: nil, roles: [], provisioning_allowed: nil, all_apps_visible: nil) ⇒ Object

Invite new users to App Store Connect



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'spaceship/lib/spaceship/connect_api/users/users.rb', line 56

def post_user_invitation(email: nil, first_name: nil, last_name: nil, roles: [], provisioning_allowed: nil, all_apps_visible: nil)
  body = {
    data: {
      type: "userInvitations",
      attributes: {
        email: email,
        firstName: first_name,
        lastName: last_name,
        roles: roles,
        provisioningAllowed: provisioning_allowed,
        allAppsVisible: all_apps_visible
      }
    }
  }
  users_request_client.post("userInvitations", body)
end

#users_request_clientObject

Raises:

  • (TypeError)


11
12
13
14
# File 'spaceship/lib/spaceship/connect_api/users/users.rb', line 11

def users_request_client
  return @users_request_client if @users_request_client
  raise TypeError, "You need to instantiate this module with users_request_client"
end

#users_request_client=(users_request_client) ⇒ Object



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

def users_request_client=(users_request_client)
  @users_request_client = users_request_client
end