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
@@ -24,8 +24,9 @@ module Spaceship
24
24
  # API
25
25
  #
26
26
 
27
- def self.all(app_id: nil, version: nil, build_number: nil)
28
- resps = Spaceship::ConnectAPI.get_build_deliveries(
27
+ def self.all(client: nil, app_id: nil, version: nil, build_number: nil)
28
+ client ||= Spaceship::ConnectAPI
29
+ resps = client.get_build_deliveries(
29
30
  filter: { app: app_id, cfBundleShortVersionString: version, cfBundleVersion: build_number },
30
31
  limit: 1
31
32
  ).all_pages
@@ -39,19 +39,22 @@ module Spaceship
39
39
  # API
40
40
  #
41
41
 
42
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
43
- resps = Spaceship::ConnectAPI.get_bundle_ids(filter: filter, includes: includes).all_pages
42
+ def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
43
+ client ||= Spaceship::ConnectAPI
44
+ resps = client.get_bundle_ids(filter: filter, includes: includes).all_pages
44
45
  return resps.flat_map(&:to_models)
45
46
  end
46
47
 
47
- def self.find(identifier, includes: nil)
48
- return all(filter: { identifier: identifier }, includes: includes).find do |app|
48
+ def self.find(identifier, includes: nil, client: nil)
49
+ client ||= Spaceship::ConnectAPI
50
+ return all(client: client, filter: { identifier: identifier }, includes: includes).find do |app|
49
51
  app.identifier == identifier
50
52
  end
51
53
  end
52
54
 
53
- def self.get(bundle_id_id: nil, includes: nil)
54
- return Spaceship::ConnectAPI.get_bundle_id(bundle_id_id: bundle_id_id, includes: includes).first
55
+ def self.get(client: nil, bundle_id_id: nil, includes: nil)
56
+ client ||= Spaceship::ConnectAPI
57
+ return client.get_bundle_id(bundle_id_id: bundle_id_id, includes: includes).first
55
58
  end
56
59
  end
57
60
  end
@@ -59,12 +59,14 @@ module Spaceship
59
59
  # API
60
60
  #
61
61
 
62
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
63
- return users_client.get_users(filter: filter, includes: includes)
62
+ def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
63
+ client ||= Spaceship::ConnectAPI
64
+ return client.get_users(filter: filter, includes: includes)
64
65
  end
65
66
 
66
- def self.find(email: nil, includes: nil)
67
- return all(filter: { email: email }, includes: includes)
67
+ def self.find(client: nil, email: nil, includes: nil)
68
+ client ||= Spaceship::ConnectAPI
69
+ return all(client: client, filter: { email: email }, includes: includes)
68
70
  end
69
71
  end
70
72
  end
@@ -75,27 +75,31 @@ module Spaceship
75
75
  # API
76
76
  #
77
77
 
78
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
79
- resps = Spaceship::ConnectAPI.get_certificates(filter: filter, includes: includes).all_pages
78
+ def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
79
+ client ||= Spaceship::ConnectAPI
80
+ resps = client.get_certificates(filter: filter, includes: includes).all_pages
80
81
  return resps.flat_map(&:to_models)
81
82
  end
82
83
 
83
- def self.create(certificate_type: nil, csr_content: nil)
84
+ def self.create(client: nil, certificate_type: nil, csr_content: nil)
85
+ client ||= Spaceship::ConnectAPI
84
86
  attributes = {
85
87
  certificateType: certificate_type,
86
88
  csrContent: csr_content
87
89
  }
88
- resp = Spaceship::ConnectAPI.post_certificate(attributes: attributes)
90
+ resp = client.post_certificate(attributes: attributes)
89
91
  return resp.to_models.first
90
92
  end
91
93
 
92
- def self.get(certificate_id: nil, includes: nil)
93
- resp = Spaceship::ConnectAPI.get_certificate(certificate_id: certificate_id, includes: includes)
94
+ def self.get(client: nil, certificate_id: nil, includes: nil)
95
+ client ||= Spaceship::ConnectAPI
96
+ resp = client.get_certificate(certificate_id: certificate_id, includes: includes)
94
97
  return resp.to_models.first
95
98
  end
96
99
 
97
- def delete!
98
- Spaceship::ConnectAPI.delete_certificate(certificate_id: id)
100
+ def delete!(client: nil)
101
+ client ||= Spaceship::ConnectAPI
102
+ client.delete_certificate(certificate_id: id)
99
103
  end
100
104
  end
101
105
  end
@@ -40,17 +40,49 @@ 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
  #
46
50
 
47
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
48
- resps = Spaceship::ConnectAPI.get_devices(filter: filter, includes: includes).all_pages
51
+ def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
52
+ client ||= Spaceship::ConnectAPI
53
+ resps = client.get_devices(filter: filter, includes: includes).all_pages
49
54
  return resps.flat_map(&:to_models)
50
55
  end
51
56
 
52
- def self.create(name: nil, platform: nil, udid: nil)
53
- resp = Spaceship::ConnectAPI.post_device(name: name, platform: platform, udid: udid)
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.
83
+ def self.create(client: nil, name: nil, platform: nil, udid: nil)
84
+ client ||= Spaceship::ConnectAPI
85
+ resp = client.post_device(name: name, platform: platform, udid: udid)
54
86
  return resp.to_models.first
55
87
  end
56
88
  end
@@ -28,13 +28,15 @@ module Spaceship
28
28
  # API
29
29
  #
30
30
 
31
- def update(attributes: nil)
31
+ def update(client: nil, attributes: nil)
32
+ client ||= Spaceship::ConnectAPI
32
33
  attributes = reverse_attr_mapping(attributes)
33
- Spaceship::ConnectAPI.patch_idfa_declaration(idfa_declaration_id: id, attributes: attributes)
34
+ client.patch_idfa_declaration(idfa_declaration_id: id, attributes: attributes)
34
35
  end
35
36
 
36
- def delete!
37
- Spaceship::ConnectAPI.delete_idfa_declaration(idfa_declaration_id: id)
37
+ def delete!(client: nil)
38
+ client ||= Spaceship::ConnectAPI
39
+ client.delete_idfa_declaration(idfa_declaration_id: id)
38
40
  end
39
41
  end
40
42
  end
@@ -65,13 +65,15 @@ module Spaceship
65
65
  # API
66
66
  #
67
67
 
68
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
69
- resps = Spaceship::ConnectAPI.get_profiles(filter: filter, includes: includes).all_pages
68
+ def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
69
+ client ||= Spaceship::ConnectAPI
70
+ resps = client.get_profiles(filter: filter, includes: includes).all_pages
70
71
  return resps.flat_map(&:to_models)
71
72
  end
72
73
 
73
- def self.create(name: nil, profile_type: nil, bundle_id_id: nil, certificate_ids: nil, device_ids: nil, template_name: nil)
74
- resp = Spaceship::ConnectAPI.post_profiles(
74
+ def self.create(client: nil, name: nil, profile_type: nil, bundle_id_id: nil, certificate_ids: nil, device_ids: nil, template_name: nil)
75
+ client ||= Spaceship::ConnectAPI
76
+ resp = client.post_profiles(
75
77
  bundle_id_id: bundle_id_id,
76
78
  certificates: certificate_ids,
77
79
  devices: device_ids,
@@ -84,13 +86,15 @@ module Spaceship
84
86
  return resp.to_models.first
85
87
  end
86
88
 
87
- def fetch_all_devices(filter: {}, includes: nil, sort: nil)
88
- resps = Spaceship::ConnectAPI.get_devices(profile_id: id, filter: filter, includes: includes).all_pages
89
+ def fetch_all_devices(client: nil, filter: {}, includes: nil, sort: nil)
90
+ client ||= Spaceship::ConnectAPI
91
+ resps = client.get_devices(profile_id: id, filter: filter, includes: includes).all_pages
89
92
  return resps.flat_map(&:to_models)
90
93
  end
91
94
 
92
- def delete!
93
- return Spaceship::ConnectAPI.delete_profile(profile_id: id)
95
+ def delete!(client: nil)
96
+ client ||= Spaceship::ConnectAPI
97
+ return client.delete_profile(profile_id: id)
94
98
  end
95
99
  end
96
100
  end
@@ -18,8 +18,9 @@ module Spaceship
18
18
  # API
19
19
  #
20
20
 
21
- def delete!(filter: {}, includes: nil, limit: nil, sort: nil)
22
- Spaceship::ConnectAPI.delete_reset_ratings_request(reset_ratings_request_id: id)
21
+ def delete!(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
22
+ client ||= Spaceship::ConnectAPI
23
+ client.delete_reset_ratings_request(reset_ratings_request_id: id)
23
24
  end
24
25
  end
25
26
  end
@@ -36,12 +36,14 @@ module Spaceship
36
36
  # API
37
37
  #
38
38
 
39
- def self.all(filter: {}, includes: nil, limit: 2000, sort: nil)
40
- resps = Spaceship::ConnectAPI.get_sandbox_testers(filter: filter, includes: includes).all_pages
39
+ def self.all(client: nil, filter: {}, includes: nil, limit: 2000, sort: nil)
40
+ client ||= Spaceship::ConnectAPI
41
+ resps = client.get_sandbox_testers(filter: filter, includes: includes).all_pages
41
42
  return resps.flat_map(&:to_models)
42
43
  end
43
44
 
44
- def self.create(first_name: nil, last_name: nil, email: nil, password: nil, confirm_password: nil, secret_question: nil, secret_answer: nil, birth_date: nil, app_store_territory: nil)
45
+ def self.create(client: nil, first_name: nil, last_name: nil, email: nil, password: nil, confirm_password: nil, secret_question: nil, secret_answer: nil, birth_date: nil, app_store_territory: nil)
46
+ client ||= Spaceship::ConnectAPI
45
47
  attributes = {
46
48
  firstName: first_name,
47
49
  lastName: last_name,
@@ -53,11 +55,12 @@ module Spaceship
53
55
  birthDate: birth_date,
54
56
  appStoreTerritory: app_store_territory
55
57
  }
56
- return Spaceship::ConnectAPI.post_sandbox_tester(attributes: attributes).first
58
+ return client.post_sandbox_tester(attributes: attributes).first
57
59
  end
58
60
 
59
- def delete!
60
- Spaceship::ConnectAPI.delete_sandbox_tester(sandbox_tester_id: id)
61
+ def delete!(client: nil)
62
+ client ||= Spaceship::ConnectAPI
63
+ client.delete_sandbox_tester(sandbox_tester_id: id)
61
64
  end
62
65
  end
63
66
  end
@@ -18,8 +18,9 @@ module Spaceship
18
18
  # API
19
19
  #
20
20
 
21
- def self.all(filter: {}, includes: nil, limit: 180, sort: nil)
22
- resps = Spaceship::ConnectAPI.get_territories(filter: {}, includes: nil, limit: nil, sort: nil).all_pages
21
+ def self.all(client: nil, filter: {}, includes: nil, limit: 180, sort: nil)
22
+ client ||= Spaceship::ConnectAPI
23
+ resps = client.get_territories(filter: {}, includes: nil, limit: nil, sort: nil).all_pages
23
24
  return resps.flat_map(&:to_models)
24
25
  end
25
26
  end
@@ -38,13 +38,15 @@ module Spaceship
38
38
  # API
39
39
  #
40
40
 
41
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
42
- resps = Spaceship::ConnectAPI.get_users(filter: filter, includes: includes).all_pages
41
+ def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
42
+ client ||= Spaceship::ConnectAPI
43
+ resps = client.get_users(filter: filter, includes: includes).all_pages
43
44
  return resps.flat_map(&:to_models)
44
45
  end
45
46
 
46
- def self.find(email: nil, includes: nil)
47
- return all(filter: { email: email }, includes: includes)
47
+ def self.find(client: nil, email: nil, includes: nil)
48
+ client ||= Spaceship::ConnectAPI
49
+ return all(client: client, filter: { email: email }, includes: includes)
48
50
  end
49
51
  end
50
52
  end
@@ -42,17 +42,20 @@ module Spaceship
42
42
  # Managing invitations
43
43
  #
44
44
 
45
- def self.all(filter: {}, includes: nil, sort: nil)
46
- resps = Spaceship::ConnectAPI.get_user_invitations(filter: filter, includes: includes, sort: sort).all_pages
45
+ def self.all(client: nil, filter: {}, includes: nil, sort: nil)
46
+ client ||= Spaceship::ConnectAPI
47
+ resps = client.get_user_invitations(filter: filter, includes: includes, sort: sort).all_pages
47
48
  return resps.flat_map(&:to_models)
48
49
  end
49
50
 
50
- def self.find(email: nil, includes: nil)
51
- return all(filter: { email: email }, includes: includes)
51
+ def self.find(client: nil, email: nil, includes: nil)
52
+ client ||= Spaceship::ConnectAPI
53
+ return all(client: client, filter: { email: email }, includes: includes)
52
54
  end
53
55
 
54
- def delete!
55
- Spaceship::ConnectAPI.delete_user_invitation(user_invitation_id: id)
56
+ def delete!(client: nil)
57
+ client ||= Spaceship::ConnectAPI
58
+ client.delete_user_invitation(user_invitation_id: id)
56
59
  end
57
60
  end
58
61
  end
@@ -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
 
@@ -214,6 +214,18 @@ module Spaceship
214
214
  test_flight_request_client.post("betaGroups", body)
215
215
  end
216
216
 
217
+ def patch_group(group_id: nil, attributes: {})
218
+ body = {
219
+ data: {
220
+ attributes: attributes,
221
+ id: group_id,
222
+ type: "betaGroups"
223
+ }
224
+ }
225
+
226
+ test_flight_request_client.patch("betaGroups/#{group_id}", body)
227
+ end
228
+
217
229
  def delete_beta_group(group_id: nil)
218
230
  raise "group_id is nil" if group_id.nil?
219
231
 
@@ -200,6 +200,109 @@ module Spaceship
200
200
  tunes_request_client.patch("apps/#{app_id}", body)
201
201
  end
202
202
 
203
+ #
204
+ # appDataUsage
205
+ #
206
+
207
+ def get_app_data_usages(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
208
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
209
+ tunes_request_client.get("apps/#{app_id}/dataUsages", params)
210
+ end
211
+
212
+ def post_app_data_usage(app_id:, app_data_usage_category_id: nil, app_data_usage_protection_id: nil, app_data_usage_purpose_id: nil)
213
+ raise "app_id is required " if app_id.nil?
214
+
215
+ relationships = {
216
+ app: {
217
+ data: {
218
+ type: "apps",
219
+ id: app_id
220
+ }
221
+ }
222
+ }
223
+
224
+ if app_data_usage_category_id
225
+ relationships[:category] = {
226
+ data: {
227
+ type: "appDataUsageCategories",
228
+ id: app_data_usage_category_id
229
+ }
230
+ }
231
+ end
232
+
233
+ if app_data_usage_protection_id
234
+ relationships[:dataProtection] = {
235
+ data: {
236
+ type: "appDataUsageDataProtections",
237
+ id: app_data_usage_protection_id
238
+ }
239
+ }
240
+ end
241
+
242
+ if app_data_usage_purpose_id
243
+ relationships[:purpose] = {
244
+ data: {
245
+ type: "appDataUsagePurposes",
246
+ id: app_data_usage_purpose_id
247
+ }
248
+ }
249
+ end
250
+
251
+ body = {
252
+ data: {
253
+ type: "appDataUsages",
254
+ relationships: relationships
255
+ }
256
+ }
257
+
258
+ tunes_request_client.post("appDataUsages", body)
259
+ end
260
+
261
+ def delete_app_data_usage(app_data_usage_id: nil)
262
+ tunes_request_client.delete("appDataUsages/#{app_data_usage_id}")
263
+ end
264
+
265
+ #
266
+ # appDataUsageCategory
267
+ #
268
+
269
+ def get_app_data_usage_categories(filter: {}, includes: nil, limit: nil, sort: nil)
270
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
271
+ tunes_request_client.get("appDataUsageCategories", params)
272
+ end
273
+
274
+ #
275
+ # appDataUsagePurpose
276
+ #
277
+
278
+ def get_app_data_usage_purposes(filter: {}, includes: nil, limit: nil, sort: nil)
279
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
280
+ tunes_request_client.get("appDataUsagePurposes", params)
281
+ end
282
+
283
+ #
284
+ # appDataUsagesPublishState
285
+ #
286
+
287
+ def get_app_data_usages_publish_state(app_id: nil)
288
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
289
+ tunes_request_client.get("apps/#{app_id}/dataUsagePublishState", params)
290
+ end
291
+
292
+ def patch_app_data_usages_publish_state(app_data_usages_publish_state_id: nil, published: nil)
293
+ body = {
294
+ data: {
295
+ type: "appDataUsagesPublishState",
296
+ id: app_data_usages_publish_state_id,
297
+ attributes: {
298
+ published: published
299
+ }
300
+ }
301
+ }
302
+
303
+ tunes_request_client.patch("appDataUsagesPublishState/#{app_data_usages_publish_state_id}", body)
304
+ end
305
+
203
306
  #
204
307
  # appPreview
205
308
  #