fastlane 2.168.0 → 2.173.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +68 -68
  3. data/cert/lib/cert/options.rb +2 -2
  4. data/deliver/lib/deliver/app_screenshot.rb +5 -7
  5. data/deliver/lib/deliver/app_screenshot_validator.rb +108 -0
  6. data/deliver/lib/deliver/commands_generator.rb +1 -1
  7. data/deliver/lib/deliver/loader.rb +123 -21
  8. data/deliver/lib/deliver/setup.rb +8 -3
  9. data/deliver/lib/deliver/upload_metadata.rb +6 -10
  10. data/deliver/lib/deliver/upload_screenshots.rb +1 -64
  11. data/fastlane/lib/fastlane/actions/add_git_tag.rb +12 -3
  12. data/fastlane/lib/fastlane/actions/artifactory.rb +36 -3
  13. data/fastlane/lib/fastlane/actions/build_app.rb +3 -1
  14. data/fastlane/lib/fastlane/actions/create_pull_request.rb +16 -1
  15. data/fastlane/lib/fastlane/actions/create_xcframework.rb +118 -0
  16. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +1 -1
  17. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +1 -1
  18. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +4 -0
  19. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +5 -1
  20. data/fastlane/lib/fastlane/actions/download_app_privacy_details_from_app_store.rb +142 -0
  21. data/fastlane/lib/fastlane/actions/download_dsyms.rb +0 -1
  22. data/fastlane/lib/fastlane/actions/git_commit.rb +6 -2
  23. data/fastlane/lib/fastlane/actions/github_api.rb +14 -3
  24. data/fastlane/lib/fastlane/actions/nexus_upload.rb +1 -0
  25. data/fastlane/lib/fastlane/actions/onesignal.rb +13 -3
  26. data/fastlane/lib/fastlane/actions/pod_push.rb +9 -0
  27. data/fastlane/lib/fastlane/actions/push_to_git_remote.rb +9 -1
  28. data/fastlane/lib/fastlane/actions/register_device.rb +1 -1
  29. data/fastlane/lib/fastlane/actions/register_devices.rb +2 -1
  30. data/fastlane/lib/fastlane/actions/set_github_release.rb +21 -8
  31. data/fastlane/lib/fastlane/actions/slack.rb +4 -5
  32. data/fastlane/lib/fastlane/actions/spm.rb +2 -2
  33. data/fastlane/lib/fastlane/actions/swiftlint.rb +4 -4
  34. data/fastlane/lib/fastlane/actions/upload_app_privacy_details_to_app_store.rb +291 -0
  35. data/fastlane/lib/fastlane/actions/xcode_install.rb +8 -5
  36. data/fastlane/lib/fastlane/cli_tools_distributor.rb +3 -0
  37. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +1 -1
  38. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +3 -0
  39. data/fastlane/lib/fastlane/version.rb +1 -1
  40. data/fastlane/swift/Deliverfile.swift +2 -2
  41. data/fastlane/swift/DeliverfileProtocol.swift +2 -2
  42. data/fastlane/swift/Fastlane.swift +267 -45
  43. data/fastlane/swift/Gymfile.swift +2 -2
  44. data/fastlane/swift/GymfileProtocol.swift +15 -3
  45. data/fastlane/swift/Matchfile.swift +2 -2
  46. data/fastlane/swift/MatchfileProtocol.swift +2 -2
  47. data/fastlane/swift/Precheckfile.swift +2 -2
  48. data/fastlane/swift/PrecheckfileProtocol.swift +6 -2
  49. data/fastlane/swift/Scanfile.swift +2 -2
  50. data/fastlane/swift/ScanfileProtocol.swift +18 -2
  51. data/fastlane/swift/Screengrabfile.swift +2 -2
  52. data/fastlane/swift/ScreengrabfileProtocol.swift +2 -2
  53. data/fastlane/swift/Snapshotfile.swift +2 -2
  54. data/fastlane/swift/SnapshotfileProtocol.swift +15 -3
  55. data/fastlane_core/lib/fastlane_core/helper.rb +2 -2
  56. data/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb +41 -16
  57. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +3 -4
  58. data/fastlane_core/lib/fastlane_core/project.rb +19 -6
  59. data/frameit/lib/frameit/device_types.rb +7 -1
  60. data/gym/lib/gym/error_handler.rb +8 -0
  61. data/gym/lib/gym/generators/build_command_generator.rb +3 -0
  62. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +2 -2
  63. data/gym/lib/gym/options.rb +19 -3
  64. data/match/lib/match/encryption/openssl.rb +4 -2
  65. data/match/lib/match/runner.rb +1 -1
  66. data/match/lib/match/storage/git_storage.rb +14 -10
  67. data/precheck/lib/precheck/options.rb +6 -1
  68. data/precheck/lib/precheck/rule_processor.rb +1 -1
  69. data/precheck/lib/precheck/runner.rb +1 -1
  70. data/scan/lib/scan/options.rb +22 -1
  71. data/scan/lib/scan/runner.rb +6 -1
  72. data/scan/lib/scan/slack_poster.rb +4 -1
  73. data/scan/lib/scan/test_command_generator.rb +3 -0
  74. data/screengrab/lib/screengrab/runner.rb +2 -0
  75. data/sigh/lib/sigh/runner.rb +1 -1
  76. data/snapshot/lib/assets/SnapshotHelper.swift +6 -2
  77. data/snapshot/lib/snapshot/options.rb +17 -2
  78. data/snapshot/lib/snapshot/update.rb +1 -1
  79. data/spaceship/lib/spaceship/client.rb +28 -1
  80. data/spaceship/lib/spaceship/connect_api.rb +6 -0
  81. data/spaceship/lib/spaceship/connect_api/api_client.rb +1 -1
  82. data/spaceship/lib/spaceship/connect_api/models/app.rb +19 -4
  83. data/spaceship/lib/spaceship/connect_api/models/app_data_usage.rb +59 -0
  84. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_category.rb +65 -0
  85. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_data_protection.rb +27 -0
  86. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_grouping.rb +18 -0
  87. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_purposes.rb +37 -0
  88. data/spaceship/lib/spaceship/connect_api/models/app_data_usages_publish_state.rb +36 -0
  89. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +1 -0
  90. data/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb +2 -0
  91. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +8 -1
  92. data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +9 -0
  93. data/spaceship/lib/spaceship/connect_api/models/device.rb +30 -0
  94. data/spaceship/lib/spaceship/connect_api/response.rb +3 -1
  95. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +12 -0
  96. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +103 -0
  97. data/spaceship/lib/spaceship/errors.rb +19 -0
  98. data/spaceship/lib/spaceship/two_step_or_factor_client.rb +19 -6
  99. data/spaceship/lib/spaceship/upgrade_2fa_later_client.rb +91 -0
  100. metadata +44 -23
  101. data/fastlane/lib/fastlane/actions/.download_dsyms.rb.swp +0 -0
  102. data/spaceship/lib/spaceship/connect_api/models/.app.rb.swp +0 -0
  103. data/spaceship/lib/spaceship/connect_api/models/.app_screenshot.rb.swp +0 -0
  104. data/spaceship/lib/spaceship/connect_api/models/.build.rb.swp +0 -0
