fastlane 2.159.0 → 2.164.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) 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/queue_worker.rb +14 -29
  9. data/deliver/lib/deliver/runner.rb +36 -8
  10. data/deliver/lib/deliver/upload_metadata.rb +51 -10
  11. data/deliver/lib/deliver/upload_price_tier.rb +7 -2
  12. data/deliver/lib/deliver/upload_screenshots.rb +28 -13
  13. data/fastlane/lib/fastlane/actions/actions_helper.rb +20 -1
  14. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +39 -3
  15. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +15 -1
  16. data/fastlane/lib/fastlane/actions/check_app_store_metadata.rb +1 -0
  17. data/fastlane/lib/fastlane/actions/clean_build_artifacts.rb +1 -0
  18. data/fastlane/lib/fastlane/actions/docs/capture_android_screenshots.md +2 -2
  19. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +2 -2
  20. data/fastlane/lib/fastlane/actions/docs/create_app_online.md +1 -1
  21. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +3 -2
  22. data/fastlane/lib/fastlane/actions/docs/run_tests.md +2 -2
  23. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +12 -3
  24. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +2 -2
  25. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +1 -1
  26. data/fastlane/lib/fastlane/actions/download_dsyms.rb +31 -6
  27. data/fastlane/lib/fastlane/actions/ensure_git_status_clean.rb +13 -2
  28. data/fastlane/lib/fastlane/actions/get_certificates.rb +1 -0
  29. data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +1 -0
  30. data/fastlane/lib/fastlane/actions/import_from_git.rb +9 -1
  31. data/fastlane/lib/fastlane/actions/is_ci.rb +1 -1
  32. data/fastlane/lib/fastlane/actions/latest_testflight_build_number.rb +15 -0
  33. data/fastlane/lib/fastlane/actions/register_device.rb +46 -5
  34. data/fastlane/lib/fastlane/actions/register_devices.rb +50 -16
  35. data/fastlane/lib/fastlane/actions/set_changelog.rb +31 -3
  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/fast_file.rb +74 -23
  39. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +1 -0
  40. data/fastlane/lib/fastlane/version.rb +1 -1
  41. data/fastlane/swift/Deliverfile.swift +1 -1
  42. data/fastlane/swift/DeliverfileProtocol.swift +13 -5
  43. data/fastlane/swift/Fastlane.swift +170 -44
  44. data/fastlane/swift/Gymfile.swift +1 -1
  45. data/fastlane/swift/GymfileProtocol.swift +1 -1
  46. data/fastlane/swift/LaneFileProtocol.swift +28 -36
  47. data/fastlane/swift/MainProcess.swift +1 -1
  48. data/fastlane/swift/Matchfile.swift +1 -1
  49. data/fastlane/swift/MatchfileProtocol.swift +20 -4
  50. data/fastlane/swift/Precheckfile.swift +1 -1
  51. data/fastlane/swift/PrecheckfileProtocol.swift +9 -1
  52. data/fastlane/swift/Scanfile.swift +1 -1
  53. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  54. data/fastlane/swift/Screengrabfile.swift +1 -1
  55. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  56. data/fastlane/swift/Snapshotfile.swift +1 -1
  57. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  58. data/fastlane/swift/main.swift +1 -1
  59. data/fastlane_core/lib/fastlane_core/analytics/analytics_session.rb +6 -7
  60. data/fastlane_core/lib/fastlane_core/device_manager.rb +8 -4
  61. data/fastlane_core/lib/fastlane_core/helper.rb +1 -1
  62. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +3 -3
  63. data/frameit/lib/frameit/editor.rb +1 -0
  64. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +2 -2
  65. data/match/lib/match/.commands_generator.rb.swp +0 -0
  66. data/match/lib/match/.importer.rb.swp +0 -0
  67. data/{spaceship/lib/spaceship/connect_api/models/.app.rb.swp → match/lib/match/.options.rb.swp} +0 -0
  68. data/match/lib/match/generator.rb +6 -1
  69. data/match/lib/match/importer.rb +63 -18
  70. data/match/lib/match/migrate.rb +13 -2
  71. data/match/lib/match/nuke.rb +65 -22
  72. data/match/lib/match/options.rb +33 -2
  73. data/match/lib/match/runner.rb +38 -10
  74. data/match/lib/match/spaceship_ensure.rb +27 -21
  75. data/match/lib/match/storage/google_cloud_storage.rb +20 -3
  76. data/match/lib/match/storage/s3_storage.rb +19 -3
  77. data/pilot/lib/pilot/options.rb +2 -2
  78. data/precheck/lib/precheck/options.rb +16 -0
  79. data/precheck/lib/precheck/runner.rb +20 -1
  80. data/scan/lib/scan/detect_values.rb +5 -8
  81. data/scan/lib/scan/runner.rb +2 -1
  82. data/sigh/lib/assets/resign.sh +1 -1
  83. data/sigh/lib/sigh/download_all.rb +16 -4
  84. data/sigh/lib/sigh/options.rb +21 -0
  85. data/sigh/lib/sigh/runner.rb +81 -39
  86. data/snapshot/lib/assets/SnapshotHelper.swift +4 -0
  87. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +2 -1
  88. data/spaceship/README.md +1 -1
  89. data/spaceship/lib/spaceship/client.rb +9 -4
  90. data/spaceship/lib/spaceship/connect_api.rb +25 -0
  91. data/spaceship/lib/spaceship/connect_api/api_client.rb +12 -3
  92. data/spaceship/lib/spaceship/connect_api/client.rb +13 -3
  93. data/spaceship/lib/spaceship/connect_api/models/app.rb +17 -9
  94. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +1 -0
  95. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +3 -1
  96. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +2 -2
  97. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +3 -5
  98. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +3 -5
  99. data/spaceship/lib/spaceship/connect_api/models/beta_tester.rb +2 -1
  100. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +42 -0
  101. data/spaceship/lib/spaceship/connect_api/models/device.rb +5 -0
  102. data/spaceship/lib/spaceship/connect_api/models/profile.rb +7 -1
  103. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +59 -0
  104. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +45 -2
  105. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +13 -0
  106. data/spaceship/lib/spaceship/connect_api/token.rb +6 -1
  107. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +15 -7
  108. data/spaceship/lib/spaceship/connect_api/users/users.rb +40 -0
  109. data/spaceship/lib/spaceship/helper/net_http_generic_request.rb +11 -5
  110. data/supply/lib/supply/uploader.rb +1 -1
  111. metadata +21 -19
  112. data/spaceship/lib/spaceship/connect_api/models/.app_store_version.rb.swp +0 -0
