Class: Pilot::TesterManager
Instance Attribute Summary
Attributes inherited from Manager
#config
Instance Method Summary
collapse
Methods inherited from Manager
#app, #fetch_app_id, #fetch_app_identifier, #fetch_app_platform, #login, #start
Instance Method Details
#add_tester(options) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'pilot/lib/pilot/tester_manager.rb', line 8
def add_tester(options)
start(options)
app = find_app(apple_id: config[:apple_id], app_identifier: config[:app_identifier])
UI.user_error!("You must provide either a Apple ID for the app (with the `:apple_id` option) or app identifier (with the `:app_identifier` option)") unless app
groups_param = config[:groups]
UI.user_error!("You must provide 1 or more groups (with the `:groups` option)") unless groups_param
app.get_beta_groups.select do |group|
next unless groups_param.include?(group.name)
user = {
email: config[:email],
firstName: config[:first_name],
lastName: config[:last_name]
}
group.post_bulk_beta_tester_assignments(beta_testers: [user])
end
group_names = groups_param.join(';')
UI.success("Successfully added tester #{config[:email]} to app #{app.name} in group(s) #{group_names}")
end
|
#find_tester(options) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
|
# File 'pilot/lib/pilot/tester_manager.rb', line 30
def find_tester(options)
start(options)
app = find_app(apple_id: config[:apple_id], app_identifier: config[:app_identifier])
tester = find_app_tester(email: config[:email], app: app)
UI.user_error!("Tester #{config[:email]} not found") unless tester
describe_tester(tester)
return tester
end
|
#list_testers(options) ⇒ Object
71
72
73
74
75
76
77
78
79
80
|
# File 'pilot/lib/pilot/tester_manager.rb', line 71
def list_testers(options)
start(options)
app = find_app(apple_id: config[:apple_id], app_identifier: config[:app_identifier])
if app
list_testers_by_app(app)
else
UI.user_error!("You must include an `app_identifier` to `list_testers`")
end
end
|
#remove_tester(options) ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'pilot/lib/pilot/tester_manager.rb', line 42
def remove_tester(options)
start(options)
app = find_app(apple_id: config[:apple_id], app_identifier: config[:app_identifier])
tester = find_app_tester(email: config[:email], app: app)
UI.user_error!("Tester #{config[:email]} not found") unless tester
begin
if config[:groups].nil?
tester.delete_from_apps(apps: [app])
UI.success("Successfully removed tester #{tester.email} from app: #{app.name}")
else
groups = tester.beta_groups.select do |group|
config[:groups].include?(group.name)
end
tester.delete_from_beta_groups(beta_groups: groups)
group_names = groups.map(&:name)
UI.success("Successfully removed tester #{tester.email} from app #{app.name} in group(s) #{group_names}")
end
rescue => ex
UI.error("Could not remove #{tester.email} from app: #{ex}")
raise ex
end
end
|