spaceship 0.26.3 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ecda13a0ac45078ad0e08f7abc3518a8a4f5bb44
4
- data.tar.gz: e305bdacb1c19d9c7840c36ae98ae16743697359
3
+ metadata.gz: 429cc67c199e32d7f2e55aa822a6b4de8270df3f
4
+ data.tar.gz: b045bde4d81c758d7382ffabc8c46ccd2377fe17
5
5
  SHA512:
6
- metadata.gz: c1f86d60293a4bda95488ca705ada246f48f51eaa771b7812d07db932922b653d42b46dbdda6b37301e483f10cb632de178e681b160721d90f47a5d0d9909752
7
- data.tar.gz: 49123b5c67df77ad583984e36464093a508ea95e83a0552297c34f90500717d790154c6e34ab63e0861aef18d6fe47911e08e54e99c4af69dddfc37df3a8edc1
6
+ metadata.gz: f8714341e6951b1eacfc03c9cea0df512f4b5da3d39d671bbf34b8a3be4ef785f7e98bf36c2ff1987fe30ce367e988b37575c7a8d8a8488c183eedcad5466221
7
+ data.tar.gz: 42f76298463d24677037dcd29d8514e6cdf0c6465006190ff5de131572e868af92668380371dea0e64b9f150a3fb379da7dc7dc750dc297cc6535f2ebbc83cf4
@@ -3,7 +3,7 @@ module Spaceship
3
3
  # Spaceship::Base is the superclass for models in Apple Developer Portal.
4
4
  # It's mainly responsible for mapping responses to objects.
5
5
  #
6
- # A class-level attribute `client` is used to maintain the which spaceship we
6
+ # A class-level attribute `client` is used to maintain the spaceship which we
7
7
  # are using to talk to ADP.
8
8
  #
9
9
  # Example of creating a new ADP model:
@@ -218,45 +218,24 @@ module Spaceship
218
218
  end
219
219
  end
220
220
 
221
- # @return [Array]A list of binaries which are not even yet processing based on the version
222
- # These are all build that have no information except the upload date
223
- # Those builds can also be the builds that are stuck on iTC.
224
- def pre_processing_builds
225
- data = client.build_trains(apple_id, 'internal') # we need to fetch all trains here to get the builds
226
-
227
- builds = data.fetch('processingBuilds', []).collect do |attrs|
228
- attrs[:build_train] = self
229
- Tunes::ProcessingBuild.factory(attrs)
230
- end
231
-
232
- builds.delete_if { |a| a.state.include?("invalidBinary") }
233
-
234
- builds
235
- end
236
-
237
- # @return [Array]A list of binaries which are in the invalid state
238
- def invalid_builds
239
- data = client.build_trains(apple_id, 'internal') # we need to fetch all trains here to get the builds
221
+ # @return [Array] A list of all builds in an invalid state
222
+ def all_invalid_builds
223
+ builds = []
240
224
 
241
- builds = data.fetch('processingBuilds', []).collect do |attrs|
242
- attrs[:build_train] = self
243
- Tunes::ProcessingBuild.factory(attrs)
225
+ self.build_trains.values.each do |train|
226
+ builds.concat(train.invalid_builds)
244
227
  end
245
228
 
246
- builds.delete_if { |a| !a.state.include?("invalidBinary") }
247
-
248
- builds
229
+ return builds
249
230
  end
250
231
 
251
232
  # @return [Array] This will return an array of *all* processing builds
252
233
  # this include pre-processing or standard processing
253
234
  def all_processing_builds
254
- builds = self.pre_processing_builds
235
+ builds = []
255
236
 
256
- self.build_trains.each do |version_number, train|
257
- train.processing_builds.each do |build|
258
- builds << build
259
- end
237
+ self.build_trains.values.each do |train|
238
+ builds.concat(train.processing_builds)
260
239
  end
261
240
 
262
241
  return builds
@@ -29,6 +29,11 @@ module Spaceship
29
29
  # @return (Boolean) Is this build currently processing?
