spaceship 0.13.1 → 0.14.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: 49b906e19473b4638c1dbffbac020229a5006e6c
4
- data.tar.gz: 5e196ab71b5968a848187769fd8d62dc7533ea16
3
+ metadata.gz: 370ec337b82d693b4f075578ab84890ab2902e5f
4
+ data.tar.gz: 5e2606ea51d5c94ef8ec6f4f965f30c33a791ef8
5
5
  SHA512:
6
- metadata.gz: acf0ee0634a46f5993255c8d418c3456f5bc1016556cd895e643191a8866060d744ee29a4e87b31d20abb470b0d2b60c7988b7abe1c26bf01acabbd223fed5d0
7
- data.tar.gz: b138f95e93e2141f86ed4f9b45c88cbc2e3958731b93fc7edbbd5cf628b711f79400e483fe4ddfb4f3541763c47f86d95872289083de537628eb2d0485724c73
6
+ metadata.gz: df4dcbb65bea1cf44d5d67e2f07131970efef005f3467ea4d0311a1800496be35ba21478e10fb9fd6166670369ead31a2395163fef4db86f8f6523addb5fdd9f
7
+ data.tar.gz: ebb2ecb1788a9c54a0613faf5d313c6ee12616c5373b66641c8deb7cabce6fa72690f3bdc3cf4be2cf3b271c50191da9e1306500617b1b83c814b5eaef18e069
data/README.md CHANGED
@@ -154,7 +154,7 @@ I won't go into too much technical details about the various API endpoints, but
154
154
  - Managing apps
155
155
  - Managing beta testers
156
156
  - Submitting updates to review
157
- - Manaing app metadata
157
+ - Managing app metadata
158
158
  - `https://du-itc.itunesconnect.apple.com`:
159
159
  - Upload icons, screenshots, trailers ...
160
160
 
@@ -203,7 +203,7 @@ module Spaceship
203
203
  @attributes ||= []
204
204
  par = []
205
205
 
206
- par = (self.superclass.attributes || []) unless (self == Base)
206
+ par = (self.superclass.attributes || []) unless self == Base
207
207
 
208
208
  @attributes + par
209
209
  end
@@ -197,7 +197,7 @@ module Spaceship
197
197
  # If this is called from a subclass of Certificate, this will
198
198
  # only include certificates matching the current type.
199
199
  def all
200
- if (self == Certificate) # are we the base-class?
200
+ if self == Certificate # are we the base-class?
201
201
  types = CERTIFICATE_TYPE_IDS.keys
202
202
  else
203
203
  types = [CERTIFICATE_TYPE_IDS.key(self)]
@@ -225,14 +225,14 @@ module Spaceship
225
225
  end
226
226
  end
227
227
 
228
- def devices_by_class(deviceClass)
228
+ def devices_by_class(device_class)
229
229
  paging do |page_number|
230
230
  r = request(:post, 'account/ios/device/listDevices.action', {
231
231
  teamId: team_id,
232
232
  pageNumber: page_number,
233
233
  pageSize: page_size,
234
234
  sort: 'name=asc',
235
- deviceClasses: deviceClass
235
+ deviceClasses: device_class
236
236
  })
237
237
  parse_response(r, 'devices')
238
238
  end
@@ -43,8 +43,8 @@ module Spaceship
43
43
  # User provided a value, let's see if it's valid
44
44
  teams.each_with_index do |team, i|
45
45
  # There are 2 different values - one from the login page one from the Dev Team Page
46
- return team['teamId'] if (team['teamId'].strip == team_id)
47
- return team['teamId'] if (team['currentTeamMember']['teamMemberId'].to_s.strip == team_id)
46
+ return team['teamId'] if team['teamId'].strip == team_id
47
+ return team['teamId'] if team['currentTeamMember']['teamMemberId'].to_s.strip == team_id
48
48
  end
49
49
  puts "Couldn't find team with ID '#{team_id}'"
50
50
  end
@@ -52,7 +52,7 @@ module Spaceship
52
52
  if team_name.length > 0
53
53
  # User provided a value, let's see if it's valid
54
54
  teams.each_with_index do |team, i|
55
- return team['teamId'] if (team['name'].strip == team_name)
55
+ return team['teamId'] if team['name'].strip == team_name
56
56
  end
