class Spaceship::Tunes::Tester

Attributes

devices[RW]

@return (Array) An array of registered devices for this user @example

[{
  "model": "iPhone 6",
  "os": "iOS",
  "osVersion": "8.3",
  "name": null
}]
email[RW]

@return (String) The email of this tester @example

"tester@spaceship.com"
first_name[RW]

@return (String) The first name of this tester @example

"Cary"
groups[RW]

@return (Array) an array of associated groups @example

[{
  "id": "e031e048-4f0f-4c1e-8d8a-a5341a267986",
  "name": {
    "value": "My App Testers"
  }
}]
last_name[RW]

@return (String) The last name of this tester @example

"Bennett"
latest_install_app_id[RW]

Information about the most recent beta install @return [Integer] The ID of the most recently installed app

latest_install_date[RW]

@return [Integer] Date of the last install of this tester

Number of seconds since 1970
latest_installed_build_number[RW]

@return [Integer] The build number of the last installed build

latest_installed_version_number[RW]

@return [Integer] The version number of the last installed build

tester_id[RW]

@return (String) The identifier of this tester, provided by iTunes Connect @example

"60f858b4-60a8-428a-963a-f943a3d68d17"

Public Class Methods

add_all_to_app!(app_id) click to toggle source

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
all() click to toggle source

@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
all_by_app(app_id) click to toggle source

@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!(email: nil, first_name: nil, last_name: nil, groups: nil) click to toggle source

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
factory(attrs) click to toggle source

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
find(identifier) click to toggle source

@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
find_by_app(app_id, identifier) click to toggle source

@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
groups() click to toggle source
# File lib/spaceship/tunes/tester.rb, line 97
def groups
  client.groups
end
url() click to toggle source

@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_to_app!(app_id) click to toggle source

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!() click to toggle source

Delete current tester

# File lib/spaceship/tunes/tester.rb, line 188
def delete!
  client.delete_tester!(self)
end
groups_list(separator = ', ') click to toggle source

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_from_app!(app_id) click to toggle source

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
setup() click to toggle source
# File lib/spaceship/tunes/tester.rb, line 156
def setup
  self.devices ||= [] # by default, an empty array instead of nil
end