30
30
  attr_accessor :processing
31
31
 
32
+ # @return (String) The build processing state, may be nil
33
+ # @example "invalidBinary"
34
+ # @example "processingFailed"
35
+ attr_accessor :processing_state
36
+
32
37
  # @return (Integer) The number of ticks since 1970 (e.g. 1413966436000)
33
38
  attr_accessor :upload_date
34
39
 
@@ -91,6 +96,7 @@ module Spaceship
91
96
  'id' => :id,
92
97
  'valid' => :valid,
93
98
  'processing' => :processing,
99
+ 'processingState' => :processing_state,
94
100
 
95
101
  'installCount' => :install_count,
96
102
  'internalInstallCount' => :internal_install_count,
@@ -230,6 +236,7 @@ end
230
236
  # "exceededFileSizeLimit"=>false,
231
237
  # "wentLiveWithVersion"=>false,
232
238
  # "processing"=>false,
239
+ # "processingState": nil,
233
240
  # "id"=>5298023,
234
241
  # "valid"=>true,
235
242
  # "missingExportCompliance"=>false,
@@ -3,8 +3,7 @@ module Spaceship
3
3
  # Represents a build train of builds from iTunes Connect
4
4
  # A build train is all builds for a given version number with different build numbers
5
5
  class BuildTrain < TunesBase
6
- # @return (Spaceship::Tunes::Application) A reference to the application
7
- # this train is for
6
+ # @return (Spaceship::Tunes::Application) A reference to the application this train is for
8
7
  attr_accessor :application
9
8
 
10
9
  # @return (Array) An array of all builds that are inside this train (Spaceship::Tunes::Build)
@@ -22,10 +21,14 @@ module Spaceship
22
21
  # @return (Bool) Is internal beta testing enabled for this train? Only one train can have enabled testing.
23
22
  attr_reader :internal_testing_enabled
24
23
 
25
- # @return (Array) An array of all builds that are inside this train (Spaceship::Tunes::Build)
24
+ # @return (Array) An array of all processing builds that are inside this train (Spaceship::Tunes::Build)
25
+ # Does not include invalid builds.
26
26
  # I never got this to work to properly try and debug this
27
27
  attr_reader :processing_builds
28
28
 