57
57
  puts "Couldn't find team with Name '#{team_name}'"
58
58
  end
@@ -566,7 +566,7 @@ module Spaceship
566
566
  expected_resolution = TunesClient.video_preview_resolution_for(device, is_portrait)
567
567
  actual_resolution = Utilities.resolution(preview_screenshot_path)
568
568
  orientation = is_portrait ? "portrait" : "landscape"
569
- raise "Invalid #{orientation} screenshot resolution for device #{device}. Should be #{expected_resolution}" unless (actual_resolution == expected_resolution)
569
+ raise "Invalid #{orientation} screenshot resolution for device #{device}. Should be #{expected_resolution}" unless actual_resolution == expected_resolution
570
570
  end
571
571
 
572
572
  def raw_data_details
@@ -165,6 +165,7 @@ module Spaceship
165
165
  last_name: "Krause",
166
166
  review_email: "contact@company.com",
167
167
  phone_number: "0123456789",
168
+ significant_change: false,
168
169
 
169
170
  # Optional Metadata:
170
171
  privacy_policy_url: nil,
@@ -72,13 +72,29 @@ module Spaceship
72
72
  end
73
73
  end
74
74
 
75
+ # @return (Spaceship::Tunes::Build) The latest build for this train, sorted by upload time.
76
+ def latest_build
77
+ @builds.max_by(&:upload_date)
78
+ end
79
+
75
80
  # @param (testing_type) internal or external
76
- def update_testing_status!(new_value, testing_type)
81
+ def update_testing_status!(new_value, testing_type, build = nil)
77
82
  data = client.build_trains(self.application.apple_id, testing_type)
78
83
 
84
+ build ||= latest_build if testing_type == 'external'
85
+
79
86
  data['trains'].each do |train|
80
87
  train["#{testing_type}Testing"]['value'] = false
81
88
  train["#{testing_type}Testing"]['value'] = new_value if train['versionString'] == version_string
89
+
90
+ # also update the builds
91
+ train['builds'].each do |b|
92
+ next if b["#{testing_type}Testing"].nil?
93
+ next if build.nil?
94
+ next if b["buildVersion"] != build.build_version
95
+ b["#{testing_type}Testing"]['value'] = false
96
+ b["#{testing_type}Testing"]['value'] = new_value if b['trainVersion'] == version_string
97
+ end
82
98
  end
83
99
 
84
100
  result = client.update_build_trains!(application.apple_id, testing_type, data)
@@ -38,33 +38,39 @@ module Spaceship
38
38
  "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/"
39
39
  end
40
40
 
41
- # Fetches the latest login URL from iTunes Connect
42
- def login_url
43
- cache_path = "/tmp/spaceship_itc_login_url.txt"
44
- begin
45
- cached = File.read(cache_path)
46
- rescue Errno::ENOENT
47
- end
48
- return cached if cached
41
+ # returns wosinst, wosid and itctx
42
+ def login_overhead_cookies(myacinfo)
43
+ return @login_overhead_cookies if @login_overhead_cookies
44
+
45
+ response = request(:get, "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/wa/route?noext") # for woinst and wosid
46
+ cookies = {
47
+ woinst: response['Set-Cookie'].match(/woinst=([^;]*)/)[1],
48
+ wosid: response['Set-Cookie'].match(/wosid=([^;]*)/)[1],
49
+ myacinfo: myacinfo
50
+ }
49
51
 
50
- host = "https://itunesconnect.apple.com"
51
- begin
52
- url = host + request(:get, self.class.hostname).body.match(%r{action="(/WebObjects/iTunesConnect.woa/wo/.*)"})[1]
53
- raise "" unless url.length > 0
54
-
55
- File.write(cache_path, url)
56
- return url
57
- rescue => ex
58
- puts ex
59
- raise "Could not fetch the login URL from iTunes Connect, the server might be down"
52
+ # The second request has to be after getting the woinst and wois
53
+ woa = request(:get) do |req|
54
+ req.url "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa"
55
+ req.headers["Cookie"] = cookies.collect { |k, v| "#{k}=#{v}; " }.join("")
60
56
  end
57
+ cookies[:itctx] = woa['Set-Cookie'].match(/itctx=([^;]*)/)[1]
58
+
59
+ return @login_overhead_cookies ||= cookies
61
60
  end