@@ -35,6 +35,12 @@ require 'spaceship/connect_api/models/custom_app_organization'
35
35
  require 'spaceship/connect_api/models/custom_app_user'
36
36
  require 'spaceship/connect_api/models/pre_release_version'
37
37
 
38
+ require 'spaceship/connect_api/models/app_data_usage'
39
+ require 'spaceship/connect_api/models/app_data_usage_category'
40
+ require 'spaceship/connect_api/models/app_data_usage_data_protection'
41
+ require 'spaceship/connect_api/models/app_data_usage_grouping'
42
+ require 'spaceship/connect_api/models/app_data_usage_purposes'
43
+ require 'spaceship/connect_api/models/app_data_usages_publish_state'
38
44
  require 'spaceship/connect_api/models/age_rating_declaration'
39
45
  require 'spaceship/connect_api/models/app_category'
40
46
  require 'spaceship/connect_api/models/app_info'
@@ -196,7 +196,7 @@ module Spaceship
196
196
 
197
197
  store_csrf_tokens(response)
198
198
 
199
- return Spaceship::ConnectAPI::Response.new(body: response.body, status: response.status, client: self)
199
+ return Spaceship::ConnectAPI::Response.new(body: response.body, status: response.status, headers: response.headers, client: self)
200
200
  end
201
201
 
202
202
  def handle_401(response)
