lib/spaceship/tunes/tester.rb in spaceship-0.36.2 vs lib/spaceship/tunes/tester.rb in spaceship-0.37.0
- old
+ new
@@ -19,10 +19,20 @@
# @return (String) The last name of this tester
# @example
# "Bennett"
attr_accessor :last_name
+ # @return (Array) an array of associated groups
+ # @example
+ # [{
+ # "id": "e031e048-4f0f-4c1e-8d8a-a5341a267986",
+ # "name": {
+ # "value": "My App Testers"
+ # }
+ # }]
+ attr_accessor :groups
+
# @return (Array) An array of registered devices for this user
# @example
# [{
# "model": "iPhone 6",
# "os": "iOS",
@@ -48,10 +58,11 @@
attr_mapping(
'testerId' => :tester_id,
'emailAddress.value' => :email,
'firstName.value' => :first_name,
'lastName.value' => :last_name,
+ 'groups' => :groups,
'devices' => :devices,
'latestInstalledAppAdamId' => :latest_install_app_id,
'latestInstalledDate' => :latest_install_date,
'latestInstalledVersion' => :latest_installed_version_number,
'latestInstalledShortVersion' => :latest_installed_build_number
@@ -81,22 +92,28 @@
all.find do |tester|
(tester.tester_id.to_s.casecmp(identifier.to_s).zero? or tester.email.to_s.casecmp(identifier.to_s).zero?)
end
end
+ def groups
+ client.groups
+ end
+
# Create new tester in iTunes Connect
# @param email (String) (required): The email of the new tester
# @param first_name (String) (optional): The first name of the new tester
# @param last_name (String) (optional): The last name of the new tester
+ # @param groups (Array) (option): Names/IDs of existing groups for the new tester
# @example
- # Spaceship::Tunes::Tester.external.create!(email: "tester@mathiascarignani.com", first_name: "Cary", last_name:"Bennett")
+ # Spaceship::Tunes::Tester.external.create!(email: "tester@mathiascarignani.com", first_name: "Cary", last_name:"Bennett", groups:["Testers"])
# @return (Tester): The newly created tester
- def create!(email: nil, first_name: nil, last_name: nil)
+ def create!(email: nil, first_name: nil, last_name: nil, groups: nil)
data = client.create_tester!(tester: self,
email: email,
first_name: first_name,
- last_name: last_name)
+ last_name: last_name,
+ groups: groups)
self.factory(data)
end
#####################################################
# @!group App
@@ -184,9 +201,22 @@
# Remove current tester from list of the app testers
# @param app_id (String) (required): The id of the application to which want to modify the list
def remove_from_app!(app_id)
client.remove_tester_from_app!(self, app_id)
+ end
+
+ #####################################################
+ # @!group Helpers
+ #####################################################
+
+ # Return a list of the Tester's group, if any
+ # @return
+ def groups_list(separator = ', ')
+ if groups
+ group_names = groups.map { |group| group["name"]["value"] }
+ group_names.join(separator)
+ end
end
end
class SandboxTester < TunesBase
# @return (String) The email of this tester