fastlane 2.165.0 → 2.170.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +76 -76
  3. data/cert/lib/cert/options.rb +3 -3
  4. data/cert/lib/cert/runner.rb +1 -1
  5. data/deliver/lib/deliver/app_screenshot.rb +6 -2
  6. data/deliver/lib/deliver/loader.rb +136 -18
  7. data/deliver/lib/deliver/upload_metadata.rb +4 -10
  8. data/deliver/lib/deliver/upload_screenshots.rb +1 -64
  9. data/fastlane/lib/fastlane/actions/actions_helper.rb +1 -1
  10. data/fastlane/lib/fastlane/actions/add_git_tag.rb +9 -2
  11. data/fastlane/lib/fastlane/actions/appledoc.rb +1 -1
  12. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +4 -0
  13. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +1 -1
  14. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +1 -1
  15. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +4 -0
  16. data/fastlane/lib/fastlane/actions/onesignal.rb +13 -3
  17. data/fastlane/lib/fastlane/actions/slather.rb +2 -2
  18. data/fastlane/lib/fastlane/actions/spm.rb +6 -0
  19. data/fastlane/lib/fastlane/actions/update_fastlane.rb +29 -8
  20. data/fastlane/lib/fastlane/actions/upload_app_privacy_details_to_app_store.rb +289 -0
  21. data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +3 -3
  22. data/fastlane/lib/fastlane/actions/xcode_install.rb +8 -5
  23. data/fastlane/lib/fastlane/cli_tools_distributor.rb +2 -2
  24. data/fastlane/lib/fastlane/features.rb +1 -1
  25. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +2 -1
  26. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +3 -0
  27. data/fastlane/lib/fastlane/swift_fastlane_function.rb +1 -1
  28. data/fastlane/lib/fastlane/version.rb +1 -1
  29. data/fastlane/swift/Deliverfile.swift +1 -1
  30. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  31. data/fastlane/swift/Fastfile.swift +1 -1
  32. data/fastlane/swift/Fastlane.swift +97 -26
  33. data/fastlane/swift/Gymfile.swift +1 -1
  34. data/fastlane/swift/GymfileProtocol.swift +5 -1
  35. data/fastlane/swift/LaneFileProtocol.swift +2 -2
  36. data/fastlane/swift/MainProcess.swift +2 -0
  37. data/fastlane/swift/Matchfile.swift +1 -1
  38. data/fastlane/swift/MatchfileProtocol.swift +3 -3
  39. data/fastlane/swift/Precheckfile.swift +1 -1
  40. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  41. data/fastlane/swift/Runner.swift +1 -1
  42. data/fastlane/swift/Scanfile.swift +1 -1
  43. data/fastlane/swift/ScanfileProtocol.swift +9 -1
  44. data/fastlane/swift/Screengrabfile.swift +1 -1
  45. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  46. data/fastlane/swift/Snapshotfile.swift +1 -1
  47. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  48. data/fastlane/swift/SocketClient.swift +1 -1
  49. data/fastlane_core/lib/fastlane_core/cert_checker.rb +12 -7
  50. data/fastlane_core/lib/fastlane_core/helper.rb +10 -2
  51. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +3 -3
  52. data/fastlane_core/lib/fastlane_core/provisioning_profile.rb +3 -1
  53. data/fastlane_core/lib/fastlane_core/ui/disable_colors.rb +8 -0
  54. data/gym/lib/gym/code_signing_mapping.rb +1 -1
  55. data/gym/lib/gym/generators/build_command_generator.rb +1 -0
  56. data/gym/lib/gym/options.rb +7 -1
  57. data/match/lib/match/module.rb +1 -1
  58. data/match/lib/match/nuke.rb +9 -5
  59. data/match/lib/match/options.rb +1 -1
  60. data/match/lib/match/runner.rb +1 -1
  61. data/pilot/lib/pilot/build_manager.rb +9 -3
  62. data/scan/lib/scan/detect_values.rb +3 -1
  63. data/scan/lib/scan/module.rb +4 -0
  64. data/scan/lib/scan/options.rb +16 -1
  65. data/scan/lib/scan/runner.rb +2 -2
  66. data/scan/lib/scan/test_command_generator.rb +1 -0
  67. data/snapshot/lib/assets/SnapshotHelper.swift +5 -1
  68. data/snapshot/lib/snapshot/test_command_generator.rb +1 -1
  69. data/snapshot/lib/snapshot/test_command_generator_base.rb +3 -1
  70. data/snapshot/lib/snapshot/test_command_generator_xcode_8.rb +1 -1
  71. data/spaceship/lib/spaceship/client.rb +14 -0
  72. data/spaceship/lib/spaceship/connect_api.rb +6 -0
  73. data/spaceship/lib/spaceship/connect_api/models/.app_data_usage_data_protection.rb.swp +0 -0
  74. data/spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb +3 -2
  75. data/spaceship/lib/spaceship/connect_api/models/app.rb +88 -54
  76. data/spaceship/lib/spaceship/connect_api/models/app_data_usage.rb +59 -0
  77. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_category.rb +65 -0
  78. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_data_protection.rb +27 -0
  79. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_grouping.rb +18 -0
  80. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_purposes.rb +37 -0
  81. data/spaceship/lib/spaceship/connect_api/models/app_data_usages_publish_state.rb +36 -0
  82. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +16 -10
  83. data/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb +8 -4
  84. data/spaceship/lib/spaceship/connect_api/models/app_preview.rb +15 -11
  85. data/spaceship/lib/spaceship/connect_api/models/app_preview_set.rb +13 -9
  86. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +9 -7
  87. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +15 -11
  88. data/spaceship/lib/spaceship/connect_api/models/app_store_review_attachment.rb +7 -5
  89. data/spaceship/lib/spaceship/connect_api/models/app_store_review_detail.rb +6 -4
  90. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +55 -36
  91. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +21 -14
  92. data/spaceship/lib/spaceship/connect_api/models/app_store_version_submission.rb +3 -2
  93. data/spaceship/lib/spaceship/connect_api/models/beta_app_review_submission.rb +3 -2
  94. data/spaceship/lib/spaceship/connect_api/models/beta_feedback.rb +6 -4
  95. data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +12 -2
  96. data/spaceship/lib/spaceship/connect_api/models/beta_tester.rb +12 -8
  97. data/spaceship/lib/spaceship/connect_api/models/build.rb +24 -16
  98. data/spaceship/lib/spaceship/connect_api/models/build_delivery.rb +3 -2
  99. data/spaceship/lib/spaceship/connect_api/models/bundle_id.rb +9 -6
  100. data/spaceship/lib/spaceship/connect_api/models/bundle_id_capability.rb +6 -4
  101. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +12 -8
  102. data/spaceship/lib/spaceship/connect_api/models/device.rb +10 -4
  103. data/spaceship/lib/spaceship/connect_api/models/idfa_declaration.rb +6 -4
  104. data/spaceship/lib/spaceship/connect_api/models/profile.rb +12 -8
  105. data/spaceship/lib/spaceship/connect_api/models/reset_ratings_request.rb +3 -2
  106. data/spaceship/lib/spaceship/connect_api/models/sandbox_tester.rb +9 -6
  107. data/spaceship/lib/spaceship/connect_api/models/territory.rb +3 -2
  108. data/spaceship/lib/spaceship/connect_api/models/user.rb +6 -4
  109. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +9 -6
  110. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +12 -0
  111. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +103 -0
  112. data/spaceship/lib/spaceship/errors.rb +19 -0
  113. data/spaceship/lib/spaceship/tunes/iap_detail.rb +1 -1
  114. data/spaceship/lib/spaceship/tunes/tunes_client.rb +2 -2
  115. data/spaceship/lib/spaceship/two_step_or_factor_client.rb +18 -6
  116. data/supply/lib/supply.rb +1 -1
  117. data/supply/lib/supply/options.rb +1 -1
  118. data/supply/lib/supply/uploader.rb +3 -2
  119. metadata +26 -18
@@ -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"
@@ -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