fastlane 2.158.0 → 2.163.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +74 -74
  3. data/cert/lib/cert/options.rb +28 -1
  4. data/cert/lib/cert/runner.rb +50 -33
  5. data/deliver/lib/deliver/app_screenshot_iterator.rb +4 -4
  6. data/deliver/lib/deliver/module.rb +2 -0
  7. data/deliver/lib/deliver/options.rb +20 -4
  8. data/deliver/lib/deliver/runner.rb +36 -8
  9. data/deliver/lib/deliver/upload_metadata.rb +49 -9
  10. data/deliver/lib/deliver/upload_price_tier.rb +7 -2
  11. data/deliver/lib/deliver/upload_screenshots.rb +25 -8
  12. data/{pilot/lib/pilot/.manager.rb.swp → fastlane/lib/fastlane/.erb_template_helper.rb.swp} +0 -0
  13. data/fastlane/lib/fastlane/actions/{.slack.rb.swp → .git_commit.rb.swp} +0 -0
  14. data/fastlane/lib/fastlane/actions/.register_device.rb.swp +0 -0
  15. data/fastlane/lib/fastlane/actions/.register_devices.rb.swp +0 -0
  16. data/fastlane/lib/fastlane/actions/actions_helper.rb +20 -1
  17. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +39 -3
  18. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +15 -1
  19. data/fastlane/lib/fastlane/actions/check_app_store_metadata.rb +1 -0
  20. data/fastlane/lib/fastlane/actions/clean_build_artifacts.rb +1 -0
  21. data/fastlane/lib/fastlane/actions/docs/capture_android_screenshots.md +2 -2
  22. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +1 -1
  23. data/fastlane/lib/fastlane/actions/docs/create_app_online.md +1 -1
  24. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +3 -2
  25. data/fastlane/lib/fastlane/actions/docs/run_tests.md +2 -2
  26. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +3 -3
  27. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +2 -2
  28. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +2 -2
  29. data/fastlane/lib/fastlane/actions/download_dsyms.rb +32 -7
  30. data/fastlane/lib/fastlane/actions/ensure_git_status_clean.rb +13 -2
  31. data/fastlane/lib/fastlane/actions/get_certificates.rb +1 -0
  32. data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +1 -0
  33. data/fastlane/lib/fastlane/actions/latest_testflight_build_number.rb +15 -0
  34. data/fastlane/lib/fastlane/actions/register_device.rb +46 -5
  35. data/fastlane/lib/fastlane/actions/register_devices.rb +46 -15
  36. data/fastlane/lib/fastlane/actions/sync_code_signing.rb +1 -0
  37. data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +3 -2
  38. data/fastlane/lib/fastlane/helper/git_helper.rb +2 -0
  39. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +6 -4
  40. data/fastlane/lib/fastlane/swift_fastlane_function.rb +1 -1
  41. data/fastlane/lib/fastlane/version.rb +1 -1
  42. data/fastlane/swift/Actions.swift +2 -1
  43. data/fastlane/swift/Appfile.swift +2 -4
  44. data/fastlane/swift/ArgumentProcessor.swift +2 -6
  45. data/fastlane/swift/ControlCommand.swift +2 -5
  46. data/fastlane/swift/Deliverfile.swift +5 -2
  47. data/fastlane/swift/DeliverfileProtocol.swift +18 -7
  48. data/fastlane/swift/Fastfile.swift +5 -1
  49. data/fastlane/swift/Fastlane.swift +2368 -2251
  50. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.pbxproj +5 -5
  51. data/fastlane/swift/Gymfile.swift +5 -2
  52. data/fastlane/swift/GymfileProtocol.swift +6 -3
  53. data/fastlane/swift/LaneFileProtocol.swift +49 -40
  54. data/fastlane/swift/MainProcess.swift +77 -0
  55. data/fastlane/swift/Matchfile.swift +5 -2
  56. data/fastlane/swift/MatchfileProtocol.swift +21 -6
  57. data/fastlane/swift/Plugins.swift +2 -1
  58. data/fastlane/swift/Precheckfile.swift +5 -2
  59. data/fastlane/swift/PrecheckfileProtocol.swift +14 -3
  60. data/fastlane/swift/RubyCommand.swift +2 -6
  61. data/fastlane/swift/RubyCommandable.swift +2 -6
  62. data/fastlane/swift/Runner.swift +5 -9
  63. data/fastlane/swift/RunnerArgument.swift +2 -6
  64. data/fastlane/swift/Scanfile.swift +5 -2
  65. data/fastlane/swift/ScanfileProtocol.swift +6 -3
  66. data/fastlane/swift/Screengrabfile.swift +5 -2
  67. data/fastlane/swift/ScreengrabfileProtocol.swift +6 -3
  68. data/fastlane/swift/Snapshotfile.swift +5 -2
  69. data/fastlane/swift/SnapshotfileProtocol.swift +6 -3
  70. data/fastlane/swift/SocketClient.swift +3 -7
  71. data/fastlane/swift/SocketClientDelegateProtocol.swift +2 -6
  72. data/fastlane/swift/SocketResponse.swift +2 -6
  73. data/fastlane/swift/formatting/Brewfile.lock.json +18 -10
  74. data/fastlane/swift/main.swift +4 -8
  75. data/fastlane/swift/upgrade_manifest.json +1 -1
  76. data/fastlane_core/lib/fastlane_core/analytics/analytics_session.rb +6 -7
  77. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +2 -2
  78. data/frameit/lib/frameit/editor.rb +1 -0
  79. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +2 -2
  80. data/match/lib/match/generator.rb +6 -1
  81. data/match/lib/match/importer.rb +44 -8
  82. data/match/lib/match/migrate.rb +13 -2
  83. data/match/lib/match/nuke.rb +65 -22
  84. data/match/lib/match/options.rb +27 -2
  85. data/match/lib/match/runner.rb +38 -10
  86. data/match/lib/match/spaceship_ensure.rb +27 -21
  87. data/match/lib/match/storage/google_cloud_storage.rb +20 -3
  88. data/match/lib/match/storage/s3_storage.rb +19 -3
  89. data/pilot/lib/pilot/options.rb +2 -2
  90. data/precheck/lib/precheck/options.rb +16 -0
  91. data/precheck/lib/precheck/runner.rb +20 -1
  92. data/sigh/lib/sigh/download_all.rb +16 -4
  93. data/sigh/lib/sigh/options.rb +21 -0
  94. data/sigh/lib/sigh/runner.rb +80 -38
  95. data/snapshot/lib/assets/SnapshotHelper.swift +21 -2
  96. data/spaceship/README.md +1 -1
  97. data/spaceship/lib/spaceship/{connect_api/.DS_Store → .DS_Store} +0 -0
  98. data/spaceship/lib/spaceship/client.rb +9 -4
  99. data/spaceship/lib/spaceship/connect_api.rb +25 -0
  100. data/spaceship/lib/spaceship/connect_api/api_client.rb +12 -3
  101. data/spaceship/lib/spaceship/connect_api/client.rb +38 -15
  102. data/{fastlane/lib/fastlane/actions/.update_project_provisioning.rb.swp → spaceship/lib/spaceship/connect_api/models/.app_store_version_submission.rb.swp} +0 -0
  103. data/spaceship/lib/spaceship/connect_api/models/app.rb +17 -9
  104. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +1 -0
  105. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +3 -1
  106. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +2 -2
  107. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +3 -5
  108. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +3 -5
  109. data/spaceship/lib/spaceship/connect_api/models/beta_tester.rb +2 -1
  110. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +42 -0
  111. data/spaceship/lib/spaceship/connect_api/models/device.rb +5 -0
  112. data/spaceship/lib/spaceship/connect_api/models/profile.rb +7 -1
  113. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +59 -0
  114. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +45 -2
  115. data/spaceship/lib/spaceship/connect_api/spaceship.rb +3 -2
  116. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +13 -0
  117. data/spaceship/lib/spaceship/connect_api/token.rb +6 -1
  118. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +17 -9
  119. data/spaceship/lib/spaceship/connect_api/users/users.rb +40 -0
  120. data/spaceship/lib/spaceship/helper/net_http_generic_request.rb +11 -5
  121. metadata +27 -25
  122. data/fastlane/lib/fastlane/actions/.hockey.rb.swp +0 -0
  123. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcuserdata/josh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
