spaceship 0.34.3 → 0.35.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: bf577b8fd2b5d6f538ff6f26e2f5c8cf4abaa947
4
- data.tar.gz: 47e771c715dd55f3d334234ab6fcbb09896e7595
3
+ metadata.gz: f6e196e1baa469a54ac174956340461c7de400ef
4
+ data.tar.gz: 6045182579d60750159c0c89770e6d17520cf5f4
5
5
  SHA512:
6
- metadata.gz: 6a270d3d3f892feb254305b4fd58dcd24628d4dd5f535f8c1e0fba52b798177e55b4a2db4e9b0e899bfcfeab83f4d6b0022a5d8b1f44d6fd353bad920069cafe
7
- data.tar.gz: 899c011e4dacc8f0200029eafa12ee50ac72fe0f3d310d32d505298e0ca50606076c095848c55087d0af722bebd6c5302b7140b5fa6904bf46282516ced641ed
6
+ metadata.gz: b170cd42e3aa6798499273c39084fa7568b8bc0372d037078add1ec088e6873d1b0f94c751753d190976db38b2929ab2c24af6ed9b53f71760b10b1c3331d393
7
+ data.tar.gz: bce68dcebd6777dc984e661078a5e0bd4ec11f0746aa6b0d23009739e39593c4cd419f58581db5f48a4545e7807bc93768164d618fd08bdd3334ea6f14a52f95
@@ -31,10 +31,6 @@ module Spaceship
31
31
  UPLOAD_RECEIVED = "Upload Received"
32
32
  PENDING_DEVELOPER_RELEASE = "Pending Developer Release"
33
33
  PROCESSING_FOR_APP_STORE = "Processing for App Store"
34
-
35
- # Unused app states
36
- # PENDING_APPLE_RELASE = "Pending Apple Release"
37
-
38
34
  # WAITING_FOR_EXPORT_COMPLIANCE = "Waiting For Export Compliance"
39
35
  # METADATA_REJECTED = "Metadata Rejected"
40
36
  # REMOVED_FROM_SALE = "Removed From Sale"
@@ -49,7 +45,8 @@ module Spaceship
49
45
  'pendingContract' => PENDING_CONTRACT,
50
46
  'developerRemovedFromSale' => DEVELOPER_REMOVED_FROM_SALE,
51
47
  'waitingForReview' => WAITING_FOR_REVIEW,
52
- 'inReview' => IN_REVIEW
48
+ 'inReview' => IN_REVIEW,
49
+ 'pendingDeveloperRelease' => PENDING_DEVELOPER_RELEASE
53
50
  }
54
51
 
55
52
  mapping.each do |k, v|
@@ -220,7 +220,8 @@ module Spaceship
220
220
  def self.url
221
221
  {
222
222
  index: "ra/users/iap",
223
- create: "ra/users/iap/add"
223
+ create: "ra/users/iap/add",
224
+ delete: "ra/users/iap/delete"
224
225
  }
225
226
  end
226
227
 
@@ -239,6 +240,14 @@ module Spaceship
239
240
  )
240
241
  self.new(data)
241
242
  end
243
+
244
+ def self.delete!(emails)
245
+ client.delete_sandbox_testers!(self, emails)
246
+ end
247
+
248
+ def self.delete_all!
249
+ delete!(self.all.map(&:email))
250
+ end
242
251
  end
243
252
  end
244
253
  end
@@ -1,3 +1,5 @@
1
+ require "securerandom"
2
+
1
3
  module Spaceship
2
4
  # rubocop:disable Metrics/ClassLength
3
5
  class TunesClient < Spaceship::Client
@@ -66,6 +68,23 @@ module Spaceship
66
68
 
67
69
  # Set a new team ID which will be used from now on
68
70
  def team_id=(team_id)
71
+ # First, we verify the team actually exists, because otherwise iTC would return the
72
+ # following confusing error message
73
+ #
74
+ # invalid content provider id
75
+ #
76
+ available_teams = teams.collect do |team|
77
+ (team["contentProvider"] || {})["contentProviderId"]
78
+ end
79
+
80
+ result = available_teams.find do |available_team_id|
81
+ team_id.to_s == available_team_id.to_s
82
+ end
83
+
84
+ unless result
85
+ raise ITunesConnectError.new, "Could not set team ID to '#{team_id}', only found the following available teams: #{available_teams.join(', ')}"
86
+ end
87
+
69
88
  response = request(:post) do |req|
70
89
  req.url "ra/v1/session/webSession"
71
90
  req.body = { contentProviderId: team_id }.to_json
@@ -83,15 +102,21 @@ module Spaceship
83
102
  t_id = (ENV['FASTLANE_ITC_TEAM_ID'] || '').strip
