fastlane 2.155.1 → 2.157.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +72 -72
  3. data/deliver/lib/deliver.rb +1 -0
  4. data/deliver/lib/deliver/app_screenshot_iterator.rb +95 -0
  5. data/deliver/lib/deliver/detect_values.rb +4 -1
  6. data/deliver/lib/deliver/languages.rb +7 -0
  7. data/deliver/lib/deliver/loader.rb +4 -5
  8. data/deliver/lib/deliver/queue_worker.rb +64 -0
  9. data/deliver/lib/deliver/runner.rb +7 -5
  10. data/deliver/lib/deliver/upload_screenshots.rb +143 -128
  11. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +120 -0
  12. data/fastlane/lib/fastlane/actions/commit_version_bump.rb +1 -1
  13. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +2 -0
  14. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +17 -1
  15. data/fastlane/lib/fastlane/actions/set_changelog.rb +2 -2
  16. data/fastlane/lib/fastlane/actions/sonar.rb +5 -0
  17. data/fastlane/lib/fastlane/actions/spaceship_stats.rb +73 -0
  18. data/fastlane/lib/fastlane/actions/upload_to_testflight.rb +4 -0
  19. data/fastlane/lib/fastlane/version.rb +1 -1
  20. data/fastlane/swift/Deliverfile.swift +1 -1
  21. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  22. data/fastlane/swift/Fastlane.swift +68 -8
  23. data/fastlane/swift/Gymfile.swift +1 -1
  24. data/fastlane/swift/GymfileProtocol.swift +1 -1
  25. data/fastlane/swift/Matchfile.swift +1 -1
  26. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  27. data/fastlane/swift/Precheckfile.swift +1 -1
  28. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  29. data/fastlane/swift/Scanfile.swift +1 -1
  30. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  31. data/fastlane/swift/Screengrabfile.swift +1 -1
  32. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  33. data/fastlane/swift/Snapshotfile.swift +1 -1
  34. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  35. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +71 -42
  36. data/fastlane_core/lib/fastlane_core/project.rb +1 -0
  37. data/gym/lib/gym/error_handler.rb +1 -1
  38. data/gym/lib/gym/generators/build_command_generator.rb +0 -1
  39. data/pilot/lib/pilot/build_manager.rb +18 -4
  40. data/pilot/lib/pilot/manager.rb +15 -5
  41. data/pilot/lib/pilot/options.rb +16 -0
  42. data/produce/lib/produce/itunes_connect.rb +2 -2
  43. data/scan/lib/scan/test_command_generator.rb +3 -1
  44. data/screengrab/lib/screengrab/runner.rb +8 -7
  45. data/sigh/lib/sigh/runner.rb +9 -5
  46. data/snapshot/lib/snapshot/test_command_generator_base.rb +3 -1
  47. data/spaceship/lib/spaceship.rb +4 -0
  48. data/spaceship/lib/spaceship/client.rb +2 -0
  49. data/spaceship/lib/spaceship/connect_api.rb +0 -15
  50. data/spaceship/lib/spaceship/connect_api/api_client.rb +270 -0
  51. data/spaceship/lib/spaceship/connect_api/client.rb +139 -213
  52. data/spaceship/lib/spaceship/connect_api/models/profile.rb +3 -2
  53. data/spaceship/lib/spaceship/connect_api/provisioning/client.rb +8 -17
  54. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +75 -64
  55. data/spaceship/lib/spaceship/connect_api/spaceship.rb +94 -0
  56. data/spaceship/lib/spaceship/connect_api/testflight/client.rb +8 -17
  57. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +288 -277
  58. data/spaceship/lib/spaceship/connect_api/token.rb +46 -5
  59. data/spaceship/lib/spaceship/connect_api/token_refresh_middleware.rb +24 -0
  60. data/spaceship/lib/spaceship/connect_api/tunes/client.rb +8 -17
  61. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +717 -706
  62. data/spaceship/lib/spaceship/connect_api/users/client.rb +8 -17
  63. data/spaceship/lib/spaceship/connect_api/users/users.rb +28 -17
  64. data/spaceship/lib/spaceship/stats_middleware.rb +65 -0
  65. metadata +25 -18
  66. data/sigh/lib/sigh/.runner.rb.swp +0 -0
  67. data/spaceship/lib/spaceship/connect_api/models/.device.rb.swp +0 -0
