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
@@ -16,24 +16,65 @@ module Spaceship
16
16
  attr_reader :key_id
17
17
  attr_reader :issuer_id
18
18
  attr_reader :text
19
+ attr_reader :duration
20
+ attr_reader :expiration
19
21
 
20
- def self.create(key_id: nil, issuer_id: nil, filepath: nil)
22
+ # Temporary attribute not needed to create the JWT text
23
+ # There is no way to determine if the team associated with this
24
+ # key is for App Store or Enterprise so this is the temporary workaround
25
+ attr_accessor :in_house
26
+
27
+ def self.from_json_file(filepath)
28
+ json = JSON.parse(File.read(filepath), { symbolize_names: true })
29
+
30
+ missing_keys = []
31
+ missing_keys << 'key_id' unless json.key?(:key_id)
32
+ missing_keys << 'issuer_id' unless json.key?(:issuer_id)
33
+ missing_keys << 'key' unless json.key?(:key)
34
+
35
+ unless missing_keys.empty?
36
+ raise "App Store Connect API key JSON is missing field(s): #{missing_keys.join(', ')}"
37
+ end
38
+
39
+ self.create(json)
40
+ end
41
+
42
+ def self.create(key_id: nil, issuer_id: nil, filepath: nil, key: nil, duration: nil, in_house: nil)
21
43
  key_id ||= ENV['SPACESHIP_CONNECT_API_KEY_ID']
22
44
  issuer_id ||= ENV['SPACESHIP_CONNECT_API_ISSUER_ID']
23
45
  filepath ||= ENV['SPACESHIP_CONNECT_API_KEY_FILEPATH']
46
+ duration ||= ENV['SPACESHIP_CONNECT_API_TOKEN_DURATION']
47
+
48
+ in_house_env = ENV['SPACESHIP_CONNECT_API_IN_HOUSE']
49
+ in_house ||= !["", "no", "false", "off", "0"].include?(in_house_env) if in_house_env
50
+
51
+ key ||= ENV['SPACESHIP_CONNECT_API_KEY']
52
+ key ||= File.binread(filepath)
24
53
 
25
54
  self.new(
26
55
  key_id: key_id,
27
56
  issuer_id: issuer_id,
28
- key: OpenSSL::PKey::EC.new(File.read(filepath))
57
+ key: OpenSSL::PKey::EC.new(key),
58
+ duration: duration,
59
+ in_house: in_house
29
60
  )
30
61
  end
31
62
 
32
- def initialize(key_id: nil, issuer_id: nil, key: nil)
33
- @expiration = Time.now + MAX_TOKEN_DURATION
63
+ def initialize(key_id: nil, issuer_id: nil, key: nil, duration: nil, in_house: nil)
34
64
  @key_id = key_id
35
65
  @key = key
36
66
  @issuer_id = issuer_id
67
+ @duration = duration
68
+ @in_house = in_house
69
+
70
+ @duration ||= MAX_TOKEN_DURATION
71
+ @duration = @duration.to_i if @duration
72
+
73
+ refresh!
74
+ end
75
+
76
+ def refresh!
77
+ @expiration = Time.now + @duration
37
78
 
38
79
  header = {
39
80
  kid: key_id
@@ -45,7 +86,7 @@ module Spaceship
45
86
  aud: 'appstoreconnect-v1'
46
87
  }
47
88
 
48
- @text = JWT.encode(payload, key, 'ES256', header)
89
+ @text = JWT.encode(payload, @key, 'ES256', header)
49
90
  end
50
91
 
51
92
  def expired?
@@ -0,0 +1,24 @@
1
+ require 'faraday'
2
+
3
+ require_relative 'token'
4
+ require_relative '../globals'
5
+
6
+ module Spaceship
7
+ class TokenRefreshMiddleware < Faraday::Middleware
8
+ def initialize(app, token)
9
+ @token = token
10
+ super(app)
11
+ end
12
+
13
+ def call(env)
14
+ if @token.expired?
15
+ puts("App Store Connect API token expired at #{@token.expiration}... refreshing") if Spaceship::Globals.verbose?
16
+ @token.refresh!
17
+ end
18
+
19
+ env.request_headers["Authorization"] = "Bearer #{@token.text}"
20
+
21
+ @app.call(env)
22
+ end
23
+ end
24
+ end
@@ -1,27 +1,18 @@
1
- require_relative '../client'
1
+ require_relative '../api_client'
2
+ require_relative './tunes'
2
3
  require_relative '../../tunes/tunes_client'
3
4
 
4
5
  module Spaceship
5
6
  class ConnectAPI
6
7
  module Tunes
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::Tunes::API)
15
+ self.tunes_request_client = self
25
16
  end
26
17
 
27
18
  def self.hostname
@@ -3,932 +3,943 @@ require 'spaceship/connect_api/tunes/client'
3
3
  module Spaceship
4
4
  class ConnectAPI
5
5
  module Tunes
6
- #
7
- # ageRatingDeclarations
8
- #
6
+ module API
7
+ def tunes_request_client=(tunes_request_client)
8
+ @tunes_request_client = tunes_request_client
9
+ end
9
10
 
10
- def get_age_rating_declaration(app_store_version_id: nil)
11
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
12
- Client.instance.get("appStoreVersions/#{app_store_version_id}/ageRatingDeclaration", params)
13
- end
11
+ def tunes_request_client
12
+ return @tunes_request_client if @tunes_request_client
13
+ raise TypeError, "You need to instantiate this module with tunes_request_client"
14
+ end
14
15
 
15
- def patch_age_rating_declaration(age_rating_declaration_id: nil, attributes: nil)
16
- body = {
17
- data: {
18
- type: "ageRatingDeclarations",
19
- id: age_rating_declaration_id,
20
- attributes: attributes
21
- }
22
- }
16
+ #
17
+ # ageRatingDeclarations
18
+ #
23
19
 
24
- Client.instance.patch("ageRatingDeclarations/#{age_rating_declaration_id}", body)
25
- end
20
+ def get_age_rating_declaration(app_store_version_id: nil)
21
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
22
+ tunes_request_client.get("appStoreVersions/#{app_store_version_id}/ageRatingDeclaration", params)
23
+ end
26
24
 