84
103
  t_name = (ENV['FASTLANE_ITC_TEAM_NAME'] || '').strip
85
104
 
86
- if t_name.length > 0
105
+ if t_name.length > 0 && t_id.length.zero? # we prefer IDs over names, they are unique
106
+ puts "Looking for iTunes Connect Team with name #{t_name}" if $verbose
107
+
87
108
  teams.each do |t|
88
109
  t_id = t['contentProvider']['contentProviderId'].to_s if t['contentProvider']['name'].casecmp(t_name.downcase).zero?
89
110
  end
111
+
112
+ puts "Could not find team with name '#{t_name}', trying to fallback to default team" if t_id.length.zero?
90
113
  end
91
114
 
92
115
  t_id = teams.first['contentProvider']['contentProviderId'].to_s if teams.count == 1
93
116
 
94
117
  if t_id.length > 0
118
+ puts "Looking for iTunes Connect Team with ID #{t_id}" if $verbose
119
+
95
120
  # actually set the team id here
96
121
  self.team_id = t_id
97
122
  return
@@ -100,6 +125,15 @@ module Spaceship
100
125
  # user didn't specify a team... #thisiswhywecanthavenicethings
101
126
  loop do
102
127
  puts "Multiple iTunes Connect teams found, please enter the number of the team you want to use: "
128
+ puts "Note: to automatically choose the team, provide either the iTunes Connect Team ID, or the Team Name in your fastlane/Appfile:"
129
+ first_team = teams.first["contentProvider"]
130
+ puts ""
131
+ puts " itc_team_id \"#{first_team['contentProviderId']}\""
132
+ puts ""
133
+ puts "or"
134
+ puts ""
135
+ puts " itc_team_name \"#{first_team['name']}\""
136
+ puts ""
103
137
  teams.each_with_index do |team, i|
104
138
  puts "#{i + 1}) \"#{team['contentProvider']['name']}\" (#{team['contentProvider']['contentProviderId']})"
105
139
  end
@@ -846,8 +880,8 @@ module Spaceship
846
880
  storeFront: { value: country },
847
881
  birthDay: { value: 1 },
848
882
  birthMonth: { value: 1 },
849
- secretQuestion: { value: 'secret_question' },
850
- secretAnswer: { value: 'secret_answer' },
883
+ secretQuestion: { value: SecureRandom.hex },
884
+ secretAnswer: { value: SecureRandom.hex },
851
885
  sandboxAccount: nil
852
886
  }
853
887
  }.to_json
@@ -856,6 +890,22 @@ module Spaceship
856
890
  parse_response(r, 'data')['user']
857
891
  end
858
892
 
893
+ def delete_sandbox_testers!(tester_class, emails)
894
+ url = tester_class.url[:delete]
895
+ request(:post) do |req|
896
+ req.url url
897
+ req.body = emails.map do |email|
898
+ {
899
+ emailAddress: {
900
+ value: email
901
+ }
902
+ }
903
+ end.to_json
904
+ req.headers['Content-Type'] = 'application/json'
905
+ end
906
+ true
907
+ end
908
+
859
909
  #####################################################
860
910
  # @!group State History
861
911
  #####################################################
@@ -1,4 +1,4 @@
1
1
  module Spaceship
2
- VERSION = "0.34.3".freeze
2
+ VERSION = "0.35.0".freeze
3
3
  DESCRIPTION = "Ruby library to access the Apple Dev Center and iTunes Connect".freeze
4
4
  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.34.3
4
+ version: 0.35.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-10-06 00:00:00.000000000 Z
12
+ date: 2016-10-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: credentials_manager
@@ -43,16 +43,22 @@ dependencies:
43
43
  name: plist
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: 3.1.0
49
+ - - "<"
47
50
  - !ruby/object:Gem::Version
48
- version: '3.1'
51
+ version: 4.0.0
49
52
  type: :runtime
50
53
  prerelease: false
51
54
  version_requirements: !ruby/object:Gem::Requirement
52
55
  requirements:
53
- - - "~>"
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: 3.1.0
59
+ - - "<"
54
60
  - !ruby/object:Gem::Version
55
- version: '3.1'
61
+ version: 4.0.0
56
62
  - !ruby/object:Gem::Dependency
57
63
  name: faraday
58
64
  requirement: !ruby/object:Gem::Requirement
@@ -394,7 +400,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
394
400
  version: '0'
395
401
  requirements: []
396
402
  rubyforge_project:
397
- rubygems_version: 2.2.2
403
+ rubygems_version: 2.6.6
398
404
  signing_key:
399
405
  specification_version: 4
400
406
  summary: Ruby library to access the Apple Dev Center and iTunes Connect