fastlane 2.167.0 → 2.172.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +76 -76
  3. data/cert/lib/cert/options.rb +3 -3
  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/{.download_dsyms.rb.swp → .update_fastlane.rb.swp} +0 -0
  12. data/fastlane/lib/fastlane/actions/add_git_tag.rb +12 -3
  13. data/fastlane/lib/fastlane/actions/artifactory.rb +36 -3
  14. data/fastlane/lib/fastlane/actions/build_app.rb +3 -1
  15. data/fastlane/lib/fastlane/actions/create_pull_request.rb +16 -1
  16. data/fastlane/lib/fastlane/actions/create_xcframework.rb +118 -0
  17. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +1 -1
  18. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +1 -1
  19. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +4 -0
  20. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +5 -1
  21. data/fastlane/lib/fastlane/actions/download_app_privacy_details_from_app_store.rb +142 -0
  22. data/fastlane/lib/fastlane/actions/download_dsyms.rb +0 -1
  23. data/fastlane/lib/fastlane/actions/git_commit.rb +6 -2
  24. data/fastlane/lib/fastlane/actions/github_api.rb +14 -3
  25. data/fastlane/lib/fastlane/actions/nexus_upload.rb +1 -0
  26. data/fastlane/lib/fastlane/actions/onesignal.rb +13 -3
  27. data/fastlane/lib/fastlane/actions/pod_push.rb +9 -0
  28. data/fastlane/lib/fastlane/actions/push_to_git_remote.rb +9 -1
  29. data/fastlane/lib/fastlane/actions/register_device.rb +1 -1
  30. data/fastlane/lib/fastlane/actions/register_devices.rb +2 -1
  31. data/fastlane/lib/fastlane/actions/set_github_release.rb +21 -8
  32. data/fastlane/lib/fastlane/actions/slack.rb +4 -5
  33. data/fastlane/lib/fastlane/actions/slather.rb +2 -2
  34. data/fastlane/lib/fastlane/actions/spm.rb +2 -2
  35. data/fastlane/lib/fastlane/actions/swiftlint.rb +4 -4
  36. data/fastlane/lib/fastlane/actions/upload_app_privacy_details_to_app_store.rb +291 -0
  37. data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +3 -3
  38. data/fastlane/lib/fastlane/actions/xcode_install.rb +8 -5
  39. data/fastlane/lib/fastlane/cli_tools_distributor.rb +3 -0
  40. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +1 -1
  41. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +3 -0
  42. data/fastlane/lib/fastlane/version.rb +1 -1
  43. data/fastlane/swift/Deliverfile.swift +2 -2
  44. data/fastlane/swift/DeliverfileProtocol.swift +2 -2
  45. data/fastlane/swift/Fastlane.swift +276 -54
  46. data/fastlane/swift/Gymfile.swift +2 -2
  47. data/fastlane/swift/GymfileProtocol.swift +15 -3
  48. data/fastlane/swift/Matchfile.swift +2 -2
  49. data/fastlane/swift/MatchfileProtocol.swift +4 -4
  50. data/fastlane/swift/Precheckfile.swift +2 -2
  51. data/fastlane/swift/PrecheckfileProtocol.swift +6 -2
  52. data/fastlane/swift/Scanfile.swift +2 -2
  53. data/fastlane/swift/ScanfileProtocol.swift +18 -2
  54. data/fastlane/swift/Screengrabfile.swift +2 -2
  55. data/fastlane/swift/ScreengrabfileProtocol.swift +2 -2
  56. data/fastlane/swift/Snapshotfile.swift +2 -2
  57. data/fastlane/swift/SnapshotfileProtocol.swift +15 -3
  58. data/fastlane_core/lib/fastlane_core/helper.rb +3 -3
  59. data/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb +41 -16
  60. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +3 -4
  61. data/fastlane_core/lib/fastlane_core/project.rb +18 -5
  62. data/frameit/lib/frameit/device_types.rb +7 -1
  63. data/gym/lib/gym/generators/build_command_generator.rb +3 -0
  64. data/gym/lib/gym/options.rb +19 -3
  65. data/match/lib/match/encryption/openssl.rb +4 -2
  66. data/match/lib/match/module.rb +1 -1
  67. data/match/lib/match/options.rb +1 -1
  68. data/match/lib/match/runner.rb +1 -1
  69. data/match/lib/match/storage/git_storage.rb +14 -10
  70. data/precheck/lib/precheck/options.rb +6 -1
  71. data/precheck/lib/precheck/rule_processor.rb +1 -1
  72. data/precheck/lib/precheck/runner.rb +1 -1
  73. data/scan/lib/scan/options.rb +22 -1
  74. data/scan/lib/scan/runner.rb +7 -2
  75. data/scan/lib/scan/slack_poster.rb +4 -1
  76. data/scan/lib/scan/test_command_generator.rb +3 -0
  77. data/screengrab/lib/screengrab/runner.rb +2 -0
  78. data/sigh/lib/sigh/runner.rb +1 -1
  79. data/snapshot/lib/assets/SnapshotHelper.swift +6 -2
  80. data/snapshot/lib/snapshot/options.rb +17 -2
  81. data/snapshot/lib/snapshot/update.rb +1 -1
  82. data/spaceship/lib/spaceship/client.rb +14 -0
  83. data/spaceship/lib/spaceship/connect_api.rb +6 -0
  84. data/spaceship/lib/spaceship/connect_api/api_client.rb +1 -1
  85. data/spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb +3 -2
  86. data/spaceship/lib/spaceship/connect_api/models/app.rb +94 -54
  87. data/spaceship/lib/spaceship/connect_api/models/app_data_usage.rb +59 -0
  88. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_category.rb +65 -0
  89. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_data_protection.rb +27 -0
  90. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_grouping.rb +18 -0
  91. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_purposes.rb +37 -0
  92. data/spaceship/lib/spaceship/connect_api/models/app_data_usages_publish_state.rb +36 -0
  93. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +16 -10
  94. data/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb +8 -4
  95. data/spaceship/lib/spaceship/connect_api/models/app_preview.rb +15 -11
  96. data/spaceship/lib/spaceship/connect_api/models/app_preview_set.rb +13 -9
  97. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +9 -7
  98. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +15 -11
  99. data/spaceship/lib/spaceship/connect_api/models/app_store_review_attachment.rb +7 -5
  100. data/spaceship/lib/spaceship/connect_api/models/app_store_review_detail.rb +6 -4
  101. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +62 -37
  102. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +21 -14
  103. data/spaceship/lib/spaceship/connect_api/models/app_store_version_submission.rb +3 -2
  104. data/spaceship/lib/spaceship/connect_api/models/beta_app_review_submission.rb +3 -2
  105. data/spaceship/lib/spaceship/connect_api/models/beta_feedback.rb +6 -4
  106. data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +12 -2
  107. data/spaceship/lib/spaceship/connect_api/models/beta_tester.rb +12 -8
  108. data/spaceship/lib/spaceship/connect_api/models/build.rb +24 -16
  109. data/spaceship/lib/spaceship/connect_api/models/build_delivery.rb +3 -2
  110. data/spaceship/lib/spaceship/connect_api/models/bundle_id.rb +9 -6
  111. data/spaceship/lib/spaceship/connect_api/models/bundle_id_capability.rb +6 -4
  112. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +12 -8
  113. data/spaceship/lib/spaceship/connect_api/models/device.rb +36 -4
  114. data/spaceship/lib/spaceship/connect_api/models/idfa_declaration.rb +6 -4
  115. data/spaceship/lib/spaceship/connect_api/models/profile.rb +12 -8
  116. data/spaceship/lib/spaceship/connect_api/models/reset_ratings_request.rb +3 -2
  117. data/spaceship/lib/spaceship/connect_api/models/sandbox_tester.rb +9 -6
  118. data/spaceship/lib/spaceship/connect_api/models/territory.rb +3 -2
  119. data/spaceship/lib/spaceship/connect_api/models/user.rb +6 -4
  120. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +9 -6
  121. data/spaceship/lib/spaceship/connect_api/response.rb +3 -1
  122. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +12 -0
  123. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +103 -0
  124. data/spaceship/lib/spaceship/errors.rb +19 -0
  125. data/spaceship/lib/spaceship/tunes/iap_detail.rb +1 -1
  126. data/spaceship/lib/spaceship/tunes/tunes_client.rb +2 -2
  127. data/spaceship/lib/spaceship/two_step_or_factor_client.rb +19 -6
  128. data/supply/lib/supply/options.rb +1 -1
  129. data/supply/lib/supply/uploader.rb +3 -2
  130. metadata +45 -21