@@ -15,6 +15,7 @@ require 'spaceship/connect_api/models/device'
15
15
  require 'spaceship/connect_api/models/profile'
16
16
 
17
17
  require 'spaceship/connect_api/models/user'
18
+ require 'spaceship/connect_api/models/user_invitation'
18
19
 
19
20
  require 'spaceship/connect_api/models/app'
20
21
  require 'spaceship/connect_api/models/beta_app_localization'
@@ -85,5 +86,29 @@ module Spaceship
85
86
  end
86
87
  end
87
88
  end
89
+
90
+ # Defined in the App Store Connect API docs:
91
+ #
92
+ # Used for creating BundleId and Device
93
+ module BundleIdPlatform
94
+ IOS = "IOS"
95
+ MAC_OS = "MAC_OS"
96
+
97
+ ALL = [IOS, MAC_OS]
98
+
99
+ def self.map(platform)
100
+ return platform if ALL.include?(platform)
101
+
102
+ # Map from fastlane input and Spaceship::TestFlight platform values
103
+ case platform.to_sym
104
+ when :osx, :macos, :mac
105
+ return Spaceship::ConnectAPI::Platform::MAC_OS
106
+ when :ios
107
+ return Spaceship::ConnectAPI::Platform::IOS
108
+ else
109
+ raise "Cannot find a matching platform for '#{platform}' - valid values are #{ALL.join(', ')}"
110
+ end
111
+ end
112
+ end
88
113
  end
