spaceship 0.12.3 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5e10edaa81463ade7270eab6924946ba77d9d5c
4
- data.tar.gz: da2ba6567d281e66330b93ad1de33a8d77008beb
3
+ metadata.gz: 7f320dc10c8beb481061cee00b00952c4d656eb3
4
+ data.tar.gz: 750140edc4537b38f80b782456d49eefeec4ea82
5
5
  SHA512:
6
- metadata.gz: a6e16adf655c57aa21706b3695ffa5508b0d9ec1ea9c03e104e439bddc485c7b00963994903eb2fc42967c7ce5fe8101f914bbe20288a189e56349dcdb693298
7
- data.tar.gz: 4d5af58985c1131466d504b433244cb7dfd522d451b5a6dce990191c6ff376851e58da4654302902759174e7346a0b0fea970d2af2fd971752697558f369c0e2
6
+ metadata.gz: 421a933e650f90764d5e738d576a11bf651128e9c1f44f92d164609ed21327f1aaded3c2cf86290be74c0b93ec11fd661baf937c989c0fab58cb8e554b269114
7
+ data.tar.gz: dc02e790d92efceda4cfea894a0c098ee4d13887c06f4366c6ca911071086e582dfe170b729c15a250cb9457bc1fc7f8addb196c0219cd9c5aff0f771a345792
@@ -33,6 +33,9 @@ module Spaceship
33
33
 
34
34
  class UnexpectedResponse < StandardError; end
35
35
 
36
+ # Raised when 302 is received from portal request
37
+ class AppleTimeoutError < StandardError; end
38
+
36
39
  # Authenticates with Apple's web services. This method has to be called once
37
40
  # to generate a valid session. The session will automatically be used from then
38
41
  # on.
@@ -173,8 +176,9 @@ module Spaceship
173
176
 
174
177
  def with_retry(tries = 5, &block)
175
178
  return block.call
176
- rescue Faraday::Error::TimeoutError => ex # New Faraday version: Faraday::TimeoutError => ex
179
+ rescue Faraday::Error::TimeoutError, AppleTimeoutError => ex # New Faraday version: Faraday::TimeoutError => ex
177
180
  unless (tries -= 1).zero?
181
+ logger.warn("Timeout received: '#{ex.message}'. Retrying after 3 seconds (remaining: #{tries})...")
178
182
  sleep 3
179
183
  retry
180
184
  end
@@ -240,7 +244,11 @@ module Spaceship
240
244
  # Automatically retries the request up to 3 times if something goes wrong
241
245
  def send_request(method, url_or_path, params, headers, &block)
242
246
  with_retry do
243
- @client.send(method, url_or_path, params, headers, &block)
247
+ response = @client.send(method, url_or_path, params, headers, &block)
248
+ if response.body.to_s.include?("<title>302 Found</title>")
249
+ raise AppleTimeoutError.new, "Apple 302 detected"
250
+ end
251
+ return response
244
252
  end
245
253
  end
246
254
 
@@ -73,15 +73,19 @@ module Spaceship
73
73
  parse_upload_response(r)
74
74
  end
75
75
 
76
+ # You can find this by uploading an image in iTunes connect
77
+ # then look for the X-Apple-Upload-Validation-RuleSets value
76
78
  def picture_type_map
77
79
  # rubocop:enable Style/ExtraSpacing
78
80
  {
79
81
  watch: "MZPFT.SortedN27ScreenShot",
80
82
  ipad: "MZPFT.SortedTabletScreenShot",
83
+ ipadPro: "MZPFT.SortedJ99ScreenShot",
81
84
  iphone6: "MZPFT.SortedN61ScreenShot",
82
85
  iphone6Plus: "MZPFT.SortedN56ScreenShot",
83
86
  iphone4: "MZPFT.SortedN41ScreenShot",
84
- iphone35: "MZPFT.SortedScreenShot"
87
+ iphone35: "MZPFT.SortedScreenShot",
88
+ appleTV: "MZPFT.SortedATVScreenShot"
85
89
  }