27
- #
28
- # app
29
- #
30
-
31
- def post_app(name: nil, version_string: nil, sku: nil, primary_locale: nil, bundle_id: nil, platforms: nil, company_name: nil)
32
- included = []
33
- included << {
34
- type: "appInfos",
35
- id: "${new-appInfo-id}",
36
- relationships: {
37
- appInfoLocalizations: {
38
- data: [
39
- {
40
- type: "appInfoLocalizations",
41
- id: "${new-appInfoLocalization-id}"
42
- }
43
- ]
25
+ def patch_age_rating_declaration(age_rating_declaration_id: nil, attributes: nil)
26
+ body = {
27
+ data: {
28
+ type: "ageRatingDeclarations",
29
+ id: age_rating_declaration_id,
30
+ attributes: attributes
44
31
  }
45
32
  }
46
- }
47
- included << {
48
- type: "appInfoLocalizations",
49
- id: "${new-appInfoLocalization-id}",
50
- attributes: {
51
- locale: primary_locale,
52
- name: name
53
- }
54
- }
55
33
 
56
- platforms.each do |platform|
34
+ tunes_request_client.patch("ageRatingDeclarations/#{age_rating_declaration_id}", body)
35
+ end
36
+
37
+ #
38
+ # app
39
+ #
40
+
41
+ def post_app(name: nil, version_string: nil, sku: nil, primary_locale: nil, bundle_id: nil, platforms: nil, company_name: nil)
42
+ included = []
57
43
  included << {
58
- type: "appStoreVersions",
59
- id: "${store-version-#{platform}}",
60
- attributes: {
61
- platform: platform,
62
- versionString: version_string
63
- },
44
+ type: "appInfos",
45
+ id: "${new-appInfo-id}",
64
46
  relationships: {
65
- appStoreVersionLocalizations: {
47
+ appInfoLocalizations: {
66
48
  data: [
67
49
  {
68
- type: "appStoreVersionLocalizations",
69
- id: "${new-#{platform}VersionLocalization-id}"
50
+ type: "appInfoLocalizations",
51
+ id: "${new-appInfoLocalization-id}"
70
52
  }
71
53
  ]
72
54
  }
73
55
  }
74
56
  }
75
-
76
57
  included << {
77
- type: "appStoreVersionLocalizations",
78
- id: "${new-#{platform}VersionLocalization-id}",
58
+ type: "appInfoLocalizations",
59
+ id: "${new-appInfoLocalization-id}",
79
60
  attributes: {
80
- locale: primary_locale
61
+ locale: primary_locale,
62
+ name: name
81
63
  }
82
64
  }
83
- end
84
65
 
85
- app_store_verions_data = platforms.map do |platform|
86
- {
87
- type: "appStoreVersions",
88
- id: "${store-version-#{platform}}"
89
- }
90
- end
91
-
92
- relationships = {
93
- appStoreVersions: {
94
- data: app_store_verions_data
95
- },
96
- appInfos: {
97
- data: [
98
- {
99
- type: "appInfos",
100
- id: "${new-appInfo-id}"
66
+ platforms.each do |platform|
67
+ included << {
68
+ type: "appStoreVersions",
69
+ id: "${store-version-#{platform}}",
70
+ attributes: {
71
+ platform: platform,
72
+ versionString: version_string
73
+ },
74
+ relationships: {
75
+ appStoreVersionLocalizations: {
76
+ data: [
77
+ {
78
+ type: "appStoreVersionLocalizations",
79
+ id: "${new-#{platform}VersionLocalization-id}"
80
+ }
81
+ ]
82
+ }
101
83
  }
102
- ]
103
- }
104
- }
105
-
106
- app_attributes = {
107
- sku: sku,
108
- primaryLocale: primary_locale,
109
- bundleId: bundle_id
110
- }
111
- app_attributes[:companyName] = company_name if company_name
84
+ }
112
85
 
113
- body = {
114
- data: {
115
- type: "apps",
116
- attributes: app_attributes,
117
- relationships: relationships
118
- },
119
- included: included
120
- }
86
+ included << {
87
+ type: "appStoreVersionLocalizations",
88
+ id: "${new-#{platform}VersionLocalization-id}",
89
+ attributes: {
90
+ locale: primary_locale
91
+ }
92
+ }
93
+ end
121
94
 
122
- Client.instance.post("apps", body)
123
- end
95
+ app_store_verions_data = platforms.map do |platform|
96
+ {
97
+ type: "appStoreVersions",
98
+ id: "${store-version-#{platform}}"
99
+ }
100
+ end
124
101
 
125
- def patch_app(app_id: nil, attributes: {}, app_price_tier_id: nil, territory_ids: nil)
126
- relationships = {}
127
- included = []
102
+ relationships = {
103
+ appStoreVersions: {
104
+ data: app_store_verions_data
105
+ },
106
+ appInfos: {
107
+ data: [
108
+ {
109
+ type: "appInfos",
110
+ id: "${new-appInfo-id}"
111
+ }
112
+ ]
113
+ }
114
+ }
128
115
 
129
- # Price tier
130
- unless app_price_tier_id.nil?
131
- relationships[:prices] = {
132
- data: [
133
- {
134
- type: "appPrices",
135
- id: "${price1}"
136
- }
137
- ]
116
+ app_attributes = {
117
+ sku: sku,
118
+ primaryLocale: primary_locale,
119
+ bundleId: bundle_id
138
120
  }
121
+ app_attributes[:companyName] = company_name if company_name
139
122
 
140
- included << {
141
- type: "appPrices",
142
- id: "${price1}",
143
- attributes: {
144
- startDate: nil
123
+ body = {
124
+ data: {
125
+ type: "apps",
126
+ attributes: app_attributes,
127
+ relationships: relationships
145
128
  },
146
- relationships: {
147
- app: {
148
- data: {
149
- type: "apps",
150
- id: app_id
129
+ included: included
130
+ }
131
+
132
+ tunes_request_client.post("apps", body)
133
+ end
134
+
135
+ def patch_app(app_id: nil, attributes: {}, app_price_tier_id: nil, territory_ids: nil)
136
+ relationships = {}
137
+ included = []
138
+
139
+ # Price tier
140
+ unless app_price_tier_id.nil?
141
+ relationships[:prices] = {
142
+ data: [
143
+ {
144
+ type: "appPrices",
145
+ id: "${price1}"
151
146
  }
147
+ ]
148
+ }
149
+
150
+ included << {
151
+ type: "appPrices",
152
+ id: "${price1}",
153
+ attributes: {
154
+ startDate: nil
152
155
  },
153
- priceTier: {
154
- data: {
155
- type: "appPriceTiers",
156
- id: app_price_tier_id.to_s
156
+ relationships: {
157
+ app: {
158
+ data: {
159
+ type: "apps",
160
+ id: app_id
161
+ }
162
+ },
163
+ priceTier: {
164
+ data: {
165
+ type: "appPriceTiers",
166
+ id: app_price_tier_id.to_s
167
+ }
157
168
  }
158
169
  }
159
170
  }
160
- }
161
- end
171
+ end
162
172
 
163
- # Territories
164
- territories_data = (territory_ids || []).map do |id|
165
- { type: "territories", id: id }
166
- end
167
- unless territories_data.empty?
168
- relationships[:availableTerritories] = {
169
- data: territories_data
170
- }
171
- end
173
+ # Territories
174
+ territories_data = (territory_ids || []).map do |id|
175
+ { type: "territories", id: id }
176
+ end
177
+ unless territories_data.empty?
178
+ relationships[:availableTerritories] = {
179
+ data: territories_data
180
+ }
181
+ end
172
182
 
173
- # Data
174
- data = {
175
- type: "apps",
176
- id: app_id
177
- }
178
- data[:attributes] = attributes unless attributes.empty?
179
- data[:relationships] = relationships unless relationships.empty?
183
+ # Data
184
+ data = {
185
+ type: "apps",
186
+ id: app_id
187
+ }
188
+ data[:attributes] = attributes unless attributes.empty?
189
+ data[:relationships] = relationships unless relationships.empty?
180
190
 
181
- # Body
182
- body = {
183
- data: data
184
- }
185
- body[:included] = included unless included.empty?
191
+ # Body
192
+ body = {
193
+ data: data
194
+ }
195
+ body[:included] = included unless included.empty?
186
196
 
187
- Client.instance.patch("apps/#{app_id}", body)
188
- end
197
+ tunes_request_client.patch("apps/#{app_id}", body)
198
+ end
189
199
 
190
- #
191
- # appPreview
192
- #
200
+ #
201
+ # appPreview
202
+ #
193
203
 
194
- def get_app_preview(app_preview_id: nil)
195
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
196
- Client.instance.get("appPreviews/#{app_preview_id}", params)
197
- end
204
+ def get_app_preview(app_preview_id: nil)
205
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
206
+ tunes_request_client.get("appPreviews/#{app_preview_id}", params)
207
+ end
198
208
 
199
- def post_app_preview(app_preview_set_id: nil, attributes: {})
200
- body = {
201
- data: {
202
- type: "appPreviews",
203
- attributes: attributes,
204
- relationships: {
205
- appPreviewSet: {
206
- data: {
207
- type: "appPreviewSets",
208
- id: app_preview_set_id
209
+ def post_app_preview(app_preview_set_id: nil, attributes: {})
210
+ body = {
211
+ data: {
212
+ type: "appPreviews",
213
+ attributes: attributes,
214
+ relationships: {
215
+ appPreviewSet: {
216
+ data: {
217
+ type: "appPreviewSets",
218
+ id: app_preview_set_id
219
+ }
209
220
  }
210
221
  }
211
222
  }
212
223
  }
213
- }
214
224
 
215
- Client.instance.post("appPreviews", body)
216
- end
225
+ tunes_request_client.post("appPreviews", body)
226
+ end
217
227
 
218
- def patch_app_preview(app_preview_id: nil, attributes: {})
219
- body = {
220
- data: {
221
- type: "appPreviews",
222
- id: app_preview_id,
223
- attributes: attributes
228
+ def patch_app_preview(app_preview_id: nil, attributes: {})
229
+ body = {
230
+ data: {
231
+ type: "appPreviews",
232
+ id: app_preview_id,
233
+ attributes: attributes
234
+ }
224
235
  }
225
- }
226
236
 
227
- Client.instance.patch("appPreviews/#{app_preview_id}", body)
228
- end
237
+ tunes_request_client.patch("appPreviews/#{app_preview_id}", body)
238
+ end
229
239
 
230
- def delete_app_preview(app_preview_id: nil)
231
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
232
- Client.instance.delete("appPreviews/#{app_preview_id}", params)
233
- end
240
+ def delete_app_preview(app_preview_id: nil)
241
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
242
+ tunes_request_client.delete("appPreviews/#{app_preview_id}", params)
243
+ end
234
244
 
235
- #
236
- # appPreviewSets
237
- #
245
+ #
246
+ # appPreviewSets
247
+ #
238
248
 
239
- def get_app_preview_sets(filter: {}, includes: nil, limit: nil, sort: nil)
240
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
241
- Client.instance.get("appPreviewSets", params)
242
- end
249
+ def get_app_preview_sets(filter: {}, includes: nil, limit: nil, sort: nil)
250
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
251
+ tunes_request_client.get("appPreviewSets", params)
252
+ end
243
253
 
244
- def get_app_preview_set(app_preview_set_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
245
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
246
- Client.instance.get("appPreviewSets/#{app_preview_set_id}", params)
247
- end
254
+ def get_app_preview_set(app_preview_set_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
255
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
256
+ tunes_request_client.get("appPreviewSets/#{app_preview_set_id}", params)
257
+ end
248
258
 
249
- def post_app_preview_set(app_store_version_localization_id: nil, attributes: {})
250
- body = {
251
- data: {
252
- type: "appPreviewSets",
253
- attributes: attributes,
254
- relationships: {
255
- appStoreVersionLocalization: {
256
- data: {
257
- type: "appStoreVersionLocalizations",
258
- id: app_store_version_localization_id
259
+ def post_app_preview_set(app_store_version_localization_id: nil, attributes: {})
260
+ body = {
261
+ data: {
262
+ type: "appPreviewSets",
263
+ attributes: attributes,
264
+ relationships: {
265
+ appStoreVersionLocalization: {
266
+ data: {
267
+ type: "appStoreVersionLocalizations",
268
+ id: app_store_version_localization_id
269
+ }
259
270
  }
260
271
  }
261
272
  }
262
273
  }
263
- }
264
274
 
265
- Client.instance.post("appPreviewSets", body)
266
- end
275
+ tunes_request_client.post("appPreviewSets", body)
276
+ end
267
277
 
268
- def patch_app_preview_set_previews(app_preview_set_id: nil, app_preview_ids: nil)
269
- app_preview_ids ||= []
278
+ def patch_app_preview_set_previews(app_preview_set_id: nil, app_preview_ids: nil)
279
+ app_preview_ids ||= []
270
280
 
271
- body = {
272
- data: app_preview_ids.map do |app_preview_id|
273
- {
274
- type: "appPreviews",
275
- id: app_preview_id
276
- }
277
- end
278
- }
281
+ body = {
282
+ data: app_preview_ids.map do |app_preview_id|
283
+ {
284
+ type: "appPreviews",
285
+ id: app_preview_id
286
+ }
287
+ end
288
+ }
279
289
 
280
- Client.instance.patch("appPreviewSets/#{app_preview_set_id}/relationships/appPreviews", body)
281
- end
290
+ tunes_request_client.patch("appPreviewSets/#{app_preview_set_id}/relationships/appPreviews", body)
291
+ end
282
292
 
283
- #
284
- # availableTerritories
285
- #
293
+ #
294
+ # availableTerritories
295
+ #
286
296
 
287
- def get_available_territories(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
288
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
289
- Client.instance.get("apps/#{app_id}/availableTerritories", params)
290
- end
297
+ def get_available_territories(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
298
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
299
+ tunes_request_client.get("apps/#{app_id}/availableTerritories", params)
300
+ end
291
301
 
292
- #
293
- # appPrices
294
- #
302
+ #
303
+ # appPrices
304
+ #
295
305
 
296
- def get_app_prices(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
297
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
298
- Client.instance.get("appPrices", params)
299
- end
306
+ def get_app_prices(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
307
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
308
+ tunes_request_client.get("appPrices", params)
309
+ end
300
310
 
301
- #
302
- # appReviewAttachments
303
- #
311
+ #
312
+ # appReviewAttachments
313
+ #
304
314
 
305
- def post_app_store_review_attachment(app_store_review_detail_id: nil, attributes: {})
306
- body = {
307
- data: {
308
- type: "appStoreReviewAttachments",
309
- attributes: attributes,
310
- relationships: {
311
- appStoreReviewDetail: {
312
- data: {
313
- type: "appStoreReviewDetails",
314
- id: app_store_review_detail_id
315
+ def post_app_store_review_attachment(app_store_review_detail_id: nil, attributes: {})
316
+ body = {
317
+ data: {
318
+ type: "appStoreReviewAttachments",
319
+ attributes: attributes,
320
+ relationships: {
321
+ appStoreReviewDetail: {
322
+ data: {
323
+ type: "appStoreReviewDetails",
324
+ id: app_store_review_detail_id
325
+ }
315
326
  }
316
327
  }
317
328
  }
318
329
  }
319
- }
320
330
 
321
- Client.instance.post("appStoreReviewAttachments", body)
322
- end
331
+ tunes_request_client.post("appStoreReviewAttachments", body)
332
+ end
323
333
 
324
- def patch_app_store_review_attachment(app_store_review_attachment_id: nil, attributes: {})
325
- body = {
326
- data: {
327
- type: "appStoreReviewAttachments",
328
- id: app_store_review_attachment_id,
329
- attributes: attributes
334
+ def patch_app_store_review_attachment(app_store_review_attachment_id: nil, attributes: {})
335
+ body = {
336
+ data: {
337
+ type: "appStoreReviewAttachments",
338
+ id: app_store_review_attachment_id,
339
+ attributes: attributes
340
+ }
330
341
  }
331
- }
332
342
 
333
- Client.instance.patch("appStoreReviewAttachments/#{app_store_review_attachment_id}", body)
334
- end
343
+ tunes_request_client.patch("appStoreReviewAttachments/#{app_store_review_attachment_id}", body)
344
+ end
335
345
 
336
- def delete_app_store_review_attachment(app_store_review_attachment_id: nil)
337
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
338
- Client.instance.delete("appStoreReviewAttachments/#{app_store_review_attachment_id}", params)
339
- end
346
+ def delete_app_store_review_attachment(app_store_review_attachment_id: nil)
347
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
348
+ tunes_request_client.delete("appStoreReviewAttachments/#{app_store_review_attachment_id}", params)
349
+ end
340
350
 
341
- #
342
- # appScreenshotSets
343
- #
351
+ #
352
+ # appScreenshotSets
353
+ #
344
354
 
345
- def get_app_screenshot_sets(filter: {}, includes: nil, limit: nil, sort: nil)
346
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
347
- Client.instance.get("appScreenshotSets", params)
348
- end
355
+ def get_app_screenshot_sets(filter: {}, includes: nil, limit: nil, sort: nil)
356
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
357
+ tunes_request_client.get("appScreenshotSets", params)
358
+ end
349
359
 
350
- def get_app_screenshot_set(app_screenshot_set_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
351
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
352
- Client.instance.get("appScreenshotSets/#{app_screenshot_set_id}", params)
353
- end
360
+ def get_app_screenshot_set(app_screenshot_set_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
361
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
362
+ tunes_request_client.get("appScreenshotSets/#{app_screenshot_set_id}", params)
363
+ end
354
364
 
355
- def post_app_screenshot_set(app_store_version_localization_id: nil, attributes: {})
356
- body = {
357
- data: {
358
- type: "appScreenshotSets",
359
- attributes: attributes,
360
- relationships: {
361
- appStoreVersionLocalization: {
362
- data: {
363
- type: "appStoreVersionLocalizations",
364
- id: app_store_version_localization_id
365
+ def post_app_screenshot_set(app_store_version_localization_id: nil, attributes: {})
366
+ body = {
367
+ data: {
368
+ type: "appScreenshotSets",
369
+ attributes: attributes,
370
+ relationships: {
371
+ appStoreVersionLocalization: {
372
+ data: {
373
+ type: "appStoreVersionLocalizations",
374
+ id: app_store_version_localization_id
375
+ }
365
376
  }
366
377
  }
367
378
  }
368
379
  }
369
- }
370
380
 
371
- Client.instance.post("appScreenshotSets", body)
372
- end
381
+ tunes_request_client.post("appScreenshotSets", body)
382
+ end
373
383
 
374
- def patch_app_screenshot_set_screenshots(app_screenshot_set_id: nil, app_screenshot_ids: nil)
375
- app_screenshot_ids ||= []
384
+ def patch_app_screenshot_set_screenshots(app_screenshot_set_id: nil, app_screenshot_ids: nil)
385
+ app_screenshot_ids ||= []
376
386
 
377
- body = {
378
- data: app_screenshot_ids.map do |app_screenshot_id|
379
- {
380
- type: "appScreenshots",
381
- id: app_screenshot_id
382
- }
383
- end
384
- }
387
+ body = {
388
+ data: app_screenshot_ids.map do |app_screenshot_id|
389
+ {
390
+ type: "appScreenshots",
391
+ id: app_screenshot_id
392
+ }
393
+ end
394
+ }
385
395
 
386
- Client.instance.patch("appScreenshotSets/#{app_screenshot_set_id}/relationships/appScreenshots", body)
387
- end
396
+ tunes_request_client.patch("appScreenshotSets/#{app_screenshot_set_id}/relationships/appScreenshots", body)
397
+ end
388
398
 
389
- #
390
- # appScreenshots
391
- #
399
+ #
400
+ # appScreenshots
401
+ #
392
402
 
393
- def get_app_screenshot(app_screenshot_id: nil)
394
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
395
- Client.instance.get("appScreenshots/#{app_screenshot_id}", params)
396
- end
403
+ def get_app_screenshot(app_screenshot_id: nil)
404
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
405
+ tunes_request_client.get("appScreenshots/#{app_screenshot_id}", params)
406
+ end
397
407
 
398
- def post_app_screenshot(app_screenshot_set_id: nil, attributes: {})
399
- body = {
400
- data: {
401
- type: "appScreenshots",
402
- attributes: attributes,
403
- relationships: {
404
- appScreenshotSet: {
405
- data: {
406
- type: "appScreenshotSets",
407
- id: app_screenshot_set_id
408
+ def post_app_screenshot(app_screenshot_set_id: nil, attributes: {})
409
+ body = {
410
+ data: {
411
+ type: "appScreenshots",
412
+ attributes: attributes,
413
+ relationships: {
414
+ appScreenshotSet: {
415
+ data: {
416
+ type: "appScreenshotSets",
417
+ id: app_screenshot_set_id
418
+ }
408
419
  }
409
420
  }
410
421
  }
411
422
  }
412
- }
413
423
 
414
- Client.instance.post("appScreenshots", body, tries: 1)
415
- end
424
+ tunes_request_client.post("appScreenshots", body, tries: 1)
425
+ end
416
426
 
417
- def patch_app_screenshot(app_screenshot_id: nil, attributes: {})
418
- body = {
419
- data: {
420
- type: "appScreenshots",
421
- id: app_screenshot_id,
422
- attributes: attributes
427
+ def patch_app_screenshot(app_screenshot_id: nil, attributes: {})
428
+ body = {
429
+ data: {
430
+ type: "appScreenshots",
431
+ id: app_screenshot_id,
432
+ attributes: attributes
433
+ }
423
434
  }
424
- }
425
435
 
426
- Client.instance.patch("appScreenshots/#{app_screenshot_id}", body)
427
- end
436
+ tunes_request_client.patch("appScreenshots/#{app_screenshot_id}", body)
437
+ end
428
438
 
429
- def delete_app_screenshot(app_screenshot_id: nil)
430
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
431
- Client.instance.delete("appScreenshots/#{app_screenshot_id}", params)
432
- end
439
+ def delete_app_screenshot(app_screenshot_id: nil)
440
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
441
+ tunes_request_client.delete("appScreenshots/#{app_screenshot_id}", params)
442
+ end
433
443
 
434
- #
435
- # appInfos
436
- #
444
+ #
445
+ # appInfos
446
+ #
437
447
 
438
- def get_app_infos(filter: {}, includes: nil, limit: nil, sort: nil)
439
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
440
- Client.instance.get("appInfos", params)
441
- end
448
+ def get_app_infos(filter: {}, includes: nil, limit: nil, sort: nil)
449
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
450
+ tunes_request_client.get("appInfos", params)
451
+ end
442
452
 
443
- def patch_app_info(app_info_id: nil, attributes: {})
444
- attributes ||= {}
453
+ def patch_app_info(app_info_id: nil, attributes: {})
454
+ attributes ||= {}
445
455
 
446
- data = {
447
- type: "appInfos",
448
- id: app_info_id
449
- }
450
- data[:attributes] = attributes unless attributes.empty?
456
+ data = {
457
+ type: "appInfos",
458
+ id: app_info_id
459
+ }
460
+ data[:attributes] = attributes unless attributes.empty?
451
461
 
452
- body = {
453
- data: data
454
- }
462
+ body = {
463
+ data: data
464
+ }
455
465
 
456
- Client.instance.patch("appInfos/#{app_info_id}", body)
457
- end
466
+ tunes_request_client.patch("appInfos/#{app_info_id}", body)
467
+ end
458
468
 
459
- #
460
- # Adding the key will create/update (if value) or delete if nil
461
- # Not including a key will leave as is
462
- # category_id_map: {
463
- # primary_category_id: "GAMES",
464
- # primary_subcategory_one_id: "PUZZLE",
465
- # primary_subcategory_two_id: "STRATEGY",
466
- # secondary_category_id: nil,
467
- # secondary_subcategory_one_id: nil,
468
- # secondary_subcategory_two_id: nil
469
- # }
470
- #
471
- def patch_app_info_categories(app_info_id: nil, category_id_map: nil)
472
- category_id_map ||= {}
473
- primary_category_id = category_id_map[:primary_category_id]
474
- primary_subcategory_one_id = category_id_map[:primary_subcategory_one_id]
475
- primary_subcategory_two_id = category_id_map[:primary_subcategory_two_id]
476
- secondary_category_id = category_id_map[:secondary_category_id]
477
- secondary_subcategory_one_id = category_id_map[:secondary_subcategory_one_id]
478
- secondary_subcategory_two_id = category_id_map[:secondary_subcategory_two_id]
469
+ #
470
+ # Adding the key will create/update (if value) or delete if nil
471
+ # Not including a key will leave as is
472
+ # category_id_map: {
473
+ # primary_category_id: "GAMES",
474
+ # primary_subcategory_one_id: "PUZZLE",
475
+ # primary_subcategory_two_id: "STRATEGY",
476
+ # secondary_category_id: nil,
477
+ # secondary_subcategory_one_id: nil,
478
+ # secondary_subcategory_two_id: nil
479
+ # }
480
+ #
481
+ def patch_app_info_categories(app_info_id: nil, category_id_map: nil)
482
+ category_id_map ||= {}
483
+ primary_category_id = category_id_map[:primary_category_id]
484
+ primary_subcategory_one_id = category_id_map[:primary_subcategory_one_id]
485
+ primary_subcategory_two_id = category_id_map[:primary_subcategory_two_id]
486
+ secondary_category_id = category_id_map[:secondary_category_id]
487
+ secondary_subcategory_one_id = category_id_map[:secondary_subcategory_one_id]
488
+ secondary_subcategory_two_id = category_id_map[:secondary_subcategory_two_id]
489
+
490
+ relationships = {}
491
+
492
+ # Only update if key is included (otherwise category will be removed)
493
+ if category_id_map.include?(:primary_category_id)
494
+ relationships[:primaryCategory] = {
495
+ data: primary_category_id ? { type: "appCategories", id: primary_category_id } : nil
496
+ }
497
+ end
479
498
 
480
- relationships = {}
499
+ # Only update if key is included (otherwise category will be removed)
500
+ if category_id_map.include?(:primary_subcategory_one_id)
501
+ relationships[:primarySubcategoryOne] = {
502
+ data: primary_subcategory_one_id ? { type: "appCategories", id: primary_subcategory_one_id } : nil
503
+ }
504
+ end
481
505
 
482
- # Only update if key is included (otherwise category will be removed)
483
- if category_id_map.include?(:primary_category_id)
484
- relationships[:primaryCategory] = {
485
- data: primary_category_id ? { type: "appCategories", id: primary_category_id } : nil
486
- }
487
- end
506
+ # Only update if key is included (otherwise category will be removed)
507
+ if category_id_map.include?(:primary_subcategory_two_id)
508
+ relationships[:primarySubcategoryTwo] = {
509
+ data: primary_subcategory_two_id ? { type: "appCategories", id: primary_subcategory_two_id } : nil
510
+ }
511
+ end
488
512
 
489
- # Only update if key is included (otherwise category will be removed)
490
- if category_id_map.include?(:primary_subcategory_one_id)
491
- relationships[:primarySubcategoryOne] = {
492
- data: primary_subcategory_one_id ? { type: "appCategories", id: primary_subcategory_one_id } : nil
493
- }
494
- end
513
+ # Only update if key is included (otherwise category will be removed)
514
+ if category_id_map.include?(:secondary_category_id)
515
+ relationships[:secondaryCategory] = {
516
+ data: secondary_category_id ? { type: "appCategories", id: secondary_category_id } : nil
517
+ }
518
+ end
495
519
 
496
- # Only update if key is included (otherwise category will be removed)
497
- if category_id_map.include?(:primary_subcategory_two_id)
498
- relationships[:primarySubcategoryTwo] = {
499
- data: primary_subcategory_two_id ? { type: "appCategories", id: primary_subcategory_two_id } : nil
500
- }
501
- end
520
+ # Only update if key is included (otherwise category will be removed)
521
+ if category_id_map.include?(:secondary_subcategory_one_id)
522
+ relationships[:secondarySubcategoryOne] = {
523
+ data: secondary_subcategory_one_id ? { type: "appCategories", id: secondary_subcategory_one_id } : nil
524
+ }
525
+ end
502
526
 
503
- # Only update if key is included (otherwise category will be removed)
504
- if category_id_map.include?(:secondary_category_id)
505
- relationships[:secondaryCategory] = {
506
- data: secondary_category_id ? { type: "appCategories", id: secondary_category_id } : nil
507
- }
508
- end
527
+ # Only update if key is included (otherwise category will be removed)
528
+ if category_id_map.include?(:secondary_subcategory_two_id)
529
+ relationships[:secondarySubcategoryTwo] = {
530
+ data: secondary_subcategory_two_id ? { type: "appCategories", id: secondary_subcategory_two_id } : nil
531
+ }
532
+ end
509
533
 
510
- # Only update if key is included (otherwise category will be removed)
511
- if category_id_map.include?(:secondary_subcategory_one_id)
512
- relationships[:secondarySubcategoryOne] = {
513
- data: secondary_subcategory_one_id ? { type: "appCategories", id: secondary_subcategory_one_id } : nil
534
+ data = {
535
+ type: "appInfos",
536
+ id: app_info_id
514
537
  }
515
- end
538
+ data[:relationships] = relationships unless relationships.empty?
516
539
 
517
- # Only update if key is included (otherwise category will be removed)
518
- if category_id_map.include?(:secondary_subcategory_two_id)
519
- relationships[:secondarySubcategoryTwo] = {
520
- data: secondary_subcategory_two_id ? { type: "appCategories", id: secondary_subcategory_two_id } : nil
540
+ body = {
541
+ data: data
521
542
  }
522
- end
523
-
524
- data = {
525
- type: "appInfos",
526
- id: app_info_id
527
- }
528
- data[:relationships] = relationships unless relationships.empty?
529
-
530
- body = {
531
- data: data
532
- }
533
543
 
534
- Client.instance.patch("appInfos/#{app_info_id}", body)
535
- end
544
+ tunes_request_client.patch("appInfos/#{app_info_id}", body)
545
+ end
536
546
 
537
- def delete_app_info(app_info_id: nil)
538
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
539
- Client.instance.delete("appInfos/#{app_info_id}", params)
540
- end
547
+ def delete_app_info(app_info_id: nil)
548
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
549
+ tunes_request_client.delete("appInfos/#{app_info_id}", params)
550
+ end
541
551
 
542
- #
543
- # appInfoLocalizations
544
- #
552
+ #
553
+ # appInfoLocalizations
554
+ #
545
555
 
546
- def get_app_info_localizations(app_info_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
547
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
548
- Client.instance.get("appInfos/#{app_info_id}/appInfoLocalizations", params)
549
- end
556
+ def get_app_info_localizations(app_info_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
557
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
558
+ tunes_request_client.get("appInfos/#{app_info_id}/appInfoLocalizations", params)
559
+ end
550
560
 
551
- def post_app_info_localization(app_info_id: nil, attributes: {})
552
- body = {
553
- data: {
554
- type: "appInfoLocalizations",
555
- attributes: attributes,
556
- relationships: {
557
- appStoreVersion: {
558
- data: {
559
- type: "appStoreVersions",
560
- id: app_info_id
561
+ def post_app_info_localization(app_info_id: nil, attributes: {})
562
+ body = {
563
+ data: {
564
+ type: "appInfoLocalizations",
565
+ attributes: attributes,
566
+ relationships: {
567
+ appStoreVersion: {
568
+ data: {
569
+ type: "appStoreVersions",
570
+ id: app_info_id
571
+ }
561
572
  }
562
573
  }
563
574
  }
564
575
  }
565
- }
566
576
 
567
- Client.instance.post("appInfoLocalizations", body)
568
- end
577
+ tunes_request_client.post("appInfoLocalizations", body)
578
+ end
569
579
 
570
- def patch_app_info_localization(app_info_localization_id: nil, attributes: {})
571
- body = {
572
- data: {
573
- type: "appInfoLocalizations",
574
- id: app_info_localization_id,
575
- attributes: attributes
580
+ def patch_app_info_localization(app_info_localization_id: nil, attributes: {})
581
+ body = {
582
+ data: {
583
+ type: "appInfoLocalizations",
584
+ id: app_info_localization_id,
585
+ attributes: attributes
586
+ }
576
587
  }
577
- }
578
588
 
579
- Client.instance.patch("appInfoLocalizations/#{app_info_localization_id}", body)
580
- end
589
+ tunes_request_client.patch("appInfoLocalizations/#{app_info_localization_id}", body)
590
+ end
581
591
 
582
- #
583
- # appStoreReviewDetails
584
- #
592
+ #
593
+ # appStoreReviewDetails
594
+ #
585
595
 
586
- def get_app_store_review_detail(app_store_version_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
587
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
588
- Client.instance.get("appStoreVersions/#{app_store_version_id}/appStoreReviewDetail", params)
589
- end
596
+ def get_app_store_review_detail(app_store_version_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
597
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
598
+ tunes_request_client.get("appStoreVersions/#{app_store_version_id}/appStoreReviewDetail", params)
599
+ end
590
600
 
591
- def post_app_store_review_detail(app_store_version_id: nil, attributes: {})
592
- body = {
593
- data: {
594
- type: "appStoreReviewDetails",
595
- attributes: attributes,
596
- relationships: {
597
- appStoreVersion: {
598
- data: {
599
- type: "appStoreVersions",
600
- id: app_store_version_id
601
+ def post_app_store_review_detail(app_store_version_id: nil, attributes: {})
602
+ body = {
603
+ data: {
604
+ type: "appStoreReviewDetails",
605
+ attributes: attributes,
606
+ relationships: {
607
+ appStoreVersion: {
608
+ data: {
609
+ type: "appStoreVersions",
610
+ id: app_store_version_id
611
+ }
601
612
  }
602
613
  }
603
614
  }
604
615
  }
605
- }
606
616
 
607
- Client.instance.post("appStoreReviewDetails", body)
608
- end
617
+ tunes_request_client.post("appStoreReviewDetails", body)
618
+ end
609
619
 
610
- def patch_app_store_review_detail(app_store_review_detail_id: nil, attributes: {})
611
- body = {
612
- data: {
613
- type: "appStoreReviewDetails",
614
- id: app_store_review_detail_id,
615
- attributes: attributes
620
+ def patch_app_store_review_detail(app_store_review_detail_id: nil, attributes: {})
621
+ body = {
622
+ data: {
623
+ type: "appStoreReviewDetails",
624
+ id: app_store_review_detail_id,
625
+ attributes: attributes
626
+ }
616
627
  }
617
- }
618
628
 
619
- Client.instance.patch("appStoreReviewDetails/#{app_store_review_detail_id}", body)
620
- end
629
+ tunes_request_client.patch("appStoreReviewDetails/#{app_store_review_detail_id}", body)
630
+ end
621
631
 
622
- #
623
- # appStoreVersionLocalizations
624
- #
632
+ #
633
+ # appStoreVersionLocalizations
634
+ #
625
635
 
626
- def get_app_store_version_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
627
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
628
- Client.instance.get("appStoreVersionLocalizations", params)
629
- end
636
+ def get_app_store_version_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
637
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
638
+ tunes_request_client.get("appStoreVersionLocalizations", params)
639
+ end
630
640
 
631
- def post_app_store_version_localization(app_store_version_id: nil, attributes: {})
632
- body = {
633
- data: {
634
- type: "appStoreVersionLocalizations",
635
- attributes: attributes,
636
- relationships: {
637
- appStoreVersion: {
638
- data: {
639
- type: "appStoreVersions",
640
- id: app_store_version_id
641
+ def post_app_store_version_localization(app_store_version_id: nil, attributes: {})
642
+ body = {
643
+ data: {
644
+ type: "appStoreVersionLocalizations",
645
+ attributes: attributes,
646
+ relationships: {
647
+ appStoreVersion: {
648
+ data: {
649
+ type: "appStoreVersions",
650
+ id: app_store_version_id
651
+ }
641
652
  }
642
653
  }
643
654
  }
644
655
  }
645
- }
646
656
 
647
- Client.instance.post("appStoreVersionLocalizations", body)
648
- end
657
+ tunes_request_client.post("appStoreVersionLocalizations", body)
658
+ end
649
659
 
650
- def patch_app_store_version_localization(app_store_version_localization_id: nil, attributes: {})
651
- body = {
652
- data: {
653
- type: "appStoreVersionLocalizations",
654
- id: app_store_version_localization_id,
655
- attributes: attributes
660
+ def patch_app_store_version_localization(app_store_version_localization_id: nil, attributes: {})
661
+ body = {
662
+ data: {
663
+ type: "appStoreVersionLocalizations",
664
+ id: app_store_version_localization_id,
665
+ attributes: attributes
666
+ }
656
667
  }
657
- }
658
668
 
659
- Client.instance.patch("appStoreVersionLocalizations/#{app_store_version_localization_id}", body)
660
- end
669
+ tunes_request_client.patch("appStoreVersionLocalizations/#{app_store_version_localization_id}", body)
670
+ end
661
671
 
662
- def delete_app_store_version_localization(app_store_version_localization_id: nil)
663
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
664
- Client.instance.delete("appStoreVersionLocalizations/#{app_store_version_localization_id}", params)
665
- end
672
+ def delete_app_store_version_localization(app_store_version_localization_id: nil)
673
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
674
+ tunes_request_client.delete("appStoreVersionLocalizations/#{app_store_version_localization_id}", params)
675
+ end
666
676
 
667
- #
668
- # appStoreVersionPhasedReleases
669
- #
677
+ #
678
+ # appStoreVersionPhasedReleases
679
+ #
670
680
 
671
- def get_app_store_version_phased_release(app_store_version_id: nil)
672
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
673
- Client.instance.get("appStoreVersions/#{app_store_version_id}/appStoreVersionPhasedRelease", params)
674
- end
681
+ def get_app_store_version_phased_release(app_store_version_id: nil)
682
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
683
+ tunes_request_client.get("appStoreVersions/#{app_store_version_id}/appStoreVersionPhasedRelease", params)
684
+ end
675
685
 
676
- def post_app_store_version_phased_release(app_store_version_id: nil, attributes: {})
677
- body = {
678
- data: {
679
- type: "appStoreVersionPhasedReleases",
680
- attributes: attributes,
681
- relationships: {
682
- appStoreVersion: {
683
- data: {
684
- type: "appStoreVersions",
685
- id: app_store_version_id
686
+ def post_app_store_version_phased_release(app_store_version_id: nil, attributes: {})
687
+ body = {
688
+ data: {
689
+ type: "appStoreVersionPhasedReleases",
690
+ attributes: attributes,
691
+ relationships: {
692
+ appStoreVersion: {
693
+ data: {
694
+ type: "appStoreVersions",
695
+ id: app_store_version_id
696
+ }
686
697
  }
687
698
  }
688
699
  }
689
700
  }
690
- }
691
701
 
692
- Client.instance.post("appStoreVersionPhasedReleases", body)
693
- end
702
+ tunes_request_client.post("appStoreVersionPhasedReleases", body)
703
+ end
694
704
 
695
- def delete_app_store_version_phased_release(app_store_version_phased_release_id: nil)
696
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
697
- Client.instance.delete("appStoreVersionPhasedReleases/#{app_store_version_phased_release_id}", params)
698
- end
705
+ def delete_app_store_version_phased_release(app_store_version_phased_release_id: nil)
706
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
707
+ tunes_request_client.delete("appStoreVersionPhasedReleases/#{app_store_version_phased_release_id}", params)
708
+ end
699
709
 
700
- #
701
- # appStoreVersions
702
- #
710
+ #
711
+ # appStoreVersions
712
+ #
703
713
 
704
- def get_app_store_versions(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
705
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
706
- Client.instance.get("apps/#{app_id}/appStoreVersions", params)
707
- end
714
+ def get_app_store_versions(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
715
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
716
+ tunes_request_client.get("apps/#{app_id}/appStoreVersions", params)
717
+ end
708
718
 
709
- def get_app_store_version(app_store_version_id: nil, includes: nil)
710
- params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil)
711
- Client.instance.get("appStoreVersions/#{app_store_version_id}", params)
712
- end
719
+ def get_app_store_version(app_store_version_id: nil, includes: nil)
720
+ params = tunes_request_client.build_params(filter: nil, includes: includes, limit: nil, sort: nil)
721
+ tunes_request_client.get("appStoreVersions/#{app_store_version_id}", params)
722
+ end
713
723
 
714
- def post_app_store_version(app_id: nil, attributes: {})
715
- body = {
716
- data: {
717
- type: "appStoreVersions",
718
- attributes: attributes,
719
- relationships: {
720
- app: {
721
- data: {
722
- type: "apps",
723
- id: app_id
724
+ def post_app_store_version(app_id: nil, attributes: {})
725
+ body = {
726
+ data: {
727
+ type: "appStoreVersions",
728
+ attributes: attributes,
729
+ relationships: {
730
+ app: {
731
+ data: {
732
+ type: "apps",
733
+ id: app_id
734
+ }
724
735
  }
725
736
  }
726
737
  }
727
738
  }
728
- }
729
739
 
730
- Client.instance.post("appStoreVersions", body)
731
- end
740
+ tunes_request_client.post("appStoreVersions", body)
741
+ end
732
742
 
733
- def patch_app_store_version(app_store_version_id: nil, attributes: {})
734
- body = {
735
- data: {
736
- type: "appStoreVersions",
737
- id: app_store_version_id,
738
- attributes: attributes
743
+ def patch_app_store_version(app_store_version_id: nil, attributes: {})
744
+ body = {
745
+ data: {
746
+ type: "appStoreVersions",
747
+ id: app_store_version_id,
748
+ attributes: attributes
749
+ }
739
750
  }
740
- }
741
751
 
742
- Client.instance.patch("appStoreVersions/#{app_store_version_id}", body)
743
- end
744
-
745
- def patch_app_store_version_with_build(app_store_version_id: nil, build_id: nil)
746
- data = nil
747
- if build_id
748
- data = {
749
- type: "builds",
750
- id: build_id
751
- }
752
+ tunes_request_client.patch("appStoreVersions/#{app_store_version_id}", body)
752
753
  end
753
754
 
754
- body = {
755
- data: {
756
- type: "appStoreVersions",
757
- id: app_store_version_id,
758
- relationships: {
759
- build: {
760
- data: data
755
+ def patch_app_store_version_with_build(app_store_version_id: nil, build_id: nil)
756
+ data = nil
757
+ if build_id
758
+ data = {
759
+ type: "builds",
760
+ id: build_id
761
+ }
762
+ end
763
+
764
+ body = {
765
+ data: {
766
+ type: "appStoreVersions",
767
+ id: app_store_version_id,
768
+ relationships: {
769
+ build: {
770
+ data: data
771
+ }
761
772
  }
762
773
  }
763
774
  }
764
- }
765
775
 
766
- Client.instance.patch("appStoreVersions/#{app_store_version_id}", body)
767
- end
776
+ tunes_request_client.patch("appStoreVersions/#{app_store_version_id}", body)
777
+ end
768
778
 
769
- #
770
- # appStoreVersionPhasedReleases
771
- #
779
+ #
780
+ # appStoreVersionPhasedReleases
781
+ #
772
782
 
773
- def get_reset_ratings_request(app_store_version_id: nil)
774
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
775
- Client.instance.get("appStoreVersions/#{app_store_version_id}/resetRatingsRequest", params)
776
- end
783
+ def get_reset_ratings_request(app_store_version_id: nil)
784
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
785
+ tunes_request_client.get("appStoreVersions/#{app_store_version_id}/resetRatingsRequest", params)
786
+ end
777
787
 
778
- def post_reset_ratings_request(app_store_version_id: nil)
779
- body = {
780
- data: {
781
- type: "resetRatingsRequests",
782
- relationships: {
783
- appStoreVersion: {
784
- data: {
785
- type: "appStoreVersions",
786
- id: app_store_version_id
788
+ def post_reset_ratings_request(app_store_version_id: nil)
789
+ body = {
790
+ data: {
791
+ type: "resetRatingsRequests",
792
+ relationships: {
793
+ appStoreVersion: {
794
+ data: {
795
+ type: "appStoreVersions",
796
+ id: app_store_version_id
797
+ }
787
798
  }
788
799
  }
789
800
  }
790
801
  }
791
- }
792
802
 
793
- Client.instance.post("resetRatingsRequests", body)
794
- end
803
+ tunes_request_client.post("resetRatingsRequests", body)
804
+ end
795
805
 
796
- def delete_reset_ratings_request(reset_ratings_request_id: nil)
797
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
798
- Client.instance.delete("resetRatingsRequests/#{reset_ratings_request_id}", params)
799
- end
806
+ def delete_reset_ratings_request(reset_ratings_request_id: nil)
807
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
808
+ tunes_request_client.delete("resetRatingsRequests/#{reset_ratings_request_id}", params)
809
+ end
800
810
 
801
- #
802
- # appStoreVersionSubmissions
803
- #
811
+ #
812
+ # appStoreVersionSubmissions
813
+ #
804
814
 
805
- def get_app_store_version_submission(app_store_version_id: nil)
806
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
807
- Client.instance.get("appStoreVersions/#{app_store_version_id}/appStoreVersionSubmission", params)
808
- end
815
+ def get_app_store_version_submission(app_store_version_id: nil)
816
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
817
+ tunes_request_client.get("appStoreVersions/#{app_store_version_id}/appStoreVersionSubmission", params)
818
+ end
809
819
 
810
- def post_app_store_version_submission(app_store_version_id: nil)
811
- body = {
812
- data: {
813
- type: "appStoreVersionSubmissions",
814
- relationships: {
815
- appStoreVersion: {
816
- data: {
817
- type: "appStoreVersions",
818
- id: app_store_version_id
820
+ def post_app_store_version_submission(app_store_version_id: nil)
821
+ body = {
822
+ data: {
823
+ type: "appStoreVersionSubmissions",
824
+ relationships: {
825
+ appStoreVersion: {
826
+ data: {
827
+ type: "appStoreVersions",
828
+ id: app_store_version_id
829
+ }
819
830
  }
820
831
  }
821
832
  }
822
833
  }
823
- }
824
-
825
- Client.instance.post("appStoreVersionSubmissions", body)
826
- end
827
834
 
828
- def delete_app_store_version_submission(app_store_version_submission_id: nil)
829
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
830
- Client.instance.delete("appStoreVersionSubmissions/#{app_store_version_submission_id}", params)
831
- end
835
+ tunes_request_client.post("appStoreVersionSubmissions", body)
836
+ end
832
837
 
833
- #
834
- # appStoreVersionReleaseRequests
835
- #
838
+ def delete_app_store_version_submission(app_store_version_submission_id: nil)
839
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
840
+ tunes_request_client.delete("appStoreVersionSubmissions/#{app_store_version_submission_id}", params)
841
+ end
836
842
 
837
- def post_app_store_version_release_request(app_store_version_id: nil)
838
- body = {
839
- data: {
840
- type: "appStoreVersionReleaseRequests",
841
- relationships: {
842
- appStoreVersion: {
843
- data: {
844
- type: "appStoreVersions",
845
- id: app_store_version_id
846
- }
847
- }
848
- }
849
- }
850
- }
843
+ #
844
+ # appStoreVersionReleaseRequests
845
+ #
846
+
847
+ def post_app_store_version_release_request(app_store_version_id: nil)
848
+ body = {
849
+ data: {
850
+ type: "appStoreVersionReleaseRequests",
851
+ relationships: {
852
+ appStoreVersion: {
853
+ data: {
854
+ type: "appStoreVersions",
855
+ id: app_store_version_id
856
+ }
857
+ }
858
+ }
859
+ }
860
+ }
851
861
 
852
- Client.instance.post("appStoreVersionReleaseRequests", body)
853
- end
862
+ tunes_request_client.post("appStoreVersionReleaseRequests", body)
863
+ end
854
864
 
855
- #
856
- # idfaDeclarations
857
- #
865
+ #
866
+ # idfaDeclarations
867
+ #
858
868
 
859
- def get_idfa_declaration(app_store_version_id: nil)
860
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
861
- Client.instance.get("appStoreVersions/#{app_store_version_id}/idfaDeclaration", params)
862
- end
869
+ def get_idfa_declaration(app_store_version_id: nil)
870
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
871
+ tunes_request_client.get("appStoreVersions/#{app_store_version_id}/idfaDeclaration", params)
872
+ end
863
873
 
864
- def post_idfa_declaration(app_store_version_id: nil, attributes: nil)
865
- body = {
866
- data: {
867
- type: "idfaDeclarations",
868
- attributes: attributes,
869
- relationships: {
870
- appStoreVersion: {
871
- data: {
872
- type: "appStoreVersions",
873
- id: app_store_version_id
874
+ def post_idfa_declaration(app_store_version_id: nil, attributes: nil)
875
+ body = {
876
+ data: {
877
+ type: "idfaDeclarations",
878
+ attributes: attributes,
879
+ relationships: {
880
+ appStoreVersion: {
881
+ data: {
882
+ type: "appStoreVersions",
883
+ id: app_store_version_id
884
+ }
874
885
  }
875
886
  }
876
887
  }
877
888
  }
878
- }
879
889
 
880
- Client.instance.post("idfaDeclarations", body)
881
- end
890
+ tunes_request_client.post("idfaDeclarations", body)
891
+ end
882
892
 
883
- def patch_idfa_declaration(idfa_declaration_id: nil, attributes: nil)
884
- body = {
885
- data: {
886
- type: "idfaDeclarations",
887
- id: idfa_declaration_id,
888
- attributes: attributes
893
+ def patch_idfa_declaration(idfa_declaration_id: nil, attributes: nil)
894
+ body = {
895
+ data: {
896
+ type: "idfaDeclarations",
897
+ id: idfa_declaration_id,
898
+ attributes: attributes
899
+ }
889
900
  }
890
- }
891
901
 
892
- Client.instance.patch("idfaDeclarations/#{idfa_declaration_id}", body)
893
- end
902
+ tunes_request_client.patch("idfaDeclarations/#{idfa_declaration_id}", body)
903
+ end
894
904
 
895
- def delete_idfa_declaration(idfa_declaration_id: nil)
896
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
897
- Client.instance.delete("idfaDeclarations/#{idfa_declaration_id}", params)
898
- end
905
+ def delete_idfa_declaration(idfa_declaration_id: nil)
906
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
907
+ tunes_request_client.delete("idfaDeclarations/#{idfa_declaration_id}", params)
908
+ end
899
909
 
900
- #
901
- # sandboxTesters
902
- #
910
+ #
911
+ # sandboxTesters
912
+ #
903
913
 
904
- def get_sandbox_testers(filter: nil, includes: nil, limit: nil, sort: nil)
905
- params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
906
- Client.instance.get("sandboxTesters", params)
907
- end
914
+ def get_sandbox_testers(filter: nil, includes: nil, limit: nil, sort: nil)
915
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
916
+ tunes_request_client.get("sandboxTesters", params)
917
+ end
908
918
 
909
- def post_sandbox_tester(attributes: {})
910
- body = {
911
- data: {
912
- type: "sandboxTesters",
913
- attributes: attributes
919
+ def post_sandbox_tester(attributes: {})
920
+ body = {
921
+ data: {
922
+ type: "sandboxTesters",
923
+ attributes: attributes
924
+ }
914
925
  }
915
- }
916
926
 
917
- Client.instance.post("sandboxTesters", body)
918
- end
927
+ tunes_request_client.post("sandboxTesters", body)
928
+ end
919
929
 
920
- def delete_sandbox_tester(sandbox_tester_id: nil)
921
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
922
- Client.instance.delete("sandboxTesters/#{sandbox_tester_id}", params)
923
- end
930
+ def delete_sandbox_tester(sandbox_tester_id: nil)
931
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
932
+ tunes_request_client.delete("sandboxTesters/#{sandbox_tester_id}", params)
933
+ end
924
934
 
925
- #
926
- # territories
927
- #
935
+ #
936
+ # territories
937
+ #
928
938
 
929
- def get_territories(filter: {}, includes: nil, limit: nil, sort: nil)
930
- params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
931
- Client.instance.get("territories", params)
939
+ def get_territories(filter: {}, includes: nil, limit: nil, sort: nil)
940
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
941
+ tunes_request_client.get("territories", params)
942
+ end
932
943
  end
933
944
  end
934
945
  end