@@ -0,0 +1,94 @@
1
+ require_relative './client'
2
+
3
+ require_relative './testflight/testflight'
4
+
5
+ module Spaceship
6
+ class ConnectAPI
7
+ class << self
8
+ # This client stores the global client when using the lazy syntax
9
+ attr_accessor :client
10
+
11
+ # Forward class calls to the global client
12
+ # This is implemented for backwards compatibility
13
+ extend(Forwardable)
14
+ def_delegators(:client, *Spaceship::ConnectAPI::Provisioning::API.instance_methods(false))
15
+ def_delegators(:client, *Spaceship::ConnectAPI::TestFlight::API.instance_methods(false))
16
+ def_delegators(:client, *Spaceship::ConnectAPI::Tunes::API.instance_methods(false))
17
+ def_delegators(:client, *Spaceship::ConnectAPI::Users::API.instance_methods(false))
18
+
19
+ def client
20
+ # Always look for a client set explicitly by the client first
21
+ return @client if @client
22
+
23
+ # A client may not always be explicitly set (specially when running tools like match, sigh, pilot, etc)
24
+ # In that case, create a new client based on existing sessions
25
+ # Note: This does not perform logins on the user. It is only reusing the cookies and selected teams
26
+ return nil if Spaceship::Tunes.client.nil? && Spaceship::Portal.client.nil?
27
+
28
+ implicit_client = ConnectAPI::Client.new(tunes_client: Spaceship::Tunes.client, portal_client: Spaceship::Portal.client)
29
+ return implicit_client
30
+ end
31
+
32
+ def token=(token)
33
+ @client = ConnectAPI::Client.new(token: token)
34
+ end
35
+
36
+ def token
37
+ return nil if @client.nil?
38
+ return @client.token
39
+ end
40
+
41
+ def token?
42
+ (@client && @client.token)
43
+ end
44
+
45
+ # Initializes client with Apple's App Store Connect JWT auth key.
46
+ #
47
+ # This method will automatically use the key id, issuer id, and filepath from environment
48
+ # variables if not given.
49
+ #
50
+ # All three parameters are needed to authenticate.
51
+ #
52
+ # @param key_id (String) (optional): The key id
53
+ # @param issuer_id (String) (optional): The issuer id
54
+ # @param filepath (String) (optional): The filepath
55
+ #
56
+ # @raise InvalidUserCredentialsError: raised if authentication failed
57
+ #
58
+ # @return (Spaceship::ConnectAPI::Client) The client the login method was called for
59
+ def auth(key_id: nil, issuer_id: nil, filepath: nil)
60
+ @client = ConnectAPI::Client.auth(key_id: key_id, issuer_id: issuer_id, filepath: filepath)
61
+ end
62
+
63
+ # Authenticates with Apple's web services. This method has to be called once
64
+ # to generate a valid session.
65
+ #
66
+ # This method will automatically use the username from the Appfile (if available)
67
+ # and fetch the password from the Keychain (if available)
68
+ #
69
+ # @param user (String) (optional): The username (usually the email address)
70
+ # @param password (String) (optional): The password
71
+ # @param team_id (String) (optional): The team id
72
+ # @param team_name (String) (optional): The team name
73
+ #
74
+ # @raise InvalidUserCredentialsError: raised if authentication failed
75
+ #
76
+ # @return (Spaceship::ConnectAPI::Client) The client the login method was called for
77
+ def login(user = nil, password = nil, team_id: nil, team_name: nil)
78
+ @client = ConnectAPI::Client.login(user, password, team_id: team_id, team_name: team_name)
79
+ end
80
+
81
+ # Open up the team selection for the user (if necessary).
82
+ #
83
+ # If the user is in multiple teams, a team selection is shown.
84
+ # The user can then select a team by entering the number
85
+ #
86
+ # @param team_id (String) (optional): The ID of an App Store Connect team
87
+ # @param team_name (String) (optional): The name of an App Store Connect team
88
+ def select_team(team_id: nil, team_name: nil)
89
+ return if client.nil?
90
+ client.select_team(team_id: team_id, team_name: team_name)
91
+ end
92
+ end
93
+ end
94
+ end
@@ -1,27 +1,18 @@
1
- require_relative '../client'
1
+ require_relative '../api_client'
2
+ require_relative './testflight'
2
3
  require_relative '../../tunes/tunes_client'