89
114
  end
@@ -17,7 +17,7 @@ module Spaceship
17
17
  #####################################################
18
18
 
19
19
  # Instantiates a client with cookie session or a JWT token.
20
- def initialize(cookie: nil, current_team_id: nil, token: nil, another_client: nil)
20
+ def initialize(cookie: nil, current_team_id: nil, token: nil, csrf_tokens: nil, another_client: nil)
21
21
  params_count = [cookie, token, another_client].compact.size
22
22
  if params_count != 1
23
23
  raise "Must initialize with one of :cookie, :token, or :another_client"
@@ -25,10 +25,10 @@ module Spaceship
25
25
 
26
26
  if token.nil?
27
27
  if another_client.nil?
28
- super(cookie: cookie, current_team_id: current_team_id, timeout: 1200)
28
+ super(cookie: cookie, current_team_id: current_team_id, csrf_tokens: csrf_tokens, timeout: 1200)
29
29
  return
30
30
  end
31
- super(cookie: another_client.instance_variable_get(:@cookie), current_team_id: another_client.team_id)
31
+ super(cookie: another_client.instance_variable_get(:@cookie), current_team_id: another_client.team_id, csrf_tokens: another_client.csrf_tokens)
32
32
  else
33
33
  options = {
34
34
  request: {
@@ -152,6 +152,7 @@ module Spaceship
152
152
 
153
153
  def with_asc_retry(tries = 5, &_block)
154
154
  tries = 1 if Object.const_defined?("SpecHelper")
155
+
155
156
  response = yield
156
157
 
157
158
  status = response.status if response
@@ -162,6 +163,10 @@ module Spaceship
162
163
  end
163
164
 
164
165
  return response
166
+ rescue UnauthorizedAccessError => error
167
+ # Catch unathorized access and re-raising
168
+ # There is no need to try again
169
+ raise error
165
170
  rescue => error
166
171
  tries -= 1
167
172
  puts(error) if Spaceship::Globals.verbose?
@@ -194,6 +199,10 @@ module Spaceship
194
199
  return Spaceship::ConnectAPI::Response.new(body: response.body, status: response.status, client: self)
195
200
  end
196
201
 
202
+ def handle_401(response)
203
+ raise UnauthorizedAccessError, handle_errors(response) if response && (response.body || {})['errors']
204
+ end
205
+
197
206
  def handle_errors(response)
198
207
  # Example error format
199
208
  # {
@@ -43,25 +43,28 @@ module Spaceship
43
43
  # @param portal_team_id (String) (optional): The Spaceship::Portal team id
44
44
  # @param tunes_team_id (String) (optional): The Spaceship::Tunes team id
45
45
  # @param team_name (String) (optional): The team name
46
+ # @param skip_select_team (Boolean) (optional): Whether to skip automatic selection or prompt for team
46
47
  #
47
48
  # @raise InvalidUserCredentialsError: raised if authentication failed
48
49
  #
49
50
  # @return (Spaceship::ConnectAPI::Client) The client the login method was called for
50
- def self.login(user = nil, password = nil, use_portal: true, use_tunes: true, portal_team_id: nil, tunes_team_id: nil, team_name: nil)
51
+ def self.login(user = nil, password = nil, use_portal: true, use_tunes: true, portal_team_id: nil, tunes_team_id: nil, team_name: nil, skip_select_team: false)
51
52
  portal_client = Spaceship::Portal.login(user, password) if use_portal
52
53
  tunes_client = Spaceship::Tunes.login(user, password) if use_tunes
53
54
 
54
- # Check if environment variables are set for Spaceship::Portal or Spaceship::Tunes to select team
55
- portal_team_id ||= ENV['FASTLANE_TEAM_ID']
56
- portal_team_name = team_name || ENV['FASTLANE_TEAM_NAME']
57
- tunes_team_id ||= ENV['FASTLANE_ITC_TEAM_ID']
58
- tunes_team_name = team_name || ENV['FASTLANE_ITC_TEAM_NAME']
59
-
60
- # The clients will prompt for a team selection if:
61
- # 1. client exists
62
- # 2. team_id and team_name are nil and user belongs to multiple teams
63
- portal_client.select_team(team_id: portal_team_id, team_name: portal_team_name) if portal_client
64
- tunes_client.select_team(team_id: tunes_team_id, team_name: tunes_team_name) if tunes_client
55
+ unless skip_select_team
56
+ # Check if environment variables are set for Spaceship::Portal or Spaceship::Tunes to select team
57
+ portal_team_id ||= ENV['FASTLANE_TEAM_ID']
58
+ portal_team_name = team_name || ENV['FASTLANE_TEAM_NAME']
59
+ tunes_team_id ||= ENV['FASTLANE_ITC_TEAM_ID']
60
+ tunes_team_name = team_name || ENV['FASTLANE_ITC_TEAM_NAME']
61
+
62
+ # The clients will prompt for a team selection if:
63
+ # 1. client exists
64
+ # 2. team_id and team_name are nil and user belongs to multiple teams
65
+ portal_client.select_team(team_id: portal_team_id, team_name: portal_team_name) if portal_client
66
+ tunes_client.select_team(team_id: tunes_team_id, team_name: tunes_team_name) if tunes_client
67
+ end
65
68
 
66
69
  return ConnectAPI::Client.new(tunes_client: tunes_client, portal_client: portal_client)
67
70
  end
@@ -94,8 +97,18 @@ module Spaceship
94
97
  end
95
98
 
96
99
  def portal_team_id
97
- return nil if @portal_client.nil?
98
- return @portal_client.team_id
100
+ if token
101
+ message = [
102
+ "Cannot determine portal team id via the App Store Connect API (yet)",
103
+ "Look to see if you can get the portal team id from somewhere else",
104
+ "View more info in the docs at https://docs.fastlane.tools/app-store-connect-api/"
105
+ ]
106
+ raise message.join('. ')
107
+ elsif @portal_client
108
+ return @portal_client.team_id
109
+ else
110
+ raise "No App Store Connect API token or Portal Client set"
111
+ end
99
112
  end
100
113
 
101
114
  def tunes_team_id
@@ -103,6 +116,16 @@ module Spaceship
103
116
  return @tunes_client.team_id
104
117
  end
105
118
 
119
+ def portal_teams
120
+ return nil if @portal_client.nil?
121
+ return @portal_client.teams
122
+ end
123
+
124
+ def tunes_teams
125
+ return nil if @tunes_client.nil?
126
+ return @tunes_client.teams
127
+ end
128
+
106
129
  def in_house?
107
130
  if token
108
131
  if token.in_house.nil?
@@ -113,7 +136,7 @@ module Spaceship
113
136
  "Or set the 'SPACESHIP_CONNECT_API_IN_HOUSE' environment variable to 'true'",
114
137
  "View more info in the docs at https://docs.fastlane.tools/app-store-connect-api/"
115
138
  ]
116
- raise message.join('\n')
139
+ raise message.join('. ')
117
140
  end
118
141
  return !!token.in_house
119
142
  elsif @portal_client
@@ -16,6 +16,7 @@ module Spaceship
16
16
  attr_accessor :available_in_new_territories
17
17
  attr_accessor :content_rights_declaration
18
18
  attr_accessor :app_store_versions
19
+ attr_accessor :prices
19
20
 
20
21
  module ContentRightsDeclaration
21
22
  USES_THIRD_PARTY_CONTENT = "USES_THIRD_PARTY_CONTENT"
@@ -34,9 +35,15 @@ module Spaceship
34
35
 
35
36
  "contentRightsDeclaration" => "content_rights_declaration",
36
37
 
37
- "appStoreVersions" => "app_store_versions"
38
+ "appStoreVersions" => "app_store_versions",
39
+ "prices" => "prices"
38
40
  })
