class Spaceship::TestFlight::Group
Attributes
app_id[RW]
created[RW]
id[RW]
is_active[RW]
is_default_external_group[RW]
is_internal_group[RW]
name[RW]
provider_id[RW]
Public Class Methods
add_tester_to_groups!(tester: nil, app: nil, groups: nil)
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 88 def self.add_tester_to_groups!(tester: nil, app: nil, groups: nil) self.perform_for_groups_in_app(app: app, groups: groups) { |group| group.add_tester!(tester) } end
all(app_id: nil)
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 39 def self.all(app_id: nil) groups = client.get_groups(app_id: app_id) groups.map { |g| self.new(g) } end
create!(app_id: nil, group_name: nil)
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 27 def self.create!(app_id: nil, group_name: nil) group = self.find(app_id: app_id, group_name: group_name) return group unless group.nil? data = client.create_group_for_app(app_id: app_id, group_name: group_name) self.new(data) end
default_external_group(app_id: nil)
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 49 def self.default_external_group(app_id: nil) groups = self.all(app_id: app_id) groups.find(&:default_external_group?) end
delete!(app_id: nil, group_name: nil)
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 34 def self.delete!(app_id: nil, group_name: nil) group = self.find(app_id: app_id, group_name: group_name) client.delete_group_for_app(app_id: app_id, group_id: group.id) end
filter_groups(app_id: nil, &block)
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 54 def self.filter_groups(app_id: nil, &block) groups = self.all(app_id: app_id) groups.select(&block) end
find(app_id: nil, group_name: nil)
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 44 def self.find(app_id: nil, group_name: nil) groups = self.all(app_id: app_id) groups.find { |g| g.name == group_name } end
internal_group(app_id: nil)
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 59 def self.internal_group(app_id: nil) groups = self.all(app_id: app_id) groups.find(&:internal_group?) end
perform_for_groups_in_app(app: nil, groups: nil, &block)
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 113 def self.perform_for_groups_in_app(app: nil, groups: nil, &block) if groups.nil? default_external_group = app.default_external_group if default_external_group.nil? raise "The app #{app.name} does not have a default external group. Please make sure to pass group names to the `:groups` option." end test_flight_groups = [default_external_group] else test_flight_groups = self.filter_groups(app_id: app.apple_id) do |group| groups.include?(group.name) end raise "There are no groups available matching the names passed to the `:groups` option." if test_flight_groups.empty? end test_flight_groups.each(&block) end
remove_tester_from_groups!(tester: nil, app: nil, groups: nil)
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 92 def self.remove_tester_from_groups!(tester: nil, app: nil, groups: nil) self.perform_for_groups_in_app(app: app, groups: groups) { |group| group.remove_tester!(tester) } end
Public Instance Methods
active?()
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 104 def active? is_active end
add_tester!(tester)
click to toggle source
First we need to add the tester to the app It's ok if the tester already exists, we just have to do this… don't ask This will enable testing for the tester for a given app, as just creating the tester on an account-level is not enough to add the tester to a group. If this isn't done the next request would fail. This is a bug we reported to the App
Store Connect team, as it also happens on the App
Store Connect UI on 18. April 2017
# File spaceship/lib/spaceship/test_flight/group.rb, line 69 def add_tester!(tester) # This post request creates an account-level tester and then makes it available to the app, or just makes # it available to the app if it already exists client.create_app_level_tester(app_id: self.app_id, first_name: tester.first_name, last_name: tester.last_name, email: tester.email) # This put request adds the tester to the group client.post_tester_to_group(group_id: self.id, email: tester.email, first_name: tester.first_name, last_name: tester.last_name, app_id: self.app_id) end
builds()
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 108 def builds builds = client.builds_for_group(app_id: self.app_id, group_id: self.id) builds.map { |b| Spaceship::TestFlight::Build.new(b) } end
default_external_group?()
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 96 def default_external_group? is_default_external_group end
internal_group?()
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 100 def internal_group? is_internal_group end
remove_tester!(tester)
click to toggle source
# File spaceship/lib/spaceship/test_flight/group.rb, line 84 def remove_tester!(tester) client.delete_tester_from_group(group_id: self.id, tester_id: tester.tester_id, app_id: self.app_id) end