29
+ # @return (Array) An array of all invalid builds that are inside this train
30
+ attr_reader :invalid_builds
31
+
29
32
  attr_mapping(
30
33
  'versionString' => :version_string,
31
34
  'platform' => :platform,
@@ -66,6 +69,12 @@ module Spaceship
66
69
  Tunes::Build.factory(attrs)
67
70
  end
68
71
 
72
+ @invalid_builds = @builds.select do |build|
73
+ build.processing_state == 'processingFailed' || build.processing_state == 'invalidBinary'
74
+ end
75
+
76
+ # This step may not be necessary anymore - it seems as if every processing build will be caught by the
77
+ # @builds.each below, but not every processing build makes it to buildsInProcessing, so this is redundant
69
78
  @processing_builds = (self.raw_data['buildsInProcessing'] || []).collect do |attrs|
70
79
  attrs[:build_train] = self
71
80
  Tunes::Build.factory(attrs)
@@ -73,7 +82,24 @@ module Spaceship
73
82
 
74
83
  # since buildsInProcessing appears empty, fallback to also including processing state from @builds
75
84
  @builds.each do |build|
76
- @processing_builds << build if build.processing == true && build.valid == true
85
+ # What combination of attributes constitutes which state is pretty complicated. The table below summarizes
86
+ # what I've observed, but there's no reason to believe there aren't more states I just haven't seen yet.
87
+ # The column headers are qualitative states of a given build, and the first column is the observed attributes
88
+ # of that build.
89
+ # NOTE: Some of the builds in the build_trains.json fixture do not follow these rules. I don't know if that is
90
+ # because those examples are older, and the iTC API has changed, or if their format is still a possibility.
91
+ # The second part of the OR clause in the line below exists so that those suspicious examples continue to be
92
+ # accepted for unit tests.
93
+ # +---------------------+-------------------+-------------------+-----------------+--------------------+---------+
94
+ # | | just after upload | normal processing | invalid binary | processing failed | success |
95
+ # +---------------------+-------------------+-------------------+-----------------+--------------------+---------+
96
+ # | build.processing = | true | true | true | true | false |
97
+ # | build.valid = | false | true | false | true | true |
98
+ # | .processing_state = | "processing" | "processing" | "invalidBinary" | "processingFailed" | nil |
99
+ # +---------------------+-------------------+-------------------+-----------------+--------------------+---------+
100
+ if build.processing_state == 'processing' || (build.processing && build.processing_state != 'invalidBinary' && build.processing_state != 'processingFailed')
101
+ @processing_builds << build
102
+ end
77
103
  end
78
104
  end
79
105
 
@@ -98,9 +124,9 @@ module Spaceship
98
124
 
99
125
  # also update the builds
100
126
  train['builds'].delete_if do |b|
101
- return true if b[testing_key].nil?
102
-
103
- if build && b["buildVersion"] == build.build_version
127
+ if b[testing_key].nil?
128
+ true
129
+ elsif build && b["buildVersion"] == build.build_version
104
130
  b[testing_key]['value'] = new_value
105
131
  false
106
132
  elsif b[testing_key]['value'] == true
@@ -16,7 +16,6 @@ require 'spaceship/tunes/app_screenshot'
16
16
  require 'spaceship/tunes/language_converter'
17
17
  require 'spaceship/tunes/build'
18
18
  require 'spaceship/tunes/build_details'
19
- require 'spaceship/tunes/processing_build'
20
19
  require 'spaceship/tunes/build_train'
21
20
  require 'spaceship/tunes/device_type'
22
21
  require 'spaceship/tunes/app_trailer'
@@ -1,3 +1,3 @@
1
1
  module Spaceship
2
- VERSION = "0.26.3".freeze
2
+ VERSION = "0.27.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spaceship
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.3
4
+ version: 0.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-13 00:00:00.000000000 Z
12
+ date: 2016-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: credentials_manager
@@ -361,7 +361,6 @@ files:
361
361
  - lib/spaceship/tunes/language_converter.rb
362
362
  - lib/spaceship/tunes/language_item.rb
363
363
  - lib/spaceship/tunes/pricing_tier.rb
364
- - lib/spaceship/tunes/processing_build.rb
365
364
  - lib/spaceship/tunes/recovery_device.rb
366
365
  - lib/spaceship/tunes/spaceship.rb
367
366
  - lib/spaceship/tunes/tester.rb
@@ -393,7 +392,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
393
392
  version: '0'
394
393
  requirements: []
395
394
  rubyforge_project:
396
- rubygems_version: 2.4.5.1
395
+ rubygems_version: 2.4.8
397
396
  signing_key:
398
397
  specification_version: 4
399
398
  summary: Because you would rather spend your time building stuff than fighting provisioning
@@ -1,29 +0,0 @@
1
- module Spaceship
2
- module Tunes
3
- # Represents a build which doesn't have a version number yet and is either processing or is stuck
4
- class ProcessingBuild < Build
5
- # @return [String] The state of this build
6
- # @example
7
- # ITC.apps.betaProcessingStatus.InvalidBinary
8
- # @example
9
- # ITC.apps.betaProcessingStatus.Created
10
- # @example
11
- # ITC.apps.betaProcessingStatus.Uploaded
12
- attr_accessor :state
13
-
14
- # @return (Integer) The number of ticks since 1970 (e.g. 1413966436000)
15
- attr_accessor :upload_date
16
-
17
- attr_mapping(
18
- 'processingState' => :state,
19
- 'uploadDate' => :upload_date
20
- )
21
-
22
- class << self
23
- def factory(attrs)
24
- self.new(attrs)
25
- end
26
- end
27
- end
28
- end
29
- end