@@ -165,7 +165,11 @@ open class Snapshot: NSObject {
165
165
  }
166
166
 
167
167
  let screenshot = XCUIScreen.main.screenshot()
168
+ #if os(iOS)
168
169
  let image = XCUIDevice.shared.orientation.isLandscape ? fixLandscapeOrientation(image: screenshot.image) : screenshot.image
170
+ #else
171
+ let image = screenshot.image
172
+ #endif
169
173
 
170
174
  guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return }
171
175
 
@@ -18,6 +18,7 @@ module Snapshot
18
18
 
19
19
  def initialize(launcher_configuration: nil)
20
20
  @launcher_config = launcher_configuration
21
+ @device_boot_datetime = DateTime.now
21
22
  end
22
23
 
23
24
  def collected_errors
@@ -192,7 +193,7 @@ module Snapshot
192
193
 
193
194
  UI.header("Collecting system logs #{device_name} - #{language}")
194
195
  log_identity = Digest::MD5.hexdigest(components.join("-"))
195
- FastlaneCore::Simulator.copy_logs(device, log_identity, language_folder)
196
+ FastlaneCore::Simulator.copy_logs(device, log_identity, language_folder, @device_boot_datetime)
196
197
  end
197
198
  end
198
199
  end
@@ -167,7 +167,7 @@ _spaceship_ uses all those API points to offer this seamless experience.
167
167
  _spaceship_ does a lot of magic to get everything working so neatly:
