spaceship 0.3.4 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -124,7 +124,6 @@ module Spaceship
124
124
  # @return (Hash) Represents the screenshots of this app version (read-only)
125
125
  attr_reader :screenshots
126
126
 
127
-
128
127
  attr_mapping({
129
128
  'canBetaTest' => :can_beta_test,
130
129
  'canPrepareForUpload' => :can_prepare_for_upload,
@@ -229,7 +228,6 @@ module Spaceship
229
228
  "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/#{self.application.apple_id}/" + (self.is_live? ? "cur" : "")
230
229
  end
231
230
 
232
-
233
231
  # Private methods
234
232
  def setup
235
233
  # Properly parse the AppStatus
@@ -244,7 +242,6 @@ module Spaceship
244
242
  end
245
243
  end
246
244
 
247
-
248
245
  # Prefill name, keywords, etc...
249
246
  def unfold_languages
250
247
  {
@@ -271,64 +268,60 @@ module Spaceship
271
268
  end
272
269
 
273
270
  def primary_category=(value)
274
- value = "MZGenre.#{value}" unless value.include?"MZGenre"
275
- super(value)
276
- end
277
-
278
- def primary_category=(value)
279
- value = "MZGenre.#{value}" unless value.include?"MZGenre"
271
+ value = "MZGenre.#{value}" unless value.include? "MZGenre"
280
272
  super(value)
281
273
  end
282
274
 
283
275
  def primary_first_sub_category=(value)
284
- value = "MZGenre.#{value}" unless value.include?"MZGenre"
276
+ value = "MZGenre.#{value}" unless value.include? "MZGenre"
285
277
  super(value)
286
278
  end
287
279
 
288
280
  def primary_second_sub_category=(value)
289
- value = "MZGenre.#{value}" unless value.include?"MZGenre"
281
+ value = "MZGenre.#{value}" unless value.include? "MZGenre"
290
282
  super(value)
291
283
  end
292
284
 
293
285
  def secondary_category=(value)
294
- value = "MZGenre.#{value}" unless value.include?"MZGenre"
286
+ value = "MZGenre.#{value}" unless value.include? "MZGenre"
295
287
  super(value)
296
288
  end
297
289
 
298
290
  def secondary_first_sub_category=(value)
299
- value = "MZGenre.#{value}" unless value.include?"MZGenre"
291
+ value = "MZGenre.#{value}" unless value.include? "MZGenre"
300
292
  super(value)
301
293
  end
302
294
 
303
295
  def secondary_second_sub_category=(value)
304
- value = "MZGenre.#{value}" unless value.include?"MZGenre"
296
+ value = "MZGenre.#{value}" unless value.include? "MZGenre"
305
297
  super(value)
306
298
  end
307
299
 
308
300
  private
301
+
309
302
  # generates the nested data structure to represent screenshots
310
- def setup_screenshots(row)
311
- screenshots = row.fetch('screenshots', {}).fetch('value', nil)
312
- return [] unless screenshots
313
-
314
- result = []
315
-
316
- screenshots.each do |device_type, value|
317
- value['value'].each do |screenshot|
318
- screenshot = screenshot['value']
319
- result << Tunes::AppScreenshot.new({
320
- url: screenshot['url'],
321
- thumbnail_url: screenshot['thumbNailUrl'],
322
- sort_order: screenshot['sortOrder'],
323
- original_file_name: screenshot['originalFileName'],
324
- device_type: device_type,
325
- language: row['language']
326
- })
327
- end
303
+ def setup_screenshots(row)
304
+ screenshots = row.fetch('screenshots', {}).fetch('value', nil)
305
+ return [] unless screenshots
306
+
307
+ result = []
308
+
309
+ screenshots.each do |device_type, value|
310
+ value['value'].each do |screenshot|
311
+ screenshot = screenshot['value']
312
+ result << Tunes::AppScreenshot.new({
313
+ url: screenshot['url'],
314
+ thumbnail_url: screenshot['thumbNailUrl'],
315
+ sort_order: screenshot['sortOrder'],
316
+ original_file_name: screenshot['originalFileName'],
317
+ device_type: device_type,
318
+ language: row['language']
319
+ })
328
320
  end
329
-
330
- return result
331
321
  end
322
+
323
+ return result
324
+ end
332
325
  end
333
326
  end
334
327
  end
@@ -1,9 +1,9 @@
1
1
  module Spaceship
2
2
  module Tunes
3
3
  class Application < TunesBase
4
-
4
+
5
5
  # @return (String) The App identifier of this app, provided by iTunes Connect
6
- # @example
6
+ # @example
7
7
  # "1013943394"
8
8
  attr_accessor :apple_id
9
9
 
@@ -13,17 +13,17 @@ module Spaceship
13
13
  attr_accessor :name
14
14
 
15
15
  # @return (String) the supported platform of this app
16
- # @example
16
+ # @example
17
17
  # "ios"
18
18
  attr_accessor :platform
19
19
 
20
20
  # @return (String) The Vendor ID provided by iTunes Connect
21
- # @example
21
+ # @example
22
22
  # "1435592086"
23
23
  attr_accessor :vendor_id
24
24
 
25
25
  # @return (String) The bundle_id (app identifier) of your app
26
- # @example
26
+ # @example
27
27
  # "com.krausefx.app"
28
28
  attr_accessor :bundle_id
29
29
 
@@ -34,7 +34,7 @@ module Spaceship
34
34
  attr_accessor :issues_count
35
35
 
36
36
  # @return (String) The URL to a low resolution app icon of this app (340x340px). Might be nil
37
- # @example
37
+ # @example
38
38
  # "https://is1-ssl.mzstatic.com/image/thumb/Purple7/v4/cd/a3/e2/cda3e2ac-4034-c6af-ee0c-3e4d9a0bafaa/pr_source.png/340x340bb-80.png"
39
39
  # @example
40
40
  # nil
@@ -50,7 +50,7 @@ module Spaceship
50
50
  'issuesCount' => :issues_count,
51
51
  'iconUrl' => :app_icon_preview_url
52
52
  )
53
-
53
+
54
54
  class << self
55
55
  # Create a new object based on a hash.
56
56
  # This is used to create a new object based on the server response.
@@ -72,22 +72,22 @@ module Spaceship
72
72
  end
73
73
 
74
74
  # Creates a new application on iTunes Connect
75
- # @param name (String): The name of your app as it will appear on the App Store.
75
+ # @param name (String): The name of your app as it will appear on the App Store.
76
76
  # This can't be longer than 255 characters.
77
- # @param primary_language (String): If localized app information isn't available in an
77
+ # @param primary_language (String): If localized app information isn't available in an
78
78
  # App Store territory, the information from your primary language will be used instead.
79
- # @param version (String): The version number is shown on the App Store and should
79
+ # @param version (String): The version number is shown on the App Store and should
80
80
  # match the one you used in Xcode.
81
81
  # @param sku (String): A unique ID for your app that is not visible on the App Store.
82
- # @param bundle_id (String): The bundle ID must match the one you used in Xcode. It
82
+ # @param bundle_id (String): The bundle ID must match the one you used in Xcode. It
83
83
  # can't be changed after you submit your first build.
84
84
  # @param company_name (String): The company name or developer name to display on the App Store for your apps.
85
85
  # It cannot be changed after you create your first app.
86
86
  def create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil)
87
- client.create_application!(name: name,
88
- primary_language: primary_language,
89
- version: version,
90
- sku: sku,
87
+ client.create_application!(name: name,
88
+ primary_language: primary_language,
89
+ version: version,
90
+ sku: sku,
91
91
  bundle_id: bundle_id,
92
92
  bundle_id_suffix: bundle_id_suffix,
93
93
  company_name: company_name)
@@ -99,7 +99,7 @@ module Spaceship
99
99
  #####################################################
100
100
 
101
101
  # @return (Spaceship::AppVersion) Receive the version that is currently live on the
102
- # App Store. You can't modify all values there, so be careful.
102
+ # App Store. You can't modify all values there, so be careful.
103
103
  def live_version
104
104
  v = Spaceship::AppVersion.find(self, self.apple_id, true)
105
105
  end
@@ -127,7 +127,7 @@ module Spaceship
127
127
  "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/#{self.apple_id}"
128
128
  end
129
129
 
130
- # @return (Hash) Contains the reason for rejection.
130
+ # @return (Hash) Contains the reason for rejection.
131
131
  # if everything is alright, the result will be
132
132
  # `{"sectionErrorKeys"=>[], "sectionInfoKeys"=>[], "sectionWarningKeys"=>[], "replyConstraints"=>{"minLength"=>1, "maxLength"=>4000}, "appNotes"=>{"threads"=>[]}, "betaNotes"=>{"threads"=>[]}, "appMessages"=>{"threads"=>[]}}`
133
133
  def resolution_center
@@ -137,7 +137,7 @@ module Spaceship
137
137
  #####################################################
138
138
  # @!group Modifying
139
139
  #####################################################
140
-
140
+
141
141
  # Create a new version of your app
142
142
  # Since we have stored the outdated raw_data, we need to refresh this object
143
143
  # otherwise `edit_version` will return nil
@@ -166,7 +166,7 @@ module Spaceship
166
166
  # Those builds can also be the builds that are stuck on iTC.
167
167
  def pre_processing_builds
168
168
  data = client.build_trains(apple_id) # we need to fetch all trains here to get the builds
169
-
169
+
170
170
  data.fetch('processingBuilds', []).collect do |attrs|
171
171
  attrs.merge!(build_train: self)
172
172
  Tunes::ProcessingBuild.factory(attrs)
@@ -177,7 +177,7 @@ module Spaceship
177
177
  # this include pre-processing or standard processing
178
178
  def all_processing_builds
179
179
  builds = self.pre_processing_builds
180
-
180
+
181
181
  self.build_trains.each do |version_number, train|
182
182
  train.processing_builds.each do |build|
183
183
  builds << build
@@ -203,13 +203,13 @@ module Spaceship
203
203
  #####################################################
204
204
  # @!group Submit for Review
205
205
  #####################################################
206
-
206
+
207
207
  def create_submission
208
208
  version = self.latest_version
209
209
  if version.nil?
210
210
  raise "Could not find a valid version to submit for review"
211
211
  end
212
-
212
+
213
213
  Spaceship::AppSubmission.create(self, self.apple_id, version)
214
214
  end
215
215
 
@@ -229,7 +229,6 @@ module Spaceship
229
229
  # @!group General
230
230
  #####################################################
231
231
  def setup
232
-
233
232
  end
234
233
 
235
234
  #####################################################
@@ -273,8 +272,8 @@ module Spaceship
273
272
  def add_external_tester!(email: nil, first_name: nil, last_name: nil)
274
273
  raise "Tester is already on #{self.name} betatesters" if find_external_tester(email)
275
274
 
276
- tester = Tunes::Tester.external.find(email) || Tunes::Tester.external.create!(email: email,
277
- first_name: first_name,
275
+ tester = Tunes::Tester.external.find(email) || Tunes::Tester.external.create!(email: email,
276
+ first_name: first_name,
278
277
  last_name: last_name)
279
278
  tester.add_to_app!(self.apple_id)
280
279
  end
@@ -6,7 +6,7 @@ module Spaceship
6
6
  #####################################################
7
7
  # @!group General metadata
8
8
  #####################################################
9
-
9
+
10
10
  # @return (Spaceship::Tunes::BuildTrain) A reference to the build train this build is contained in
11
11
  attr_accessor :build_train
12
12
 
@@ -44,11 +44,10 @@ module Spaceship
44
44
  # this is only true after the build was approved by Apple
45
45
  attr_accessor :external_testing_enabled
46
46
 
47
-
48
47
  # @return (Bool) Does this build support WatchKit?
49
48
  attr_accessor :watch_kit_enabled
50
49
 
51
- # @return (Bool):
50
+ # @return (Bool):
52
51
  attr_accessor :ready_to_install
53
52
 
54
53
  #####################################################
@@ -88,7 +87,7 @@ module Spaceship
88
87
  'internalExpiry' => :internal_expiry_date,
89
88
  'externalExpiry' => :external_expiry_date,
90
89
  'watchKitEnabled' => :watch_kit_enabled,
91
- 'readyToInstall' => :ready_to_install,
90
+ 'readyToInstall' => :ready_to_install
92
91
  )
93
92
 
94
93
  class << self
@@ -129,9 +128,9 @@ module Spaceship
129
128
  def submit_for_beta_review!(metadata)
130
129
  # First, enable beta testing for this train (per iTC requirement)
131
130
  self.build_train.update_testing_status!(true)
132
-
131
+
133
132
  parameters = {
134
- app_id: self.build_train.application.apple_id,
133
+ app_id: self.build_train.application.apple_id,
135
134
  train: self.build_train.version_string,
136
135
  build_number: self.build_version,
137
136
 
@@ -182,7 +181,7 @@ module Spaceship
182
181
 
183
182
  # This will cancel the review process for this TestFlight build
184
183
  def cancel_beta_review!
185
- client.remove_testflight_build_from_review!(app_id: self.build_train.application.apple_id,
184
+ client.remove_testflight_build_from_review!(app_id: self.build_train.application.apple_id,
186
185
  train: self.build_train.version_string,
187
186
  build_number: self.build_version)
188
187
  end
@@ -54,7 +54,7 @@ module Spaceship
54
54
  # Setup all the builds and processing builds
55
55
  def setup
56
56
  super
57
-
57
+
58
58
  @builds = self.raw_data['builds'].collect do |attrs|
59
59
  attrs.merge!(build_train: self)
60
60
  Tunes::Build.factory(attrs)
@@ -78,4 +78,4 @@ module Spaceship
78
78
  end
79
79
  end
80
80
  end
81
- end
81
+ end
@@ -28,23 +28,24 @@ module Spaceship
28
28
  end
29
29
 
30
30
  private
31
+
31
32
  # Path to the gem to fetch resoures
32
- def spaceship_gem_path
33
- if Gem::Specification::find_all_by_name('spaceship').any?
34
- return Gem::Specification.find_by_name('spaceship').gem_dir
35
- else
36
- return './'
37
- end
33
+ def spaceship_gem_path
34
+ if Gem::Specification::find_all_by_name('spaceship').any?
35
+ return Gem::Specification.find_by_name('spaceship').gem_dir
36
+ else
37
+ return './'
38
38
  end
39
+ end
39
40
 
40
41
  # Get the mapping JSON parsed
41
- def mapping
42
- @languages ||= JSON.parse(File.read(File.join(spaceship_gem_path, "lib", "assets", "languageMapping.json")))
43
- end
42
+ def mapping
43
+ @languages ||= JSON.parse(File.read(File.join(spaceship_gem_path, "lib", "assets", "languageMapping.json")))
44
+ end
44
45
 
45
- def readable_mapping
46
- @readable ||= JSON.parse(File.read(File.join(spaceship_gem_path, "lib", "assets", "languageMappingReadable.json")))
47
- end
46
+ def readable_mapping
47
+ @readable ||= JSON.parse(File.read(File.join(spaceship_gem_path, "lib", "assets", "languageMappingReadable.json")))
48
+ end
48
49
  end
49
50
  end
50
51
  end
@@ -58,4 +59,4 @@ class String
58
59
  def to_full_language
59
60
  Spaceship::Tunes::LanguageConverter.from_standard_to_itc(self)
60
61
  end
61
- end
62
+ end
@@ -51,4 +51,4 @@ module Spaceship
51
51
  end
52
52
  end
53
53
  end
54
- end
54
+ end
@@ -27,4 +27,4 @@ module Spaceship
27
27
  end
28
28
  end
29
29
  end
30
- end
30
+ end
@@ -8,19 +8,19 @@ module Spaceship
8
8
  # Authenticates with Apple's web services. This method has to be called once
9
9
  # to generate a valid session. The session will automatically be used from then
10
10
  # on.
11
- #
11
+ #
12
12
  # This method will automatically use the username from the Appfile (if available)
13
13
  # and fetch the password from the Keychain (if available)
14
- #
14
+ #
15
15
  # @param user (String) (optional): The username (usually the email address)
16
16
  # @param password (String) (optional): The password
17
- #
17
+ #
18
18
  # @raise InvalidUserCredentialsError: raised if authentication failed
19
- #
19
+ #
20
20
  # @return (Spaceship::Client) The client the login method was called for
21
21
  def login(user = nil, password = nil)
22
22
  @client = TunesClient.login(user, password)
23
23
  end
24
24
  end
25
25
  end
26
- end
26
+ end
@@ -3,22 +3,22 @@ module Spaceship
3
3
  class Tester < TunesBase
4
4
 
5
5
  # @return (String) The identifier of this tester, provided by iTunes Connect
6
- # @example
6
+ # @example
7
7
  # "60f858b4-60a8-428a-963a-f943a3d68d17"
8
8
  attr_accessor :tester_id
9
9
 
10
10
  # @return (String) The email of this tester
11
- # @example
11
+ # @example
12
12
  # "tester@spaceship.com"
13
13
  attr_accessor :email
14
-
14
+
15
15
  # @return (String) The first name of this tester
16
- # @example
16
+ # @example
17
17
  # "Cary"
18
18
  attr_accessor :first_name
19
19
 
20
20
  # @return (String) The last name of this tester
21
- # @example
21
+ # @example
22
22
  # "Bennett"
23
23
  attr_accessor :last_name
24
24
 
@@ -32,7 +32,6 @@ module Spaceship
32
32
  # }]
33
33
  attr_accessor :devices
34
34
 
35
-
36
35
  # Information about the most recent beta install
37
36
  # @return [Integer] The ID of the most recently installed app
38
37
  attr_accessor :latest_install_app_id
@@ -56,7 +55,7 @@ module Spaceship
56
55
  'latestInstalledAppAdamId' => :latest_install_app_id,
57
56
  'latestInstalledDate' => :latest_install_date,
58
57
  'latestInstalledVersion' => :latest_installed_version_number,
59
- 'latestInstalledShortVersion' => :latest_installed_build_number,
58
+ 'latestInstalledShortVersion' => :latest_installed_build_number
60
59
  )
61
60
 
62
61
  class << self
@@ -90,10 +89,10 @@ module Spaceship
90
89
  # @param email (String) (required): The email of the new tester
91
90
  # @param first_name (String) (optional): The first name of the new tester
92
91
  # @param last_name (String) (optional): The last name of the new tester
93
- # @example
92
+ # @example
94
93
  # Spaceship::Tunes::Tester.external.create!(email: "tester@mathiascarignani.com", first_name: "Cary", last_name:"Bennett")
95
94
  # @return (Tester): The newly created tester
96
- def create!(email: nil, first_name: nil, last_name: nil)
95
+ def create!(email: nil, first_name: nil, last_name: nil)
97
96
  data = client.create_tester!(tester: self,
98
97
  email: email,
99
98
  first_name: first_name,
@@ -107,7 +106,7 @@ module Spaceship
107
106
 
108
107
  # @return (Array) Returns all beta testers available for this account filtered by app
109
108
  # @param app_id (String) (required): The app id to filter the testers
110
- def all_by_app(app_id)
109
+ def all_by_app(app_id)
111
110
  client.testers_by_app(self, app_id).map { |tester| self.factory(tester) }
112
111
  end
113
112
 
@@ -128,7 +127,7 @@ module Spaceship
128
127
  begin
129
128
  tester.add_to_app!(app_id)
130
129
  rescue => ex
131
- if ex.to_s.include?"testerEmailExistsInternal" or ex.to_s.include?"duplicate.email"
130
+ if ex.to_s.include? "testerEmailExistsInternal" or ex.to_s.include? "duplicate.email"
132
131
  # That's a non-relevant error message by iTC
133
132
  # ignore that
134
133
  else
@@ -146,7 +145,7 @@ module Spaceship
146
145
  #####################################################
147
146
  # @!group Subclasses
148
147
  #####################################################
149
- class External < Tester
148
+ class External < Tester
150
149
  def self.url(app_id = nil)
151
150
  {
152
151
  index: "ra/users/pre/ext",
@@ -158,7 +157,7 @@ module Spaceship
158
157
  end
159
158
  end
160
159
 
161
- class Internal < Tester
160
+ class Internal < Tester
162
161
  def self.url(app_id = nil)
163
162
  {
164
163
  index: "ra/users/pre/int",
@@ -171,7 +170,7 @@ module Spaceship
171
170
  end
172
171
 
173
172
  # Delete current tester
174
- def delete!
173
+ def delete!
175
174
  client.delete_tester!(self)
176
175
  end
177
176
 
@@ -192,4 +191,4 @@ module Spaceship
192
191
  end
193
192
  end
194
193
  end
195
- end
194
+ end