39
41
 
42
+ ESSENTIAL_INCLUDES = [
43
+ "appStoreVersions",
44
+ "prices"
45
+ ].join(",")
46
+
40
47
  def self.type
41
48
  return "apps"
42
49
  end
@@ -45,7 +52,7 @@ module Spaceship
45
52
  # Apps
46
53
  #
47
54
 
48
- def self.all(filter: {}, includes: "appStoreVersions", limit: nil, sort: nil)
55
+ def self.all(filter: {}, includes: ESSENTIAL_INCLUDES, limit: nil, sort: nil)
49
56
  resps = Spaceship::ConnectAPI.get_apps(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
50
57
  return resps.flat_map(&:to_models)
51
58
  end
@@ -84,13 +91,13 @@ module Spaceship
84
91
  def fetch_live_app_info(includes: Spaceship::ConnectAPI::AppInfo::ESSENTIAL_INCLUDES)
85
92
  states = [
86
93
  Spaceship::ConnectAPI::AppInfo::AppStoreState::READY_FOR_SALE,
94
+ Spaceship::ConnectAPI::AppInfo::AppStoreState::PENDING_APPLE_RELEASE,
87
95
  Spaceship::ConnectAPI::AppInfo::AppStoreState::PENDING_DEVELOPER_RELEASE,
88
96
  Spaceship::ConnectAPI::AppInfo::AppStoreState::PROCESSING_FOR_APP_STORE,
89
97
  Spaceship::ConnectAPI::AppInfo::AppStoreState::IN_REVIEW
90
98
  ]
91
99
 
92
- filter = { app: id }
93
- resp = Spaceship::ConnectAPI.get_app_infos(filter: filter, includes: includes)
100
+ resp = Spaceship::ConnectAPI.get_app_infos(app_id: id, includes: includes)
94
101
  return resp.to_models.select do |model|
95
102
  states.include?(model.app_store_state)
96
103
  end.first
@@ -106,8 +113,7 @@ module Spaceship
106
113
  Spaceship::ConnectAPI::AppInfo::AppStoreState::INVALID_BINARY
107
114
  ]
