Class: Spaceship::Tunes::Tester
- Defined in:
- lib/spaceship/tunes/tester.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#devices ⇒ Array
An array of registered devices for this user.
-
#email ⇒ String
The email of this tester.
-
#first_name ⇒ String
The first name of this tester.
-
#last_name ⇒ String
The last name of this tester.
-
#latest_install_app_id ⇒ Integer
Information about the most recent beta install.
-
#latest_install_date ⇒ Integer
Date of the last install of this tester Number of seconds since 1970.
-
#latest_installed_build_number ⇒ Integer
The build number of the last installed build.
-
#latest_installed_version_number ⇒ Integer
The version number of the last installed build.
-
#tester_id ⇒ String
The identifier of this tester, provided by iTunes Connect.
Attributes inherited from Base
App collapse
-
.add_all_to_app!(app_id) ⇒ Object
Add all testers to the app received.
-
.all_by_app(app_id) ⇒ Array
Returns all beta testers available for this account filtered by app.
-
.find_by_app(app_id, identifier) ⇒ Spaceship::Tunes::Tester
Returns the tester matching the parameter as either the Tester id or email.
-
#add_to_app!(app_id) ⇒ Object
Add current tester to list of the app testers.
-
#remove_from_app!(app_id) ⇒ Object
Remove current tester from list of the app testers.
- #setup ⇒ Object
Subclasses collapse
-
#delete! ⇒ Object
Delete current tester.
Class Method Summary collapse
-
.all ⇒ Array
Returns all beta testers available for this account.
-
.create!(email: nil, first_name: nil, last_name: nil) ⇒ Tester
Create new tester in iTunes Connect.
-
.factory(attrs) ⇒ Object
Create a new object based on a hash.
-
.find(identifier) ⇒ Spaceship::Tunes::Tester
Returns the tester matching the parameter as either the Tester id or email.
-
.url ⇒ Hash
All urls for the ITC used for web requests.
Methods inherited from TunesBase
Methods inherited from Base
attr_accessor, attr_mapping, attributes, #attributes, #client, #initialize, #inspect, mapping_module, method_missing, set_client, #to_s
Constructor Details
This class inherits a constructor from Spaceship::Base
Instance Attribute Details
#devices ⇒ Array
Returns An array of registered devices for this user.
33 34 35 |
# File 'lib/spaceship/tunes/tester.rb', line 33 def devices @devices end |
#email ⇒ String
Returns The email of this tester.
13 14 15 |
# File 'lib/spaceship/tunes/tester.rb', line 13 def email @email end |
#first_name ⇒ String
Returns The first name of this tester.
18 19 20 |
# File 'lib/spaceship/tunes/tester.rb', line 18 def first_name @first_name end |
#last_name ⇒ String
Returns The last name of this tester.
23 24 25 |
# File 'lib/spaceship/tunes/tester.rb', line 23 def last_name @last_name end |
#latest_install_app_id ⇒ Integer
Information about the most recent beta install
38 39 40 |
# File 'lib/spaceship/tunes/tester.rb', line 38 def latest_install_app_id @latest_install_app_id end |
#latest_install_date ⇒ Integer
Returns Date of the last install of this tester Number of seconds since 1970.
42 43 44 |
# File 'lib/spaceship/tunes/tester.rb', line 42 def latest_install_date @latest_install_date end |
#latest_installed_build_number ⇒ Integer
Returns The build number of the last installed build.
45 46 47 |
# File 'lib/spaceship/tunes/tester.rb', line 45 def latest_installed_build_number @latest_installed_build_number end |
#latest_installed_version_number ⇒ Integer
Returns The version number of the last installed build.
48 49 50 |
# File 'lib/spaceship/tunes/tester.rb', line 48 def latest_installed_version_number @latest_installed_version_number end |
#tester_id ⇒ String
Returns The identifier of this tester, provided by iTunes Connect.
8 9 10 |
# File 'lib/spaceship/tunes/tester.rb', line 8 def tester_id @tester_id end |
Class Method Details
.add_all_to_app!(app_id) ⇒ Object
Add all testers to the app received
126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/spaceship/tunes/tester.rb', line 126 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 ⇒ Array
Returns all beta testers available for this account
76 77 78 |
# File 'lib/spaceship/tunes/tester.rb', line 76 def all client.testers(self).map { |tester| self.factory(tester) } end |
.all_by_app(app_id) ⇒ Array
Returns all beta testers available for this account filtered by app
110 111 112 |
# File 'lib/spaceship/tunes/tester.rb', line 110 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) ⇒ Tester
Create new tester in iTunes Connect
96 97 98 99 100 101 102 |
# File 'lib/spaceship/tunes/tester.rb', line 96 def create!(email: nil, first_name: nil, last_name: nil) data = client.create_tester!(tester: self, email: email, first_name: first_name, last_name: last_name) self.factory(data) end |
.factory(attrs) ⇒ Object
Create a new object based on a hash. This is used to create a new object based on the server response.
71 72 73 |
# File 'lib/spaceship/tunes/tester.rb', line 71 def factory(attrs) self.new(attrs) end |
.find(identifier) ⇒ Spaceship::Tunes::Tester
Returns the tester matching the parameter as either the Tester id or email
83 84 85 86 87 |
# File 'lib/spaceship/tunes/tester.rb', line 83 def find(identifier) all.find do |tester| (tester.tester_id == identifier.to_s or tester.email == identifier) end end |
.find_by_app(app_id, identifier) ⇒ Spaceship::Tunes::Tester
Returns the tester matching the parameter as either the Tester id or email
118 119 120 121 122 |
# File 'lib/spaceship/tunes/tester.rb', line 118 def find_by_app(app_id, identifier) all_by_app(app_id).find do |tester| (tester.tester_id == identifier.to_s or tester.email == identifier) end end |
.url ⇒ Hash
Returns All urls for the ITC used for web requests.
65 66 67 |
# File 'lib/spaceship/tunes/tester.rb', line 65 def url raise "You have to use a subclass: Internal or External" end |
Instance Method Details
#add_to_app!(app_id) ⇒ Object
Add current tester to list of the app testers
184 185 186 |
# File 'lib/spaceship/tunes/tester.rb', line 184 def add_to_app!(app_id) client.add_tester_to_app!(self, app_id) end |
#delete! ⇒ Object
Delete current tester
174 175 176 |
# File 'lib/spaceship/tunes/tester.rb', line 174 def delete! client.delete_tester!(self) end |
#remove_from_app!(app_id) ⇒ Object
Remove current tester from list of the app testers
190 191 192 |
# File 'lib/spaceship/tunes/tester.rb', line 190 def remove_from_app!(app_id) client.remove_tester_from_app!(self, app_id) end |
#setup ⇒ Object
142 143 144 |
# File 'lib/spaceship/tunes/tester.rb', line 142 def setup self.devices ||= [] # by default, an empty array instead of nil end |