62
61
 
63
62
  def send_login_request(user, password)
64
- response = request(:post, login_url, {
65
- theAccountName: user,
66
- theAccountPW: password
67
- })
63
+ data = {
64
+ accountName: user,
65
+ password: password,
66
+ rememberMe: true
67
+ }
68
+
69
+ response = request(:post) do |req|
70
+ req.url "https://idmsa.apple.com/appleauth/auth/signin"
71
+ req.body = data.to_json
72
+ req.headers['Content-Type'] = 'application/json'
73
+ end
68
74
 
69
75
  if response['Set-Cookie'] =~ /myacinfo=(\w+);/
70
76
  # To use the session properly we'll need the following cookies:
@@ -74,15 +80,10 @@ module Spaceship
74
80
  # - itctx
75
81
  begin
76
82
  re = response['Set-Cookie']
83
+ myacinfo = re.match(/myacinfo=([^;]*)/)[1]
84
+ cookies = login_overhead_cookies(myacinfo)
77
85
 
78
- to_use = [
79
- "myacinfo=" + re.match(/myacinfo=([^;]*)/)[1],
80
- "woinst=" + re.match(/woinst=([^;]*)/)[1],
81
- "itctx=" + re.match(/itctx=([^;]*)/)[1],
82
- "wosid=" + re.match(/wosid=([^;]*)/)[1]
83
- ]
84
-
85
- @cookie = to_use.join(';')
86
+ @cookie = cookies.collect { |k, v| "#{k}=#{v}; " }.join("")
86
87
  rescue
87
88
  raise ITunesConnectError.new, [response.body, response['Set-Cookie']].join("\n")
88
89
  end
@@ -499,7 +500,6 @@ module Spaceship
499
500
  handle_itc_response(r.body)
500
501
  end
501
502
 
502
- # rubocop:disable Metrics/AbcSize
503
503
  def submit_testflight_build_for_review!( # Required:
504
504
  app_id: nil,
505
505
  train: nil,
@@ -514,6 +514,7 @@ module Spaceship
514
514
  last_name: nil,
515
515
  review_email: nil,
516
516
  phone_number: nil,
517
+ significant_change: false,
517
518
 
518
519
  # Optional Metadata:
519
520
  privacy_policy_url: nil,
@@ -540,6 +541,7 @@ module Spaceship
540
541
  current['privacyPolicyUrl']['value'] = privacy_policy_url
541
542
  current['pageLanguageValue'] = current['language'] # There is no valid reason why we need this, only iTC being iTC
542
543
  end
544
+ build_info['significantChange']['value'] = significant_change
543
545
  build_info['testInfo']['reviewFirstName']['value'] = first_name
544
546
  build_info['testInfo']['reviewLastName']['value'] = last_name
545
547
  build_info['testInfo']['reviewPhone']['value'] = phone_number
@@ -559,6 +561,7 @@ module Spaceship
559
561
  # only sometimes this is required
560
562
 
561
563
  encryption_info['usesEncryption']['value'] = encryption
564
+ encryption_info['encryptionUpdated']['value'] = encryption
562
565
 
563
566
  r = request(:post) do |req|
564
567
  req.url "ra/apps/#{app_id}/trains/#{train}/builds/#{build_number}/submit/complete"
@@ -569,7 +572,6 @@ module Spaceship
569
572
  handle_itc_response(r.body)
570
573
  end
571
574
  end
572
- # rubocop:enable Metrics/AbcSize
573
575
 
574
576
  #####################################################
575
577
  # @!group Submit for Review
@@ -1,3 +1,3 @@
1
1
  module Spaceship
2
- VERSION = "0.13.1"
2
+ VERSION = "0.14.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.13.1
4
+ version: 0.14.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-11-06 00:00:00.000000000 Z
12
+ date: 2015-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: credentials_manager
@@ -314,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
314
314
  version: '0'
315
315
  requirements: []
316
316
  rubyforge_project:
317
- rubygems_version: 2.5.0
317
+ rubygems_version: 2.4.0
318
318
  signing_key:
319
319
  specification_version: 4
320
320
  summary: Because you would rather spend your time building stuff than fighting provisioning