@@ -117,7 +117,8 @@ module Spaceship
117
117
  Spaceship::ConnectAPI::AppInfo::AppStoreState::PENDING_APPLE_RELEASE,
118
118
  Spaceship::ConnectAPI::AppInfo::AppStoreState::PENDING_DEVELOPER_RELEASE,
119
119
  Spaceship::ConnectAPI::AppInfo::AppStoreState::PROCESSING_FOR_APP_STORE,
120
- Spaceship::ConnectAPI::AppInfo::AppStoreState::IN_REVIEW
120
+ Spaceship::ConnectAPI::AppInfo::AppStoreState::IN_REVIEW,
121
+ Spaceship::ConnectAPI::AppInfo::AppStoreState::DEVELOPER_REMOVED_FROM_SALE
121
122
  ]
122
123
 
123
124
  resp = client.get_app_infos(app_id: id, includes: includes)
@@ -143,6 +144,12 @@ module Spaceship
143
144
  end.first
144
145
  end
145
146
 
147
+ def fetch_latest_app_info(client: nil, includes: Spaceship::ConnectAPI::AppInfo::ESSENTIAL_INCLUDES)
148
+ client ||= Spaceship::ConnectAPI
149
+ resp = client.get_app_infos(app_id: id, includes: includes)
150
+ return resp.to_models.first
151
+ end
152
+
146
153
  #
147
154
  # Available Territories
148
155
  #
@@ -230,7 +237,10 @@ module Spaceship
230
237
  client ||= Spaceship::ConnectAPI
231
238
  platform ||= Spaceship::ConnectAPI::Platform::IOS
232
239
  filter = {
233
- appStoreState: Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::READY_FOR_SALE,
240
+ appStoreState: [
241
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::READY_FOR_SALE,
242
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::DEVELOPER_REMOVED_FROM_SALE
243
+ ].join(","),
234
244
  platform: platform
235
245
  }
236
246
  return get_app_store_versions(client: client, filter: filter, includes: includes).first
@@ -282,8 +292,13 @@ module Spaceship
282
292
 
283
293
  def get_app_store_versions(client: nil, filter: {}, includes: Spaceship::ConnectAPI::AppStoreVersion::ESSENTIAL_INCLUDES, limit: nil, sort: nil)
284
294
  client ||= Spaceship::ConnectAPI