86
90
  end
87
91
 
@@ -164,9 +164,10 @@ module Spaceship
164
164
  raise "Can't find class '#{attrs['distributionMethod']}'"
165
165
  end
166
166
 
167
- attrs['appId'] = App.factory(attrs['appId'])
168
- attrs['devices'].map! { |device| Device.factory(device) }
169
- attrs['certificates'].map! { |cert| Certificate.factory(cert) }
167
+ # eagerload the Apps, Devices, and Certificates using the same client if we have to.
168
+ attrs['appId'] = App.set_client(@client).factory(attrs['appId'])
169
+ attrs['devices'].map! { |device| Device.set_client(@client).factory(device) }
170
+ attrs['certificates'].map! { |cert| Certificate.set_client(@client).factory(cert) }
170
171
 
171
172
  klass.client = @client
172
173
  klass.new(attrs)
@@ -279,7 +279,7 @@ module Spaceship
279
279
  @app_status = Tunes::AppStatus.get_from_string(status)
280
280
  setup_large_app_icon
281
281
  setup_watch_app_icon
282
- setup_transit_app_file
282
+ setup_transit_app_file if supports_app_transit?
283
283
  setup_screenshots
284
284
  setup_trailers
285
285
  end
@@ -467,6 +467,10 @@ module Spaceship
467
467
  @watch_app_icon = Tunes::AppImage.factory(watch_app_icon) if watch_app_icon
468
468
  end
469
469
 
470
+ def supports_app_transit?
471
+ raw_data["transitAppFile"] != nil
472
+ end
473
+
470
474
  def setup_transit_app_file
471
475
  transit_app_file = raw_data["transitAppFile"]["value"]
472
476
  @transit_app_file = nil
@@ -1,7 +1,7 @@
1
1
  module Spaceship
2
2
  module Tunes
3
3
  class DeviceType
4
- @types = ['iphone4', 'iphone35', 'iphone6', 'iphone6Plus', 'ipad', 'watch']
4
+ @types = ['iphone4', 'iphone35', 'iphone6', 'iphone6Plus', 'ipad', 'ipadPro', 'watch', 'appleTV']
5
5
  class << self
6
6
  attr_accessor :types
7
7
 
@@ -20,7 +20,8 @@ module Spaceship
20
20
  'iphone4' => [1136, 640],
21
21
  'iphone6' => [1334, 750],
22
22
  'iphone6Plus' => [2208, 1242],
23
- 'ipad' => [1024, 768]
23
+ 'ipad' => [1024, 768],
24
+ 'ipadPro' => [2732, 2048]
24
25
  }
25
26
 
26
27
  r = resolutions[device]
@@ -252,16 +253,17 @@ module Spaceship
252
253
  r = request(:get, "ra/apps/#{app_id}/overview")
253
254
  platforms = parse_response(r, 'data')['platforms']
254
255
 
255
- # An app can only have either ios or mac, but we ignore apple tv right now
256
+ # We only support platforms that exist ATM
256
257
  platform = platforms.find do |p|
257
- p['platformString'] == 'ios' or p['platformString'] == 'osx'
258
+ ['ios', 'osx', 'appletvos'].include? p['platformString']
258
259
  end
259
260
 
260
261
  version = platform[(is_live ? 'deliverableVersion' : 'inFlightVersion')]
261
262
  return nil unless version
262
263
  version_id = version['id']
264
+ version_platform = platform['platformString']
263
265
 
264
- r = request(:get, "ra/apps/#{app_id}/platforms/ios/versions/#{version_id}")
266
+ r = request(:get, "ra/apps/#{app_id}/platforms/#{version_platform}/versions/#{version_id}")
265
267
  parse_response(r, 'data')
266
268
  end
267
269
 
@@ -1,3 +1,3 @@
1
1
  module Spaceship
2
- VERSION = "0.12.3"
2
+ VERSION = "0.13.0"
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.12.3
4
+ version: 0.13.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: 2015-10-23 00:00:00.000000000 Z
12
+ date: 2015-10-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: credentials_manager