class Spaceship::Tunes::Tester
Attributes
@return (Array) An array of registered devices for this user @example
[{ "model": "iPhone 6", "os": "iOS", "osVersion": "8.3", "name": null }]
@return (String
) The email of this tester @example
"tester@spaceship.com"
@return (String
) The first name of this tester @example
"Cary"
@return (Array) an array of associated groups @example
[{ "id": "e031e048-4f0f-4c1e-8d8a-a5341a267986", "name": { "value": "My App Testers" } }]
@return (String
) The last name of this tester @example
"Bennett"
Information about the most recent beta install @return [Integer] The ID of the most recently installed app
@return [Integer] Date of the last install of this tester
Number of seconds since 1970
@return [Integer] The build number of the last installed build
@return [Integer] The version number of the last installed build
@return (String
) The identifier of this tester, provided by iTunes Connect @example
"60f858b4-60a8-428a-963a-f943a3d68d17"
Public Class Methods
Add all testers to the app received @param app_id (String
) (required): The app id to filter the testers
# File lib/spaceship/tunes/tester.rb, line 140 def add_all_to_app!(app_id) all.each do |tester| begin tester.add_to_app!(app_id) rescue => ex if ex.to_s.include? "testerEmailExistsInternal" or ex.to_s.include? "duplicate.email" # That's a non-relevant error message by iTC # ignore that else raise ex end end end end
@return (Array) Returns all beta testers available for this account
# File lib/spaceship/tunes/tester.rb, line 84 def all client.testers(self).map { |tester| self.factory(tester) } end
@return (Array) Returns all beta testers available for this account filtered by app @param app_id (String
) (required): The app id to filter the testers
# File lib/spaceship/tunes/tester.rb, line 124 def all_by_app(app_id) client.testers_by_app(self, app_id).map { |tester| self.factory(tester) } 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", groups:["Testers"])
@return (Tester
): The newly created tester
# File lib/spaceship/tunes/tester.rb, line 109 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, groups: groups) self.factory(data) end
Create a new object based on a hash. This is used to create a new object based on the server response.
# File lib/spaceship/tunes/tester.rb, line 79 def factory(attrs) self.new(attrs) end
@return (Spaceship::Tunes::Tester
) Returns the tester matching the parameter
as either the Tester id or email
@param identifier (String
) (required): Value used to filter the tester, case insensitive
# File lib/spaceship/tunes/tester.rb, line 91 def find(identifier) 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
@return (Spaceship::Tunes::Tester
) Returns the tester matching the parameter
as either the Tester id or email
@param app_id (String
) (required): The app id to filter the testers @param identifier (String
) (required): Value used to filter the tester, case insensitive
# File lib/spaceship/tunes/tester.rb, line 132 def find_by_app(app_id, identifier) all_by_app(app_id).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
# File lib/spaceship/tunes/tester.rb, line 97 def groups client.groups end
@return (Hash) All urls for the ITC used for web requests
# File lib/spaceship/tunes/tester.rb, line 73 def url raise "You have to use a subclass: Internal or External" end
Public Instance Methods
Add current tester to list of the app testers @param app_id (String
) (required): The id of the application to which want to modify the list
# File lib/spaceship/tunes/tester.rb, line 198 def add_to_app!(app_id) client.add_tester_to_app!(self, app_id) end
Delete current tester
# File lib/spaceship/tunes/tester.rb, line 188 def delete! client.delete_tester!(self) end
Return a list of the Tester's group, if any @return
# File lib/spaceship/tunes/tester.rb, line 214 def groups_list(separator = ', ') if groups group_names = groups.map { |group| group["name"]["value"] } group_names.join(separator) end end
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
# File lib/spaceship/tunes/tester.rb, line 204 def remove_from_app!(app_id) client.remove_tester_from_app!(self, app_id) end
# File lib/spaceship/tunes/tester.rb, line 156 def setup self.devices ||= [] # by default, an empty array instead of nil end