285
- resps = client.get_app_store_versions(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages
286
- return resps.flat_map(&:to_models)
295
+ if limit.nil?
296
+ resps = client.get_app_store_versions(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages
297
+ return resps.flat_map(&:to_models)
298
+ else
299
+ resp = client.get_app_store_versions(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort)
300
+ return resp.to_models
301
+ end
287
302
  end
288
303
 
289
304
  #
@@ -0,0 +1,59 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class AppDataUsage
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :category
8
+ attr_accessor :grouping
9
+ attr_accessor :purpose
10
+ attr_accessor :data_protection
11
+
12
+ attr_mapping({
13
+ "category" => "category",
14
+ "grouping" => "grouping",
15
+ "dataProtection" => "data_protection"
16
+ })
17
+
18
+ def self.type
19
+ return "appDataUsages"
20
+ end
21
+
22
+ #
23
+ # Helpers
24
+ #
25
+
26
+ def is_not_collected?
27
+ return false unless data_protection
28
+ return data_protection.id == "DATA_NOT_COLLECTED"
29
+ end
30
+
31
+ #
32
+ # API
33
+ #
34
+
35
+ def self.all(app_id:, filter: {}, includes: nil, limit: nil, sort: nil)
36
+ raise "app_id is required " if app_id.nil?
37
+
38
+ resps = Spaceship::ConnectAPI.get_app_data_usages(app_id: app_id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages
39
+ return resps.flat_map(&:to_models)
40
+ end
41
+
42
+ def self.create(app_id:, app_data_usage_category_id: nil, app_data_usage_protection_id: nil, app_data_usage_purpose_id: nil)
43
+ raise "app_id is required " if app_id.nil?
44
+
45
+ resp = Spaceship::ConnectAPI.post_app_data_usage(
46
+ app_id: app_id,
47
+ app_data_usage_category_id: app_data_usage_category_id,
48
+ app_data_usage_protection_id: app_data_usage_protection_id,
49
+ app_data_usage_purpose_id: app_data_usage_purpose_id
50
+ )
51
+ return resp.to_models.first
52
+ end
53
+
54
+ def delete!
55
+ Spaceship::ConnectAPI.delete_app_data_usage(app_data_usage_id: id)
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,65 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class AppDataUsageCategory
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :deleted
8
+ attr_accessor :grouping
9
+
10
+ attr_mapping({
11
+ "deleted" => "deleted",
12
+ "grouping" => "grouping"
13
+ })
14
+
15
+ # Found at https://appstoreconnect.apple.com/iris/v1/appDataUsageCategories
16
+ module ID
17
+ PAYMENT_INFORMATION = "PAYMENT_INFORMATION"
18
+ CREDIT_AND_FRAUD = "CREDIT_AND_FRAUD"
19
+ OTHER_FINANCIAL_INFO = "OTHER_FINANCIAL_INFO"
20
+ PRECISE_LOCATION = "PRECISE_LOCATION"
21
+ SENSITIVE_INFO = "SENSITIVE_INFO"
22
+ PHYSICAL_ADDRESS = "PHYSICAL_ADDRESS"
23
+ EMAIL_ADDRESS = "EMAIL_ADDRESS"
24
+ NAME = "NAME"
25
+ PHONE_NUMBER = "PHONE_NUMBER"
26
+ OTHER_CONTACT_INFO = "OTHER_CONTACT_INFO"
27
+ CONTACTS = "CONTACTS"
28
+ EMAILS_OR_TEXT_MESSAGES = "EMAILS_OR_TEXT_MESSAGES"
29
+ PHOTOS_OR_VIDEOS = "PHOTOS_OR_VIDEOS"
30
+ AUDIO = "AUDIO"
31
+ GAMEPLAY_CONTENT = "GAMEPLAY_CONTENT"
32
+ CUSTOMER_SUPPORT = "CUSTOMER_SUPPORT"
33
+ OTHER_USER_CONTENT = "OTHER_USER_CONTENT"
34
+ BROWSING_HISTORY = "BROWSING_HISTORY"
35
+ SEARCH_HISTORY = "SEARCH_HISTORY"
36
+ USER_ID = "USER_ID"
37
+ DEVICE_ID = "DEVICE_ID"
38
+ PURCHASE_HISTORY = "PURCHASE_HISTORY"
39
+ PRODUCT_INTERACTION = "PRODUCT_INTERACTION"
40
+ ADVERTISING_DATA = "ADVERTISING_DATA"
41
+ OTHER_USAGE_DATA = "OTHER_USAGE_DATA"
42
+ CRASH_DATA = "CRASH_DATA"
43
+ PERFORMANCE_DATA = "PERFORMANCE_DATA"
44
+ OTHER_DIAGNOSTIC_DATA = "OTHER_DIAGNOSTIC_DATA"
45
+ OTHER_DATA = "OTHER_DATA"
46
+ HEALTH = "HEALTH"
47
+ FITNESS = "FITNESS"
48
+ COARSE_LOCATION = "COARSE_LOCATION"
49
+ end
50
+
51
+ def self.type
52
+ return "appDataUsageCategories"
53
+ end
54
+
55
+ #
56
+ # API
57
+ #
58
+
59
+ def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
60
+ resps = Spaceship::ConnectAPI.get_app_data_usage_categories(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
61
+ return resps.flat_map(&:to_models)
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,27 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class AppDataUsageDataProtection
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :deleted
8
+
9
+ attr_mapping({
10
+ "deleted" => "deleted"
11
+ })
12
+
13
+ # Found at https://appstoreconnect.apple.com/iris/v1/appDataUsageDataProtections
14
+ module ID
15
+ DATA_USED_TO_TRACK_YOU = "DATA_USED_TO_TRACK_YOU"
16
+ DATA_LINKED_TO_YOU = "DATA_LINKED_TO_YOU"
17
+ DATA_NOT_LINKED_TO_YOU = "DATA_NOT_LINKED_TO_YOU"
18
+
19
+ DATA_NOT_COLLECTED = "DATA_NOT_COLLECTED"
20
+ end
21
+
22
+ def self.type
23
+ return "appDataUsageDataProtections"
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,18 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class AppDataUsageGrouping
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :deleted
8
+
9
+ attr_mapping({
10
+ "deleted" => "deleted"
11
+ })
12
+
13
+ def self.type
14
+ return "appDataUsageGroupings"
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,37 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class AppDataUsagePurpose
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :deleted
8
+
9
+ attr_mapping({
10
+ "deleted" => "deleted"
11
+ })
12
+
13
+ # Found at https://appstoreconnect.apple.com/iris/v1/appDataUsagePurposes
14
+ module ID
15
+ THIRD_PARTY_ADVERTISING = "THIRD_PARTY_ADVERTISING"
16
+ DEVELOPERS_ADVERTISING = "DEVELOPERS_ADVERTISING"
17
+ ANALYTICS = "ANALYTICS"
18
+ PRODUCT_PERSONALIZATION = "PRODUCT_PERSONALIZATION"
19
+ APP_FUNCTIONALITY = "APP_FUNCTIONALITY"
20
+ OTHER_PURPOSES = "OTHER_PURPOSES"
21
+ end
22
+
23
+ def self.type
24
+ return "appDataUsagePurposes"
25
+ end
26
+
27
+ #
28
+ # API
29
+ #
30
+
31
+ def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
32
+ resps = Spaceship::ConnectAPI.get_app_data_usage_purposes(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
33
+ return resps.flat_map(&:to_models)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,36 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class AppDataUsagesPublishState
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :published
8
+ attr_accessor :last_published
9
+ attr_accessor :last_published_by
10
+
11
+ attr_mapping({
12
+ "published" => "published",
13
+ "lastPublished" => "last_published",
14
+ "lastPublishedBy" => "last_published_by"
15
+ })
16
+
17
+ def self.type
18
+ return "appDataUsagesPublishState"
19
+ end
20
+
21
+ #
22
+ # API
23
+ #
24
+
25
+ def self.get(app_id: nil)
26
+ resp = Spaceship::ConnectAPI.get_app_data_usages_publish_state(app_id: app_id)
27
+ return resp.to_models.first
28
+ end
29
+
30
+ def publish!
31
+ resp = Spaceship::ConnectAPI.patch_app_data_usages_publish_state(app_data_usages_publish_state_id: id, published: true)
32
+ return resp.to_models.first
33
+ end
34
+ end
35
+ end
36
+ end
@@ -24,6 +24,7 @@ module Spaceship
24
24
  IN_REVIEW = "IN_REVIEW"
25
25
  WAITING_FOR_REVIEW = "WAITING_FOR_REVIEW"
26
26
  DEVELOPER_REJECTED = "DEVELOPER_REJECTED"
27
+ DEVELOPER_REMOVED_FROM_SALE = "DEVELOPER_REMOVED_FROM_SALE"
27
28
  REJECTED = "REJECTED"
28
29
  PREPARE_FOR_SUBMISSION = "PREPARE_FOR_SUBMISSION"
29
30
  METADATA_REJECTED = "METADATA_REJECTED"
@@ -8,6 +8,7 @@ module Spaceship
8
8
  attr_accessor :name
9
9
  attr_accessor :subtitle
10
10
  attr_accessor :privacy_policy_url
11
+ attr_accessor :privacy_choices_url
11
12
  attr_accessor :privacy_policy_text
12
13
 
13
14
  attr_mapping({
@@ -15,6 +16,7 @@ module Spaceship
15
16
  "name" => "name",
16
17
  "subtitle" => "subtitle",
17
18
  "privacyPolicyUrl" => "privacy_policy_url",
19
+ "privacyChoicesUrl" => "privacy_choices_url",
18
20
  "privacyPolicyText" => "privacy_policy_text"
19
21
  })
20
22
 
@@ -21,6 +21,9 @@ module Spaceship
21
21
  attr_accessor :created_date
22
22
 
23
23
  attr_accessor :app_store_version_submission
24
+ attr_accessor :app_store_version_phased_release
25
+ attr_accessor :app_store_review_detail
26
+ attr_accessor :app_store_version_localizations
24
27
 
25
28
  module AppStoreState
26
29
  READY_FOR_SALE = "READY_FOR_SALE"
@@ -30,6 +33,7 @@ module Spaceship
30
33
  IN_REVIEW = "IN_REVIEW"
31
34
  WAITING_FOR_REVIEW = "WAITING_FOR_REVIEW"
32
35
  DEVELOPER_REJECTED = "DEVELOPER_REJECTED"
36
+ DEVELOPER_REMOVED_FROM_SALE = "DEVELOPER_REMOVED_FROM_SALE"
33
37
  REJECTED = "REJECTED"
34
38
  PREPARE_FOR_SUBMISSION = "PREPARE_FOR_SUBMISSION"
35
39
  METADATA_REJECTED = "METADATA_REJECTED"
@@ -57,7 +61,10 @@ module Spaceship
57
61
  "createdDate" => "created_date",
58
62
 
59
63
  "appStoreVersionSubmission" => "app_store_version_submission",
60
- "build" => "build"
64
+ "build" => "build",
65
+ "appStoreVersionPhasedRelease" => "app_store_version_phased_release",
66
+ "appStoreReviewDetail" => "app_store_review_detail",
67
+ "appStoreVersionLocalizations" => "app_store_version_localizations"
61
68
  })
62
69
 
63
70
  ESSENTIAL_INCLUDES = [
@@ -38,6 +38,15 @@ module Spaceship
38
38
  return client.post_bulk_beta_tester_assignments(beta_group_id: id, beta_testers: beta_testers)
39
39
  end
40
40
 
41
+ def update(client: nil, attributes: nil)
42
+ return if attributes.empty?
43
+
44
+ client ||= Spaceship::ConnectAPI
45
+
46
+ attributes = reverse_attr_mapping(attributes)
47
+ return client.patch_group(group_id: id, attributes: attributes).first
48
+ end
49
+
41
50
  def delete!
42
51
  return Spaceship::ConnectAPI.delete_beta_group(group_id: id)
43
52
  end
@@ -40,6 +40,10 @@ module Spaceship
40
40
  return "devices"
41
41
  end
42
42
 
43
+ def enabled?
44
+ return status == Status::ENABLED
45
+ end
46
+
43
47
  #
44
48
  # API
45
49
  #
@@ -50,6 +54,32 @@ module Spaceship
50
54
  return resps.flat_map(&:to_models)
51
55
  end
52
56
 
57
+ # @param client [ConnectAPI] ConnectAPI client.
58
+ # @param platform [String] The platform of the device.
59
+ # @param include_disabled [Bool] Whether to include disable devices. false by default.
60
+ # @return (Device) Find a device based on the UDID of the device. nil if no device was found.
61
+ def self.find_by_udid(device_udid, client: nil, platform: nil, include_disabled: false)
62
+ self.all(client: client).find do |device|
63
+ device.udid.casecmp(device_udid) == 0 && (include_disabled ? true : device.enabled?)
64
+ end
65
+ end
66
+
67
+ # @param client [ConnectAPI] ConnectAPI client.
68
+ # @param name [String] The name to be assigned to the device, if it needs to be created.
69
+ # @param platform [String] The platform of the device.
70
+ # @param include_disabled [Bool] Whether to include disable devices. false by default.
71
+ # @return (Device) Find a device based on the UDID of the device. If no device was found, nil if no device was found.
72
+ def self.find_or_create(device_udid, client: nil, name: nil, platform: nil, include_disabled: false)
73
+ existing = self.find_by_udid(device_udid, client: client, platform: platform)
74
+ return existing if existing
75
+ return self.create(client: client, name: name, platform: platform, udid: device_udid)
76
+ end
77
+
78
+ # @param client [ConnectAPI] ConnectAPI client.
79
+ # @param name [String] The name to be assigned to the device.
80
+ # @param platform [String] The platform of the device.
81
+ # @param udid [String] The udid of the device being created.
82
+ # @return (Device) Find a device based on the UDID of the device. nil if no device was found.
53
83
  def self.create(client: nil, name: nil, platform: nil, udid: nil)
54
84
  client ||= Spaceship::ConnectAPI
55
85
  resp = client.post_device(name: name, platform: platform, udid: udid)
@@ -6,11 +6,13 @@ module Spaceship
6
6
  include Enumerable
7
7
  attr_reader :body
8
8
  attr_reader :status
9
+ attr_reader :headers
9
10
  attr_reader :client
10
11
 
11
- def initialize(body: nil, status: nil, client: nil)
12
+ def initialize(body: nil, status: nil, headers: nil, client: nil)
12
13
  @body = body
13
14
  @status = status
15
+ @headers = headers
14
16
  @client = client
15
17
  end
16
18