3
4
 
4
5
  module Spaceship
5
6
  class ConnectAPI
6
7
  module TestFlight
7
- class Client < Spaceship::ConnectAPI::Client
8
- def self.instance
9
- # Verify there is a token or a client that can be used
10
- if Spaceship::ConnectAPI.token
11
- if @client.nil? || @client.token != Spaceship::ConnectAPI.token
12
- @client = Client.new(token: Spaceship::ConnectAPI.token)
13
- end
14
- elsif Spaceship::Tunes.client
15
- # Initialize new client if new or if team changed
16
- if @client.nil? || @client.team_id != Spaceship::Tunes.client.team_id
17
- @client = Client.client_with_authorization_from(Spaceship::Tunes.client)
18
- end
19
- end
8
+ class Client < Spaceship::ConnectAPI::APIClient
9
+ def initialize(cookie: nil, current_team_id: nil, token: nil, another_client: nil)
10
+ another_client ||= Spaceship::Tunes.client if cookie.nil? && token.nil?
20
11
 
21
- # Need to handle not having a client but this shouldn't ever happen
22
- raise "Please login using `Spaceship::Tunes.login('user', 'password')`" unless @client
12
+ super(cookie: cookie, current_team_id: current_team_id, token: token, another_client: another_client)
23
13
 
24
- @client
14
+ self.extend(Spaceship::ConnectAPI::TestFlight::API)
15
+ self.test_flight_request_client = self
25
16
  end
26
17
 
27
18
  def self.hostname
@@ -3,364 +3,375 @@ require 'spaceship/connect_api/testflight/client'
3
3
  module Spaceship
4
4
  class ConnectAPI
5
5
  module TestFlight
6
- #
7
- # apps
8
- #
6
+ module API
7
+ def test_flight_request_client=(test_flight_request_client)
8
+ @test_flight_request_client = test_flight_request_client
9
+ end
9
10
 
10
- def get_apps(filter: {}, includes: nil, limit: nil, sort: nil)
11
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
12
- Client.instance.get("apps", params)
13
- end
11
+ def test_flight_request_client
12
+ return @test_flight_request_client if @test_flight_request_client
13
+ raise TypeError, "You need to instantiate this module with test_flight_request_client"
14
+ end
14
15
 
15
- def get_app(app_id: nil, includes: nil)
16
- params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil)
17
- Client.instance.get("apps/#{app_id}", params)
18
- end
16
+ #
17
+ # apps
18
+ #
19
19
 
20
- #
21
- # betaAppLocalizations
22
- #
20
+ def get_apps(filter: {}, includes: nil, limit: nil, sort: nil)
21
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
22
+ @test_flight_request_client.get("apps", params)
23
+ end
23
24
 
24
- def get_beta_app_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
25
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
26
- Client.instance.get("betaAppLocalizations", params)
27
- end
25
+ def get_app(app_id: nil, includes: nil)
26
+ params = @test_flight_request_client.build_params(filter: nil, includes: includes, limit: nil, sort: nil)
27
+ @test_flight_request_client.get("apps/#{app_id}", params)
28
+ end
29
+
30
+ #
31
+ # betaAppLocalizations
32
+ #
28
33
 