108
115
 
109
- filter = { app: id }
110
- resp = Spaceship::ConnectAPI.get_app_infos(filter: filter, includes: includes)
116
+ resp = Spaceship::ConnectAPI.get_app_infos(app_id: id, includes: includes)
111
117
  return resp.to_models.select do |model|
112
118
  states.include?(model.app_store_state)
113
119
  end.first
@@ -128,8 +134,6 @@ module Spaceship
128
134
  #
129
135
 
130
136
  def fetch_app_prices(filter: {}, includes: "priceTier", limit: nil, sort: nil)
131
- filter ||= {}
132
- filter[:app] = id
133
137
  resp = Spaceship::ConnectAPI.get_app_prices(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort)
134
138
  return resp.to_models
135
139
  end
@@ -142,6 +146,7 @@ module Spaceship
142
146
  platform ||= Spaceship::ConnectAPI::Platform::IOS
143
147
  filter = {
144
148
  appStoreState: [
149
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_APPLE_RELEASE,
145
150
  Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE,
146
151
  Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::IN_REVIEW,
147
152
  Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::WAITING_FOR_REVIEW
@@ -233,7 +238,10 @@ module Spaceship
233
238
  def get_pending_release_app_store_version(platform: nil, includes: Spaceship::ConnectAPI::AppStoreVersion::ESSENTIAL_INCLUDES)
234
239
  platform ||= Spaceship::ConnectAPI::Platform::IOS
235
240
  filter = {
236
- appStoreState: Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE,
241
+ appStoreState: [
242
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_APPLE_RELEASE,
243
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE
244
+ ].join(','),
237
245
  platform: platform
238
246
  }
239
247
  return get_app_store_versions(filter: filter, includes: includes).first
@@ -20,6 +20,7 @@ module Spaceship
20
20
  READY_FOR_SALE = "READY_FOR_SALE"
21
21
  PROCESSING_FOR_APP_STORE = "PROCESSING_FOR_APP_STORE"
22
22
  PENDING_DEVELOPER_RELEASE = "PENDING_DEVELOPER_RELEASE"
23
+ PENDING_APPLE_RELEASE = "PENDING_APPLE_RELEASE"
23
24
  IN_REVIEW = "IN_REVIEW"
24
25
  WAITING_FOR_REVIEW = "WAITING_FOR_REVIEW"
25
26
  DEVELOPER_REJECTED = "DEVELOPER_REJECTED"
@@ -111,7 +111,9 @@ module Spaceship
111
111
  timeout_minutes = (ENV["SPACESHIP_SCREENSHOT_UPLOAD_TIMEOUT"] || 20).to_i
112
112
 
113
113
  loop do
114
- puts("Waiting for screenshot to appear before uploading...")
114
+ # This error handling needs to be revised since any error occured can reach here.
115
+ # It should handle errors based on what status code is.
116
+ puts("Waiting for screenshots to appear before uploading. This is unlikely to be recovered unless it's 503 error. error=\"#{error}\"")
115
117
  sleep(30)
116
118
 
117
119
  screenshots = Spaceship::ConnectAPI::AppScreenshotSet
@@ -112,8 +112,8 @@ module Spaceship
112
112
  # API
113
113
  #
114
114
 
115
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
116
- resp = Spaceship::ConnectAPI.get_app_screenshot_sets(filter: filter, includes: includes, limit: limit, sort: sort)
115
+ def self.all(app_store_version_localization_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
116
+ resp = Spaceship::ConnectAPI.get_app_screenshot_sets(app_store_version_localization_id: app_store_version_localization_id, filter: filter, includes: includes, limit: limit, sort: sort)
117
117
  return resp.to_models
118
118
  end
119
119
 
@@ -26,6 +26,7 @@ module Spaceship
26
26
  READY_FOR_SALE = "READY_FOR_SALE"
27
27
  PROCESSING_FOR_APP_STORE = "PROCESSING_FOR_APP_STORE"
28
28
  PENDING_DEVELOPER_RELEASE = "PENDING_DEVELOPER_RELEASE"
29
+ PENDING_APPLE_RELEASE = "PENDING_APPLE_RELEASE"
29
30
  IN_REVIEW = "IN_REVIEW"
30
31
  WAITING_FOR_REVIEW = "WAITING_FOR_REVIEW"
31
32
  DEVELOPER_REJECTED = "DEVELOPER_REJECTED"
@@ -114,11 +115,8 @@ module Spaceship
114
115
  return resp.to_models.first
115
116
  end
116
117
 
117
- # appScreenshotSets,appPreviewSets
118
- def get_app_store_version_localizations(filter: {}, includes: "appScreenshotSets", limit: nil, sort: nil)
119
- filter ||= {}
120
- filter["appStoreVersion"] = id
121
- return Spaceship::ConnectAPI::AppStoreVersionLocalization.all(filter: filter, includes: includes, limit: limit, sort: sort)
118
+ def get_app_store_version_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
119
+ return Spaceship::ConnectAPI::AppStoreVersionLocalization.all(app_store_version_id: id, filter: filter, includes: includes, limit: limit, sort: sort)
122
120
  end
123
121
 
124
122
  #
@@ -39,8 +39,8 @@ module Spaceship
39
39
  # API
40
40
  #
41
41
 
42
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
43
- resp = Spaceship::ConnectAPI.get_app_store_version_localizations(filter: filter, includes: includes, limit: limit, sort: sort)
42
+ def self.all(app_store_version_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
43
+ resp = Spaceship::ConnectAPI.get_app_store_version_localizations(app_store_version_id: app_store_version_id, filter: filter, includes: includes, limit: limit, sort: sort)
44
44
  return resp.to_models
45
45
  end
46
46
 
@@ -73,9 +73,7 @@ module Spaceship
73
73
  #
74
74
 
75
75
  def get_app_screenshot_sets(filter: {}, includes: "appScreenshots", limit: nil, sort: nil)
76
- filter ||= {}
77
- filter["appStoreVersionLocalization"] = id
78
- return Spaceship::ConnectAPI::AppScreenshotSet.all(filter: filter, includes: includes, limit: limit, sort: sort)
76
+ return Spaceship::ConnectAPI::AppScreenshotSet.all(app_store_version_localization_id: id, filter: filter, includes: includes, limit: limit, sort: sort)
79
77
  end
80
78
 
81
79
  def create_app_screenshot_set(attributes: nil)
@@ -35,7 +35,8 @@ module Spaceship
35
35
  #
36
36
 
37
37
  def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
38
- return Spaceship::ConnectAPI.get_beta_testers(filter: filter, includes: includes)
38
+ resps = Spaceship::ConnectAPI.get_beta_testers(filter: filter, includes: includes).all_pages
39
+ return resps.flat_map(&:to_models)
39
40
  end
40
41
 
41
42
  def self.find(email: nil, includes: nil)
@@ -1,4 +1,7 @@
1
1
  require_relative '../model'
2
+
3
+ require 'openssl'
4
+
2
5
  module Spaceship
3
6
  class ConnectAPI
4
7
  class Certificate
@@ -6,6 +9,7 @@ module Spaceship
6
9
 
7
10
  attr_accessor :certificate_content
8
11
  attr_accessor :display_name
12
+ attr_accessor :expiration_date
9
13
  attr_accessor :name
10
14
  attr_accessor :platform
11
15
  attr_accessor :serial_number
@@ -47,6 +51,26 @@ module Spaceship
47
51
  Time.parse(expiration_date) > Time.now
48
52
  end
49
53
 
54
+ # Create a new code signing request that can be used to
55
+ # generate a new certificate
56
+ # @example
57
+ # Create a new certificate signing request
58
+ # csr, pkey = Spaceship.certificate.create_certificate_signing_request
59
+ #
60
+ # # Use the signing request to create a new distribution certificate
61
+ # Spaceship.certificate.production.create!(csr: csr)
62
+ def self.create_certificate_signing_request
63
+ key = OpenSSL::PKey::RSA.new(2048)
64
+ csr = OpenSSL::X509::Request.new
65
+ csr.version = 0
66
+ csr.subject = OpenSSL::X509::Name.new([
67
+ ['CN', 'PEM', OpenSSL::ASN1::UTF8STRING]
68
+ ])
69
+ csr.public_key = key.public_key
70
+ csr.sign(key, OpenSSL::Digest::SHA1.new)
71
+ return [csr, key]
72
+ end
73
+
50
74
  #
51
75
  # API
52
76
  #
@@ -55,6 +79,24 @@ module Spaceship
55
79
  resps = Spaceship::ConnectAPI.get_certificates(filter: filter, includes: includes).all_pages
56
80
  return resps.flat_map(&:to_models)
57
81
  end
82
+
83
+ def self.create(certificate_type: nil, csr_content: nil)
84
+ attributes = {
85
+ certificateType: certificate_type,
86
+ csrContent: csr_content
87
+ }
88
+ resp = Spaceship::ConnectAPI.post_certificate(attributes: attributes)
89
+ return resp.to_models.first
90
+ end
91
+
92
+ def self.get(certificate_id: nil, includes: nil)
93
+ resp = Spaceship::ConnectAPI.get_certificate(certificate_id: certificate_id, includes: includes)
94
+ return resp.to_models.first
95
+ end
96
+
97
+ def delete!
98
+ Spaceship::ConnectAPI.delete_certificate(certificate_id: id)
99
+ end
58
100
  end
59
101
  end
60
102
  end
@@ -48,6 +48,11 @@ module Spaceship
48
48
  resps = Spaceship::ConnectAPI.get_devices(filter: filter, includes: includes).all_pages
49
49
  return resps.flat_map(&:to_models)
50
50
  end
51
+
52
+ def self.create(name: nil, platform: nil, udid: nil)
53
+ resp = Spaceship::ConnectAPI.post_device(name: name, platform: platform, udid: udid)
54
+ return resp.to_models.first
55
+ end
51
56
  end
52
57
  end
53
58
  end
@@ -27,7 +27,8 @@ module Spaceship
27
27
  "expirationDate" => "expiration_date",
28
28
 
29
29
  "bundleId" => "bundle_id",
30
- "certificates" => "certificates"
30
+ "certificates" => "certificates",
31
+ "devices" => "devices"
31
32
  })
32
33
 
33
34
  module ProfileState
@@ -83,6 +84,11 @@ module Spaceship
83
84
  return resp.to_models.first
84
85
  end
85
86
 
87
+ def fetch_all_devices(filter: {}, includes: nil, sort: nil)
88
+ resps = Spaceship::ConnectAPI.get_devices(profile_id: id, filter: filter, includes: includes).all_pages
89
+ return resps.flat_map(&:to_models)
90
+ end
91
+
86
92
  def delete!
87
93
  return Spaceship::ConnectAPI.delete_profile(profile_id: id)
88
94
  end