@@ -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"
@@ -65,29 +66,34 @@ module Spaceship
65
66
  # API
66
67
  #
67
68
 
68
- def update(filter: {}, includes: nil, limit: nil, sort: nil)
69
- Spaceship::ConnectAPI.patch_app_info(app_info_id: id).first
69
+ def update(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
70
+ client ||= Spaceship::ConnectAPI
71
+ client.patch_app_info(app_info_id: id).first
70
72
  end
71
73
 
72
- def update_categories(category_id_map: nil)
73
- Spaceship::ConnectAPI.patch_app_info_categories(app_info_id: id, category_id_map: category_id_map).first
74
+ def update_categories(client: nil, category_id_map: nil)
75
+ client ||= Spaceship::ConnectAPI
76
+ client.patch_app_info_categories(app_info_id: id, category_id_map: category_id_map).first
74
77
  end
75
78
 
76
- def delete!(filter: {}, includes: nil, limit: nil, sort: nil)
77
- Spaceship::ConnectAPI.delete_app_info(app_info_id: id)
79
+ def delete!(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
80
+ client ||= Spaceship::ConnectAPI
81
+ client.delete_app_info(app_info_id: id)
78
82
  end
79
83
 
80
84
  #
81
85
  # App Info Localizations
82
86
  #
83
87
 
84
- def create_app_info_localization(attributes: nil)
85
- resp = Spaceship::ConnectAPI.post_app_info_localization(app_info_id: id, attributes: attributes)
88
+ def create_app_info_localization(client: nil, attributes: nil)
89
+ client ||= Spaceship::ConnectAPI
90
+ resp = client.post_app_info_localization(app_info_id: id, attributes: attributes)
86
91
  return resp.to_models.first
87
92
  end
88
93
 
89
- def get_app_info_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
90
- resp = Spaceship::ConnectAPI.get_app_info_localizations(app_info_id: id, filter: filter, includes: includes, limit: limit, sort: sort)
94
+ def get_app_info_localizations(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
95
+ client ||= Spaceship::ConnectAPI
96
+ resp = client.get_app_info_localizations(app_info_id: id, filter: filter, includes: includes, limit: limit, sort: sort)
91
97
  return resp.to_models
92
98
  end
93
99
  end
@@ -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
 
@@ -26,13 +28,15 @@ module Spaceship
26
28
  # API
27
29
  #
28
30
 
29
- def update(attributes: nil)
31
+ def update(client: nil, attributes: nil)
32
+ client ||= Spaceship::ConnectAPI
30
33
  attributes = reverse_attr_mapping(attributes)
31
- Spaceship::ConnectAPI.patch_app_info_localization(app_info_localization_id: id, attributes: attributes)
34
+ client.patch_app_info_localization(app_info_localization_id: id, attributes: attributes)
32
35
  end
33
36
 
34
- def delete!(filter: {}, includes: nil, limit: nil, sort: nil)
35
- Spaceship::ConnectAPI.delete_app_info_localization(app_info_localization_id: id)
37
+ def delete!(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
38
+ client ||= Spaceship::ConnectAPI
39
+ client.delete_app_info_localization(app_info_localization_id: id)
36
40
  end
37
41
  end
38
42
  end
@@ -45,8 +45,9 @@ module Spaceship
45
45
  # API
46
46
  #
47
47
 
48
- def self.get(app_preview_id: nil)
49
- Spaceship::ConnectAPI.get_app_preview(app_preview_id: app_preview_id).first
48
+ def self.get(client: nil, app_preview_id: nil)
49
+ client ||= Spaceship::ConnectAPI
50
+ client.get_app_preview(app_preview_id: app_preview_id).first
50
51
  end
51
52
 
52
53
  # Creates an AppPreview in an AppPreviewSet
@@ -54,7 +55,8 @@ module Spaceship
54
55
  # @param app_preview_set_id The AppPreviewSet id
55
56
  # @param path The path of the file
56
57
  # @param frame_time_code The time code for the preview still frame (ex: "00:00:07:01")
57
- def self.create(app_preview_set_id: nil, path: nil, wait_for_processing: true, frame_time_code: nil)
58
+ def self.create(client: nil, app_preview_set_id: nil, path: nil, wait_for_processing: true, frame_time_code: nil)
59
+ client ||= Spaceship::ConnectAPI
58
60
  require 'faraday'
59
61
 
60
62
  filename = File.basename(path)
@@ -67,7 +69,7 @@ module Spaceship
67
69
  }
68
70
 
69
71
  # Create placeholder
70
- preview = Spaceship::ConnectAPI.post_app_preview(
72
+ preview = client.post_app_preview(
71
73
  app_preview_set_id: app_preview_set_id,
72
74
  attributes: post_attributes
73
75
  ).first
@@ -83,14 +85,14 @@ module Spaceship
83
85
  }
84
86
 
85
87
  begin
86
- preview = Spaceship::ConnectAPI.patch_app_preview(
88
+ preview = client.patch_app_preview(
87
89
  app_preview_id: preview.id,
88
90
  attributes: patch_attributes
89
91
  ).first
90
92
  rescue => error
91
93
  puts("Failed to patch app preview. Update may have gone through so verifying") if Spaceship::Globals.verbose?
92
94
 
93
- preview = Spaceship::ConnectAPI::AppPreview.get(app_preview_id: preview.id)
95
+ preview = Spaceship::ConnectAPI::AppPreview.get(client: client, app_preview_id: preview.id)
94
96
  raise error unless preview.complete?
95
97
  end
96
98
 
@@ -111,20 +113,22 @@ module Spaceship
111
113
  puts("Waiting #{sleep_time} seconds before checking status of processing...") if Spaceship::Globals.verbose?
112
114
  sleep(sleep_time)
113
115
 
114
- preview = Spaceship::ConnectAPI::AppPreview.get(app_preview_id: preview.id)
116
+ preview = Spaceship::ConnectAPI::AppPreview.get(client: client, app_preview_id: preview.id)
115
117
  end
116
118
  end
117
119
 
118
120
  preview
119
121
  end
120
122
 
121
- def update(attributes: nil)
123
+ def update(client: nil, attributes: nil)
124
+ client ||= Spaceship::ConnectAPI
122
125
  attributes = reverse_attr_mapping(attributes)
123
- Spaceship::ConnectAPI.patch_app_preview(app_preview_id: id, attributes: attributes).first
126
+ client.patch_app_preview(app_preview_id: id, attributes: attributes).first
124
127
  end
125
128
 
126
- def delete!(filter: {}, includes: nil, limit: nil, sort: nil)
127
- Spaceship::ConnectAPI.delete_app_preview(app_preview_id: id)
129
+ def delete!(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
130
+ client ||= Spaceship::ConnectAPI
131
+ client.delete_app_preview(app_preview_id: id)
128
132
  end
129
133
  end
130
134
  end
@@ -58,18 +58,21 @@ module Spaceship
58
58
  # API
59
59
  #
60
60
 
61
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
62
- resp = Spaceship::ConnectAPI.get_app_preview_sets(filter: filter, includes: includes, limit: limit, sort: sort)
61
+ def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
62
+ client ||= Spaceship::ConnectAPI
63
+ resp = client.get_app_preview_sets(filter: filter, includes: includes, limit: limit, sort: sort)
63
64
  return resp.to_models
64
65
  end
65
66
 
66
- def self.get(app_preview_set_id: nil, includes: "appPreviews")
67
- return Spaceship::ConnectAPI.get_app_preview_set(app_preview_set_id: app_preview_set_id, filter: nil, includes: includes, limit: nil, sort: nil).first
67
+ def self.get(client: nil, app_preview_set_id: nil, includes: "appPreviews")
68
+ client ||= Spaceship::ConnectAPI
69
+ return client.get_app_preview_set(app_preview_set_id: app_preview_set_id, filter: nil, includes: includes, limit: nil, sort: nil).first
68
70
  end
69
71
 
70
- def upload_preview(path: nil, wait_for_processing: true, position: nil, frame_time_code: nil)
72
+ def upload_preview(client: nil, path: nil, wait_for_processing: true, position: nil, frame_time_code: nil)
73
+ client ||= Spaceship::ConnectAPI
71
74
  # Upload preview
72
- preview = Spaceship::ConnectAPI::AppPreview.create(app_preview_set_id: id, path: path, wait_for_processing: wait_for_processing, frame_time_code: frame_time_code)
75
+ preview = Spaceship::ConnectAPI::AppPreview.create(client: client, app_preview_set_id: id, path: path, wait_for_processing: wait_for_processing, frame_time_code: frame_time_code)
73
76
 
74
77
  # Reposition (if specified)
75
78
  unless position.nil?
@@ -90,10 +93,11 @@ module Spaceship
90
93
  return preview
91
94
  end
92
95
 
93
- def reorder_previews(app_preview_ids: nil)
94
- Spaceship::ConnectAPI.patch_app_preview_set_previews(app_preview_set_id: id, app_preview_ids: app_preview_ids)
96
+ def reorder_previews(client: nil, app_preview_ids: nil)
97
+ client ||= Spaceship::ConnectAPI
98
+ client.patch_app_preview_set_previews(app_preview_set_id: id, app_preview_ids: app_preview_ids)
95
99
 
96
- return Spaceship::ConnectAPI.get_app_preview_set(app_preview_set_id: id, includes: "appPreviews").first
100
+ return client.get_app_preview_set(app_preview_set_id: id, includes: "appPreviews").first
97
101
  end
98
102
  end
99
103
  end
@@ -79,7 +79,8 @@ module Spaceship
79
79
  #
80
80
  #
81
81
 
82
- def self.create(app_screenshot_set_id: nil, path: nil, wait_for_processing: true)
82
+ def self.create(client: nil, app_screenshot_set_id: nil, path: nil, wait_for_processing: true)
83
+ client ||= Spaceship::ConnectAPI
83
84
  require 'faraday'
84
85
 
85
86
  filename = File.basename(path)
@@ -93,7 +94,7 @@ module Spaceship
93
94
 
94
95
  # Create placeholder to upload screenshot
95
96
  begin
96
- screenshot = Spaceship::ConnectAPI.post_app_screenshot(
97
+ screenshot = client.post_app_screenshot(
97
98
  app_screenshot_set_id: app_screenshot_set_id,
98
99
  attributes: post_attributes
99
100
  ).first
@@ -117,7 +118,7 @@ module Spaceship
117
118
  sleep(30)
118
119
 
119
120
  screenshots = Spaceship::ConnectAPI::AppScreenshotSet
120
- .get(app_screenshot_set_id: app_screenshot_set_id)
121
+ .get(client: client, app_screenshot_set_id: app_screenshot_set_id)
121
122
  .app_screenshots
122
123
 
123
124
  screenshot = screenshots.find do |s|
@@ -152,7 +153,7 @@ module Spaceship
152
153
  rescue => error
153
154
  puts("Failed to patch app screenshot. Update may have gone through so verifying") if Spaceship::Globals.verbose?
154
155
 
155
- screenshot = Spaceship::ConnectAPI.get_app_screenshot(app_screenshot_id: screenshot.id).first
156
+ screenshot = client.get_app_screenshot(app_screenshot_id: screenshot.id).first
156
157
  raise error unless screenshot.complete?
157
158
  end
158
159
 
@@ -172,15 +173,16 @@ module Spaceship
172
173
  puts("Waiting #{sleep_time} seconds before checking status of processing...") if Spaceship::Globals.verbose?
173
174
  sleep(sleep_time)
174
175
 
175
- screenshot = Spaceship::ConnectAPI.get_app_screenshot(app_screenshot_id: screenshot.id).first
176
+ screenshot = client.get_app_screenshot(app_screenshot_id: screenshot.id).first
176
177
  end
177
178
  end
178
179
 
179
180
  return screenshot
180
181
  end
181
182
 
182
- def delete!(filter: {}, includes: nil, limit: nil, sort: nil)
183
- Spaceship::ConnectAPI.delete_app_screenshot(app_screenshot_id: id)
183
+ def delete!(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
184
+ client ||= Spaceship::ConnectAPI
185
+ client.delete_app_screenshot(app_screenshot_id: id)
184
186
  end
185
187
  end
186
188
  end
@@ -112,22 +112,25 @@ module Spaceship
112
112
  # API
113
113
  #
114
114
 
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)
115
+ def self.all(client: nil, app_store_version_localization_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
116
+ client ||= Spaceship::ConnectAPI
117
+ resp = client.get_app_screenshot_sets(app_store_version_localization_id: app_store_version_localization_id, filter: filter, includes: includes, limit: limit, sort: sort)
117
118
  return resp.to_models
118
119
  end
119
120
 
120
- def self.get(app_screenshot_set_id: nil, includes: "appScreenshots")
121
- return Spaceship::ConnectAPI.get_app_screenshot_set(app_screenshot_set_id: app_screenshot_set_id, filter: nil, includes: includes, limit: nil, sort: nil).first
121
+ def self.get(client: nil, app_screenshot_set_id: nil, includes: "appScreenshots")
122
+ client ||= Spaceship::ConnectAPI
123
+ return client.get_app_screenshot_set(app_screenshot_set_id: app_screenshot_set_id, filter: nil, includes: includes, limit: nil, sort: nil).first
122
124
  end
123
125
 
124
- def upload_screenshot(path: nil, wait_for_processing: true, position: nil)
125
- screenshot = Spaceship::ConnectAPI::AppScreenshot.create(app_screenshot_set_id: id, path: path, wait_for_processing: wait_for_processing)
126
+ def upload_screenshot(client: nil, path: nil, wait_for_processing: true, position: nil)
127
+ client ||= Spaceship::ConnectAPI
128
+ screenshot = Spaceship::ConnectAPI::AppScreenshot.create(client: client, app_screenshot_set_id: id, path: path, wait_for_processing: wait_for_processing)
126
129
 
127
130
  # Reposition (if specified)
128
131
  unless position.nil?
129
132
  # Get all app preview ids
130
- set = AppScreenshotSet.get(app_screenshot_set_id: id)
133
+ set = AppScreenshotSet.get(client: client, app_screenshot_set_id: id)
131
134
  app_screenshot_ids = set.app_screenshots.map(&:id)
132
135
 
133
136
  # Remove new uploaded screenshot
@@ -137,16 +140,17 @@ module Spaceship
137
140
  app_screenshot_ids = app_screenshot_ids.insert(position, screenshot.id).compact
138
141
 
139
142
  # Reorder screenshots
140
- reorder_screenshots(app_screenshot_ids: app_screenshot_ids)
143
+ reorder_screenshots(client: client, app_screenshot_ids: app_screenshot_ids)
141
144
  end
142
145
 
143
146
  return screenshot
144
147
  end
145
148
 
146
- def reorder_screenshots(app_screenshot_ids: nil)
147
- Spaceship::ConnectAPI.patch_app_screenshot_set_screenshots(app_screenshot_set_id: id, app_screenshot_ids: app_screenshot_ids)
149
+ def reorder_screenshots(client: nil, app_screenshot_ids: nil)
150
+ client ||= Spaceship::ConnectAPI
151
+ client.patch_app_screenshot_set_screenshots(app_screenshot_set_id: id, app_screenshot_ids: app_screenshot_ids)
148
152
 
149
- return Spaceship::ConnectAPI.get_app_screenshot_set(app_screenshot_set_id: id, includes: "appScreenshots").first
153
+ return client.get_app_screenshot_set(app_screenshot_set_id: id, includes: "appScreenshots").first
150
154
  end
151
155
  end
152
156
  end
@@ -29,7 +29,8 @@ module Spaceship
29
29
  # API
30
30
  #
31
31
 
32
- def self.create(app_store_review_detail_id: nil, path: nil)
32
+ def self.create(client: nil, app_store_review_detail_id: nil, path: nil)
33
+ client ||= Spaceship::ConnectAPI
33
34
  require 'faraday'
34
35
 
35
36
  filename = File.basename(path)
@@ -42,7 +43,7 @@ module Spaceship
42
43
  }
43
44
 
44
45
  # Create placeholder
45
- attachment = Spaceship::ConnectAPI.post_app_store_review_attachment(
46
+ attachment = client.post_app_store_review_attachment(
46
47
  app_store_review_detail_id: app_store_review_detail_id,
47
48
  attributes: post_attributes
48
49
  ).to_models.first
@@ -57,14 +58,15 @@ module Spaceship
57
58
  sourceFileChecksum: Digest::MD5.hexdigest(bytes)
58
59
  }
59
60
 
60
- Spaceship::ConnectAPI.patch_app_store_review_attachment(
61
+ client.patch_app_store_review_attachment(
61
62
  app_store_review_attachment_id: attachment.id,
62
63
  attributes: patch_attributes
63
64
  ).to_models.first
64
65
  end
65
66
 
66
- def delete!(filter: {}, includes: nil, limit: nil, sort: nil)
67
- Spaceship::ConnectAPI.delete_app_store_review_attachment(app_store_review_attachment_id: id)
67
+ def delete!(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
68
+ client ||= Spaceship::ConnectAPI
69
+ client.delete_app_store_review_attachment(app_store_review_attachment_id: id)
68
70
  end
69
71
  end
70
72
  end