29
- def post_beta_app_localizations(app_id: nil, attributes: {})
30
- body = {
31
- data: {
32
- attributes: attributes,
33
- type: "betaAppLocalizations",
34
- relationships: {
35
- app: {
36
- data: {
37
- type: "apps",
38
- id: app_id
34
+ def get_beta_app_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
35
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
36
+ @test_flight_request_client.get("betaAppLocalizations", params)
37
+ end
38
+
39
+ def post_beta_app_localizations(app_id: nil, attributes: {})
40
+ body = {
41
+ data: {
42
+ attributes: attributes,
43
+ type: "betaAppLocalizations",
44
+ relationships: {
45
+ app: {
46
+ data: {
47
+ type: "apps",
48
+ id: app_id
49
+ }
39
50
  }
40
51
  }
41
52
  }
42
53
  }
43
- }
44
54
 
45
- Client.instance.post("betaAppLocalizations", body)
46
- end
55
+ @test_flight_request_client.post("betaAppLocalizations", body)
56
+ end
47
57
 
48
- def patch_beta_app_localizations(localization_id: nil, attributes: {})
49
- body = {
50
- data: {
51
- attributes: attributes,
52
- id: localization_id,
53
- type: "betaAppLocalizations"
58
+ def patch_beta_app_localizations(localization_id: nil, attributes: {})
59
+ body = {
60
+ data: {
61
+ attributes: attributes,
62
+ id: localization_id,
63
+ type: "betaAppLocalizations"
64
+ }
54
65
  }
55
- }
56
66
 
57
- Client.instance.patch("betaAppLocalizations/#{localization_id}", body)
58
- end
67
+ @test_flight_request_client.patch("betaAppLocalizations/#{localization_id}", body)
68
+ end
59
69
 
60
- #
61
- # betaAppReviewDetails
62
- #
70
+ #
71
+ # betaAppReviewDetails
72
+ #
63
73
 
64
- def get_beta_app_review_detail(filter: {}, includes: nil, limit: nil, sort: nil)
65
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
66
- Client.instance.get("betaAppReviewDetails", params)
67
- end
74
+ def get_beta_app_review_detail(filter: {}, includes: nil, limit: nil, sort: nil)
75
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
76
+ @test_flight_request_client.get("betaAppReviewDetails", params)
77
+ end
68
78
 
69
- def patch_beta_app_review_detail(app_id: nil, attributes: {})
70
- body = {
71
- data: {
72
- attributes: attributes,
73
- id: app_id,
74
- type: "betaAppReviewDetails"
79
+ def patch_beta_app_review_detail(app_id: nil, attributes: {})
80
+ body = {
81
+ data: {
82
+ attributes: attributes,
83
+ id: app_id,
84
+ type: "betaAppReviewDetails"
85
+ }
75
86
  }
76
- }
77
87
 
78
- Client.instance.patch("betaAppReviewDetails/#{app_id}", body)
79
- end
88
+ @test_flight_request_client.patch("betaAppReviewDetails/#{app_id}", body)
89
+ end
80
90
 
81
- #
82
- # betaAppReviewSubmissions
83
- #
91
+ #
92
+ # betaAppReviewSubmissions
93
+ #
84
94
 
85
- def get_beta_app_review_submissions(filter: {}, includes: nil, limit: nil, sort: nil, cursor: nil)
86
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort, cursor: cursor)
87
- Client.instance.get("betaAppReviewSubmissions", params)
88
- end
95
+ def get_beta_app_review_submissions(filter: {}, includes: nil, limit: nil, sort: nil, cursor: nil)
96
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort, cursor: cursor)
97
+ @test_flight_request_client.get("betaAppReviewSubmissions", params)
98
+ end
89
99
 
90
- def post_beta_app_review_submissions(build_id: nil)
91
- body = {
92
- data: {
93
- type: "betaAppReviewSubmissions",
94
- relationships: {
95
- build: {
96
- data: {
97
- type: "builds",
98
- id: build_id
100
+ def post_beta_app_review_submissions(build_id: nil)
101
+ body = {
102
+ data: {
103
+ type: "betaAppReviewSubmissions",
104
+ relationships: {
105
+ build: {
106
+ data: {
107
+ type: "builds",
108
+ id: build_id
109
+ }
99
110
  }
100
111
  }
101
112
  }
102
113
  }
103
- }
104
114
 
105
- Client.instance.post("betaAppReviewSubmissions", body)
106
- end
115
+ @test_flight_request_client.post("betaAppReviewSubmissions", body)
116
+ end
107
117
 
108
- def delete_beta_app_review_submission(beta_app_review_submission_id: nil)
109
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil, cursor: nil)
110
- Client.instance.delete("betaAppReviewSubmissions/#{beta_app_review_submission_id}", params)
111
- end
118
+ def delete_beta_app_review_submission(beta_app_review_submission_id: nil)
119
+ params = @test_flight_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil, cursor: nil)
120
+ @test_flight_request_client.delete("betaAppReviewSubmissions/#{beta_app_review_submission_id}", params)
121
+ end
112
122
 
113
- #
114
- # betaBuildLocalizations
115
- #
123
+ #
124
+ # betaBuildLocalizations
125
+ #
116
126
 
117
- def get_beta_build_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
118
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
119
- Client.instance.get("betaBuildLocalizations", params)
120
- end
127
+ def get_beta_build_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
128
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
129
+ @test_flight_request_client.get("betaBuildLocalizations", params)
130
+ end
121
131
 
122
- def post_beta_build_localizations(build_id: nil, attributes: {})
123
- body = {
124
- data: {
125
- attributes: attributes,
126
- type: "betaBuildLocalizations",
127
- relationships: {
128
- build: {
129
- data: {
130
- type: "builds",
131
- id: build_id
132
+ def post_beta_build_localizations(build_id: nil, attributes: {})
133
+ body = {
134
+ data: {
135
+ attributes: attributes,
136
+ type: "betaBuildLocalizations",
137
+ relationships: {
138
+ build: {
139
+ data: {
140
+ type: "builds",
141
+ id: build_id
142
+ }
132
143
  }
133
144
  }
134
145
  }
135
146
  }
136
- }
137
147
 
138
- Client.instance.post("betaBuildLocalizations", body)
139
- end
148
+ @test_flight_request_client.post("betaBuildLocalizations", body)
149
+ end
140
150
 
141
- def patch_beta_build_localizations(localization_id: nil, feedbackEmail: nil, attributes: {})
142
- body = {
143
- data: {
144
- attributes: attributes,
145
- id: localization_id,
146
- type: "betaBuildLocalizations"
151
+ def patch_beta_build_localizations(localization_id: nil, feedbackEmail: nil, attributes: {})
152
+ body = {
153
+ data: {
154
+ attributes: attributes,
155
+ id: localization_id,
156
+ type: "betaBuildLocalizations"
157
+ }
147
158
  }
148
- }
149
159
 
150
- Client.instance.patch("betaBuildLocalizations/#{localization_id}", body)
151
- end
160
+ @test_flight_request_client.patch("betaBuildLocalizations/#{localization_id}", body)
161
+ end
152
162
 
153
- #
154
- # betaBuildMetrics
155
- #
163
+ #
164
+ # betaBuildMetrics
165
+ #
156
166
 
157
- def get_beta_build_metrics(filter: {}, includes: nil, limit: nil, sort: nil)
158
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
159
- Client.instance.get("betaBuildMetrics", params)
160
- end
167
+ def get_beta_build_metrics(filter: {}, includes: nil, limit: nil, sort: nil)
168
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
169
+ @test_flight_request_client.get("betaBuildMetrics", params)
170
+ end
161
171
 
162
- #
163
- # betaGroups
164
- #
172
+ #
173
+ # betaGroups
174
+ #
165
175
 
166
- def get_beta_groups(filter: {}, includes: nil, limit: nil, sort: nil)
167
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
168
- Client.instance.get("betaGroups", params)
169
- end
176
+ def get_beta_groups(filter: {}, includes: nil, limit: nil, sort: nil)
177
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
178
+ @test_flight_request_client.get("betaGroups", params)
179
+ end
170
180
 
171
- def add_beta_groups_to_build(build_id: nil, beta_group_ids: [])
172
- body = {
173
- data: beta_group_ids.map do |id|
174
- {
175
- type: "betaGroups",
176
- id: id
177
- }
178
- end
179
- }
181
+ def add_beta_groups_to_build(build_id: nil, beta_group_ids: [])
182
+ body = {
183
+ data: beta_group_ids.map do |id|
184
+ {
185
+ type: "betaGroups",
186
+ id: id
187
+ }
188
+ end
189
+ }
180
190
 
181
- Client.instance.post("builds/#{build_id}/relationships/betaGroups", body)
182
- end
191
+ @test_flight_request_client.post("builds/#{build_id}/relationships/betaGroups", body)
192
+ end
183
193
 
184
- def create_beta_group(app_id: nil, group_name: nil, public_link_enabled: false, public_link_limit: 10_000, public_link_limit_enabled: false)
185
- body = {
186
- data: {
187
- attributes: {
188
- name: group_name,
189
- publicLinkEnabled: public_link_enabled,
190
- publicLinkLimit: public_link_limit,
191
- publicLinkLimitEnabled: public_link_limit_enabled
192
- },
193
- relationships: {
194
- app: {
195
- data: {
196
- id: app_id,
197
- type: "apps"
194
+ def create_beta_group(app_id: nil, group_name: nil, public_link_enabled: false, public_link_limit: 10_000, public_link_limit_enabled: false)
195
+ body = {
196
+ data: {
197
+ attributes: {
198
+ name: group_name,
199
+ publicLinkEnabled: public_link_enabled,
200
+ publicLinkLimit: public_link_limit,
201
+ publicLinkLimitEnabled: public_link_limit_enabled
202
+ },
203
+ relationships: {
204
+ app: {
205
+ data: {
206
+ id: app_id,
207
+ type: "apps"
208
+ }
198
209
  }
199
- }
200
- },
201
- type: "betaGroups"
210
+ },
211
+ type: "betaGroups"
212
+ }
202
213
  }
203
- }
204
- Client.instance.post("betaGroups", body)
205
- end
214
+ @test_flight_request_client.post("betaGroups", body)
215
+ end
206
216
 
207
- #
208
- # betaTesters
209
- #
217
+ #
218
+ # betaTesters
219
+ #
210
220
 
211
- def get_beta_testers(filter: {}, includes: nil, limit: nil, sort: nil)
212
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
213
- Client.instance.get("betaTesters", params)
214
- end
221
+ def get_beta_testers(filter: {}, includes: nil, limit: nil, sort: nil)
222
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
223
+ @test_flight_request_client.get("betaTesters", params)
224
+ end
215
225
 
216
- # beta_testers - [{email: "", firstName: "", lastName: ""}]
217
- def post_bulk_beta_tester_assignments(beta_group_id: nil, beta_testers: nil)
218
- beta_testers || []
226
+ # beta_testers - [{email: "", firstName: "", lastName: ""}]
227
+ def post_bulk_beta_tester_assignments(beta_group_id: nil, beta_testers: nil)
228
+ beta_testers || []
219
229
 
220
- beta_testers.map do |tester|
221
- tester[:errors] = []
222
- end
230
+ beta_testers.map do |tester|
231
+ tester[:errors] = []
232
+ end
223
233
 
224
- body = {
225
- data: {
226
- attributes: {
227
- betaTesters: beta_testers
228
- },
229
- relationships: {
230
- betaGroup: {
231
- data: {
232
- type: "betaGroups",
233
- id: beta_group_id
234
+ body = {
235
+ data: {
236
+ attributes: {
237
+ betaTesters: beta_testers
238
+ },
239
+ relationships: {
240
+ betaGroup: {
241
+ data: {
242
+ type: "betaGroups",
243
+ id: beta_group_id
244
+ }
234
245
  }
235
- }
236
- },
237
- type: "bulkBetaTesterAssignments"
246
+ },
247
+ type: "bulkBetaTesterAssignments"
248
+ }
238
249
  }
239
- }
240
250
 
241
- Client.instance.post("bulkBetaTesterAssignments", body)
242
- end
251
+ @test_flight_request_client.post("bulkBetaTesterAssignments", body)
252
+ end
243
253
 
244
- def delete_beta_tester_from_apps(beta_tester_id: nil, app_ids: [])
245
- body = {
246
- data: app_ids.map do |id|
247
- {
248
- type: "apps",
249
- id: id
250
- }
251
- end
252
- }
254
+ def delete_beta_tester_from_apps(beta_tester_id: nil, app_ids: [])
255
+ body = {
256
+ data: app_ids.map do |id|
257
+ {
258
+ type: "apps",
259
+ id: id
260
+ }
261
+ end
262
+ }
253
263
 
254
- Client.instance.delete("betaTesters/#{beta_tester_id}/relationships/apps", nil, body)
255
- end
264
+ @test_flight_request_client.delete("betaTesters/#{beta_tester_id}/relationships/apps", nil, body)
265
+ end
256
266
 
257
- def delete_beta_tester_from_beta_groups(beta_tester_id: nil, beta_group_ids: [])
258
- body = {
259
- data: beta_group_ids.map do |id|
260
- {
261
- type: "betaGroups",
262
- id: id
263
- }
264
- end
265
- }
267
+ def delete_beta_tester_from_beta_groups(beta_tester_id: nil, beta_group_ids: [])
268
+ body = {
269
+ data: beta_group_ids.map do |id|
270
+ {
271
+ type: "betaGroups",
272
+ id: id
273
+ }
274
+ end
275
+ }
266
276
 
267
- Client.instance.delete("betaTesters/#{beta_tester_id}/relationships/betaGroups", nil, body)
268
- end
277
+ @test_flight_request_client.delete("betaTesters/#{beta_tester_id}/relationships/betaGroups", nil, body)
278
+ end
269
279
 
270
- #
271
- # betaTesterMetrics
272
- #
280
+ #
281
+ # betaTesterMetrics
282
+ #
273
283
 
274
- def get_beta_tester_metrics(filter: {}, includes: nil, limit: nil, sort: nil)
275
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
276
- Client.instance.get("betaTesterMetrics", params)
277
- end
284
+ def get_beta_tester_metrics(filter: {}, includes: nil, limit: nil, sort: nil)
285
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
286
+ @test_flight_request_client.get("betaTesterMetrics", params)
287
+ end
278
288
 
279
- #
280
- # builds
281
- #
289
+ #
290
+ # builds
291
+ #
282
292
 
283
- def get_builds(filter: {}, includes: "buildBetaDetail,betaBuildMetrics", limit: 10, sort: "uploadedDate", cursor: nil)
284
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort, cursor: cursor)
285
- Client.instance.get("builds", params)
286
- end
293
+ def get_builds(filter: {}, includes: "buildBetaDetail,betaBuildMetrics", limit: 10, sort: "uploadedDate", cursor: nil)
294
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort, cursor: cursor)
295
+ @test_flight_request_client.get("builds", params)
296
+ end
287
297
 
288
- def get_build(build_id: nil, app_store_version_id: nil, includes: nil)
289
- if build_id
290
- params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)
291
- return Client.instance.get("builds/#{build_id}", params)
292
- elsif app_store_version_id
293
- params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)
294
- return Client.instance.get("appStoreVersions/#{app_store_version_id}/build", params)
295
- else
296
- return nil
298
+ def get_build(build_id: nil, app_store_version_id: nil, includes: nil)
299
+ if build_id
300
+ params = @test_flight_request_client.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)
301
+ return @test_flight_request_client.get("builds/#{build_id}", params)
302
+ elsif app_store_version_id
303
+ params = @test_flight_request_client.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)
304
+ return @test_flight_request_client.get("appStoreVersions/#{app_store_version_id}/build", params)
305
+ else
306
+ return nil
307
+ end
297
308
  end
298
- end
299
309
 
300
- def patch_builds(build_id: nil, attributes: {})
301
- body = {
302
- data: {
303
- attributes: attributes,
304
- id: build_id,
305
- type: "builds"
310
+ def patch_builds(build_id: nil, attributes: {})
311
+ body = {
312
+ data: {
313
+ attributes: attributes,
314
+ id: build_id,
315
+ type: "builds"
316
+ }
306
317
  }
307
- }
308
318
 
309
- Client.instance.patch("builds/#{build_id}", body)
310
- end
319
+ @test_flight_request_client.patch("builds/#{build_id}", body)
320
+ end
311
321
 
312
- #
313
- # buildBetaDetails
314
- #
322
+ #
323
+ # buildBetaDetails
324
+ #
315
325
 
316
- def get_build_beta_details(filter: {}, includes: nil, limit: nil, sort: nil)
317
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
318
- Client.instance.get("buildBetaDetails", params)
319
- end
326
+ def get_build_beta_details(filter: {}, includes: nil, limit: nil, sort: nil)
327
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
328
+ @test_flight_request_client.get("buildBetaDetails", params)
329
+ end
320
330
 
321
- def patch_build_beta_details(build_beta_details_id: nil, attributes: {})
322
- body = {
323
- data: {
324
- attributes: attributes,
325
- id: build_beta_details_id,
326
- type: "buildBetaDetails"
331
+ def patch_build_beta_details(build_beta_details_id: nil, attributes: {})
332
+ body = {
333
+ data: {
334
+ attributes: attributes,
335
+ id: build_beta_details_id,
336
+ type: "buildBetaDetails"
337
+ }
327
338
  }
328
- }
329
339
 
330
- Client.instance.patch("buildBetaDetails/#{build_beta_details_id}", body)
331
- end
340
+ @test_flight_request_client.patch("buildBetaDetails/#{build_beta_details_id}", body)
341
+ end
332
342
 
333
- #
334
- # buildDeliveries
335
- #
343
+ #
344
+ # buildDeliveries
345
+ #
336
346
 
337
- def get_build_deliveries(filter: {}, includes: nil, limit: nil, sort: nil)
338
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
339
- Client.instance.get("buildDeliveries", params)
340
- end
347
+ def get_build_deliveries(filter: {}, includes: nil, limit: nil, sort: nil)
348
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
349
+ @test_flight_request_client.get("buildDeliveries", params)
350
+ end
341
351
 
342
- #
343
- # preReleaseVersions
344
- #
352
+ #
353
+ # preReleaseVersions
354
+ #
345
355
 
346
- def get_pre_release_versions(filter: {}, includes: nil, limit: nil, sort: nil)
347
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
348
- Client.instance.get("preReleaseVersions", params)
349
- end
356
+ def get_pre_release_versions(filter: {}, includes: nil, limit: nil, sort: nil)
357
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
358
+ @test_flight_request_client.get("preReleaseVersions", params)
359
+ end
350
360
 
351
- #
352
- # betaFeedbacks (private API as of end 2019)
353
- #
361
+ #
362
+ # betaFeedbacks (private API as of end 2019)
363
+ #
354
364
 
355
- def get_beta_feedback(filter: {}, includes: nil, limit: nil, sort: nil)
356
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
357
- Client.instance.get("betaFeedbacks", params)
358
- end
365
+ def get_beta_feedback(filter: {}, includes: nil, limit: nil, sort: nil)
366
+ params = @test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
367
+ @test_flight_request_client.get("betaFeedbacks", params)
368
+ end
359
369
 
360
- def delete_beta_feedback(feedback_id: nil)
361
- raise "Feedback id is nil" if feedback_id.nil?
370
+ def delete_beta_feedback(feedback_id: nil)
371
+ raise "Feedback id is nil" if feedback_id.nil?
362
372
 
363
- Client.instance.delete("betaFeedbacks/#{feedback_id}")
373
+ @test_flight_request_client.delete("betaFeedbacks/#{feedback_id}")
374
+ end
364
375
  end
365
376
  end
366
377
  end