168
168
 
169
169
  - **Sensible Defaults**: You only have to provide the mandatory information (e.g. new provisioning profiles contain all devices by default)
170
- - **Local Validation**: When pushing changes back to the Apple Dev Portal _spaceship_ will make sure only valid data is sent to Apple (e.g. automatic repairing of provisioning profiles)
170
+ - **Local Validation**: When pushing changes back to the Apple Developer Portal _spaceship_ will make sure only valid data is sent to Apple (e.g. automatic repairing of provisioning profiles)
171
171
  - **Various request/response types**: When working with the different API endpoints, _spaceship_ has to deal with `JSON`, `XML`, `txt`, `plist` and sometimes even `HTML` responses and requests.
172
172
  - **Automatic Pagination**: Even if you have thousands of apps, profiles or certificates, _spaceship_ **can** handle your scale. It was heavily tested by first using _spaceship_ to create hundreds of profiles and then accessing them using _spaceship_.
173
173
  - **Session, Cookie and CSRF token**: All the security aspects are handled by _spaceship_.
@@ -196,7 +196,7 @@ module Spaceship
196
196
  self.new(cookie: another_client.instance_variable_get(:@cookie), current_team_id: another_client.team_id)
197
197
  end
198
198
 
199
- def initialize(cookie: nil, current_team_id: nil, timeout: nil)
199
+ def initialize(cookie: nil, current_team_id: nil, csrf_tokens: nil, timeout: nil)
200
200
  options = {
201
201
  request: {
202
202
  timeout: (ENV["SPACESHIP_TIMEOUT"] || timeout || 300).to_i,
@@ -204,6 +204,7 @@ module Spaceship
204
204
  }
205
205
  }
206
206
  @current_team_id = current_team_id
207
+ @csrf_tokens = csrf_tokens
207
208
  @cookie = cookie || HTTP::CookieJar.new
208
209
 
209
210
  @client = Faraday.new(self.class.hostname, options) do |c|
@@ -857,9 +858,7 @@ module Spaceship
857
858
 
858
859
  resp_hash = response.to_hash
859
860
  if resp_hash[:status] == 401
860
- msg = "Auth lost"
861
- logger.warn(msg)
862
- raise UnauthorizedAccessError.new, "Unauthorized Access"
861
+ handle_401(response)
863
862
  end
864
863
 
865
864
  if response.body.to_s.include?("<title>302 Found</title>")
@@ -880,6 +879,12 @@ module Spaceship
880
879
  end
881
880
  end
882
881
 
882
+ def handle_401(response)
883
+ msg = "Auth lost"
884
+ logger.warn(msg)
885
+ raise UnauthorizedAccessError.new, "Unauthorized Access"
886
+ end
887
+
883
888
  def send_request_auto_paginate(method, url_or_path, params, headers, &block)
884
889
  response = send_request(method, url_or_path, params, headers, &block)
885
890
  return response unless should_process_next_rel?(response)
@@ -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
  # {
@@ -97,8 +97,18 @@ module Spaceship
97
97
  end
98
98
 
99
99
  def portal_team_id
100
- return nil if @portal_client.nil?
101
- 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
102
112
  end
103
113
 
104
114
  def tunes_team_id
@@ -126,7 +136,7 @@ module Spaceship
126
136
  "Or set the 'SPACESHIP_CONNECT_API_IN_HOUSE' environment variable to 'true'",
127
137
  "View more info in the docs at https://docs.fastlane.tools/app-store-connect-api/"
128
138
  ]
129
- raise message.join('\n')
139
+ raise message.join('. ')
130
140
  end
131
141
  return !!token.in_house
132
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