Class: Spaceship::TestFlight::Tester

Inherits:
Base
  • Object
show all
Defined in:
spaceship/lib/spaceship/test_flight/tester.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#client, #raw_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

client, inherited, #to_json

Methods inherited from Base

attr_accessor, attr_mapping, attributes, #attributes, factory, #initialize, #inspect, mapping_module, method_missing, set_client, #setup, #to_s

Constructor Details

This class inherits a constructor from Spaceship::Base

Instance Attribute Details

#emailString

Returns The email of this tester.

Examples:

"[email protected]"

Returns:

  • (String)

    The email of this tester



14
15
16
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 14

def email
  @email
end

#first_nameString

Returns The first name of this tester.

Examples:

"Cary"

Returns:

  • (String)

    The first name of this tester



19
20
21
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 19

def first_name
  @first_name
end

#groupsObject

Returns the value of attribute groups.



52
53
54
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 52

def groups
  @groups
end

#last_nameString

Returns The last name of this tester.

Examples:

"Bennett"

Returns:

  • (String)

    The last name of this tester



24
25
26
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 24

def last_name
  @last_name
end

#latest_install_infoHash

"latestInstalledAppAdamId": "1222374686",
"latestInstalledBuildId": "20739770",
"latestInstalledDate": "1496866405755",
"latestInstalledShortVersion": "1.0",
"latestInstalledVersion": "68"

Returns:



45
46
47
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 45

def latest_install_info
  @latest_install_info
end

#latest_installed_dateObject

Returns the value of attribute latest_installed_date.



47
48
49
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 47

def latest_installed_date
  @latest_installed_date
end

#session_countInteger

Returns Number of sessions.

Returns:

  • (Integer)

    Number of sessions



50
51
52
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 50

def session_count
  @session_count
end

#statusString

Examples:

"invited"
"installed"

Returns:



31
32
33
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 31

def status
  @status
end

#status_mod_timeInteger

Returns Date of the last modification of the status (e.g. invite sent).

Returns:

  • (Integer)

    Date of the last modification of the status (e.g. invite sent)



34
35
36
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 34

def status_mod_time
  @status_mod_time
end

#tester_idString

Returns The identifier of this tester, provided by App Store Connect.

Examples:

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

Returns:

  • (String)

    The identifier of this tester, provided by App Store Connect



9
10
11
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 9

def tester_id
  @tester_id
end

Class Method Details

.all(app_id: nil) ⇒ Array

Returns all beta testers available for this account

Returns:

  • (Array)

    Returns all beta testers available for this account



81
82
83
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 81

def self.all(app_id: nil)
  client.testers_for_app(app_id: app_id).map { |data| self.new(data) }
end

.create_app_level_tester(app_id: nil, first_name: nil, last_name: nil, email: nil) ⇒ Object



116
117
118
119
120
121
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 116

def self.create_app_level_tester(app_id: nil, first_name: nil, last_name: nil, email: nil)
  client.create_app_level_tester(app_id: app_id,
                                 first_name: first_name,
                                 last_name: last_name,
                                 email: email)
end

.find(app_id: nil, email: nil) ⇒ Object

*DEPRECATED: Use ‘Spaceship::TestFlight::Tester.search` method instead*



86
87
88
89
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 86

def self.find(app_id: nil, email: nil)
  testers = self.search(app_id: app_id, text: email, is_email_exact_match: true)
  return testers.first
end

.remove_testers_from_testflight(app_id: nil, tester_ids: nil) ⇒ Object



112
113
114
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 112

def self.remove_testers_from_testflight(app_id: nil, tester_ids: nil)
  client.remove_testers_from_testflight(app_id: app_id, tester_ids: tester_ids)
end

.search(app_id: nil, text: nil, is_email_exact_match: false) ⇒ Spaceship::TestFlight::Tester

ITC searches all fields, and is full text. The search results are the union of all words in the search text

Parameters:

  • text (String) (defaults to: nil)

    (required): Value used to filter the tester, case insensitive

Returns:



98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 98

def self.search(app_id: nil, text: nil, is_email_exact_match: false)
  text = text.strip
  testers_matching_text = client.search_for_tester_in_app(app_id: app_id, text: text).map { |data| self.new(data) }
  testers_matching_text ||= []
  if is_email_exact_match
    text = text.downcase
    testers_matching_text = testers_matching_text.select do |tester|
      tester.email.downcase == text
    end
  end

  return testers_matching_text
end

Instance Method Details

#pretty_install_dateObject



74
75
76
77
78
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 74

def pretty_install_date
  return nil unless latest_installed_date

  Time.at((latest_installed_date / 1000)).strftime("%Y-%m-%d %H:%M")
end

#remove_from_app!(app_id: nil) ⇒ Object



123
124
125
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 123

def remove_from_app!(app_id: nil)
  client.delete_tester_from_app(app_id: app_id, tester_id: self.tester_id)
end

#remove_from_testflight!(app_id: nil) ⇒ Object



127
128
129
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 127

def remove_from_testflight!(app_id: nil)
  client.remove_testers_from_testflight(app_id: app_id, tester_ids: [self.tester_id])
end

#resend_invite(app_id: nil) ⇒ Object



131
132
133
# File 'spaceship/lib/spaceship/test_flight/tester.rb', line 131

def resend_invite(app_id: nil)
  client.resend_invite_to_external_tester(app_id: app_id, tester_id: self.tester_id)
end