fastlane 2.156.1 → 2.157.4

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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +82 -82
  3. data/deliver/lib/deliver.rb +1 -0
  4. data/deliver/lib/deliver/app_screenshot_iterator.rb +26 -29
  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/runner.rb +8 -5
  9. data/deliver/lib/deliver/upload_screenshots.rb +34 -17
  10. data/fastlane/lib/fastlane/actions/{.git_commit.rb.swp → .ensure_git_status_clean.rb.swp} +0 -0
  11. data/fastlane/lib/fastlane/actions/.hockey.rb.swp +0 -0
  12. data/fastlane/lib/fastlane/actions/.slack.rb.swp +0 -0
  13. data/fastlane/lib/fastlane/actions/.update_project_provisioning.rb.swp +0 -0
  14. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +12 -8
  15. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +120 -0
  16. data/fastlane/lib/fastlane/actions/commit_version_bump.rb +1 -1
  17. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +2 -0
  18. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +17 -1
  19. data/fastlane/lib/fastlane/actions/download_dsyms.rb +89 -68
  20. data/fastlane/lib/fastlane/actions/set_changelog.rb +3 -2
  21. data/fastlane/lib/fastlane/actions/sonar.rb +5 -0
  22. data/fastlane/lib/fastlane/actions/spaceship_stats.rb +73 -0
  23. data/fastlane/lib/fastlane/actions/upload_to_testflight.rb +4 -0
  24. data/fastlane/lib/fastlane/version.rb +1 -1
  25. data/fastlane/swift/Deliverfile.swift +1 -1
  26. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  27. data/fastlane/swift/Fastlane.swift +78 -18
  28. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcuserdata/josh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  29. data/fastlane/swift/Gymfile.swift +1 -1
  30. data/fastlane/swift/GymfileProtocol.swift +1 -1
  31. data/fastlane/swift/Matchfile.swift +1 -1
  32. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  33. data/fastlane/swift/Precheckfile.swift +1 -1
  34. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  35. data/fastlane/swift/Scanfile.swift +1 -1
  36. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  37. data/fastlane/swift/Screengrabfile.swift +1 -1
  38. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  39. data/fastlane/swift/Snapshotfile.swift +1 -1
  40. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  41. data/fastlane_core/lib/fastlane_core/command_executor.rb +1 -0
  42. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +71 -42
  43. data/gym/lib/gym/error_handler.rb +1 -1
  44. data/match/lib/match/spaceship_ensure.rb +5 -5
  45. data/{fastlane/lib/fastlane/.erb_template_helper.rb.swp → pilot/lib/pilot/.manager.rb.swp} +0 -0
  46. data/pilot/lib/pilot/build_manager.rb +15 -4
  47. data/pilot/lib/pilot/manager.rb +15 -5
  48. data/pilot/lib/pilot/options.rb +16 -0
  49. data/produce/lib/produce/itunes_connect.rb +3 -2
  50. data/screengrab/lib/screengrab/runner.rb +29 -10
  51. data/sigh/lib/assets/resign.sh +9 -6
  52. data/sigh/lib/sigh/runner.rb +5 -4
  53. data/spaceship/lib/spaceship.rb +4 -0
  54. data/spaceship/lib/spaceship/client.rb +3 -0
  55. data/spaceship/lib/spaceship/connect_api.rb +1 -15
  56. data/spaceship/lib/spaceship/{.DS_Store → connect_api/.DS_Store} +0 -0
  57. data/spaceship/lib/spaceship/connect_api/api_client.rb +270 -0
  58. data/spaceship/lib/spaceship/connect_api/client.rb +155 -210
  59. data/spaceship/lib/spaceship/connect_api/file_uploader.rb +2 -0
  60. data/spaceship/lib/spaceship/connect_api/models/app.rb +5 -5
  61. data/spaceship/lib/spaceship/connect_api/models/app_price_point.rb +26 -0
  62. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +7 -1
  63. data/spaceship/lib/spaceship/connect_api/provisioning/client.rb +8 -17
  64. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +75 -64
  65. data/spaceship/lib/spaceship/connect_api/spaceship.rb +98 -0
  66. data/spaceship/lib/spaceship/connect_api/testflight/client.rb +8 -17
  67. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +288 -277
  68. data/spaceship/lib/spaceship/connect_api/token.rb +46 -5
  69. data/spaceship/lib/spaceship/connect_api/token_refresh_middleware.rb +24 -0
  70. data/spaceship/lib/spaceship/connect_api/tunes/client.rb +8 -17
  71. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +725 -706
  72. data/spaceship/lib/spaceship/connect_api/users/client.rb +8 -17
  73. data/spaceship/lib/spaceship/connect_api/users/users.rb +28 -17
  74. data/spaceship/lib/spaceship/stats_middleware.rb +65 -0
  75. metadata +33 -22
  76. data/spaceship/lib/spaceship/connect_api/.client.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,951 @@ 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
+ # appPricePoints
313
+ #
314
+ def get_app_price_points(filter: {}, includes: nil, limit: nil, sort: nil)
315
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
316
+ Client.instance.get("appPricePoints", params)
317
+ end
304
318
 
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
319
+ #
320
+ # appReviewAttachments
321
+ #
322
+
323
+ def post_app_store_review_attachment(app_store_review_detail_id: nil, attributes: {})
324
+ body = {
325
+ data: {
326
+ type: "appStoreReviewAttachments",
327
+ attributes: attributes,
328
+ relationships: {
329
+ appStoreReviewDetail: {
330
+ data: {
331
+ type: "appStoreReviewDetails",
332
+ id: app_store_review_detail_id
333
+ }
315
334
  }
316
335
  }
317
336
  }
318
337
  }
319
- }
320
338
 
321
- Client.instance.post("appStoreReviewAttachments", body)
322
- end
339
+ tunes_request_client.post("appStoreReviewAttachments", body)
340
+ end
323
341
 
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
342
+ def patch_app_store_review_attachment(app_store_review_attachment_id: nil, attributes: {})
343
+ body = {
344
+ data: {
345
+ type: "appStoreReviewAttachments",
346
+ id: app_store_review_attachment_id,
347
+ attributes: attributes
348
+ }
330
349
  }
331
- }
332
350
 
333
- Client.instance.patch("appStoreReviewAttachments/#{app_store_review_attachment_id}", body)
334
- end
351
+ tunes_request_client.patch("appStoreReviewAttachments/#{app_store_review_attachment_id}", body)
352
+ end
335
353
 
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
354
+ def delete_app_store_review_attachment(app_store_review_attachment_id: nil)
355
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
356
+ tunes_request_client.delete("appStoreReviewAttachments/#{app_store_review_attachment_id}", params)
357
+ end
340
358
 
341
- #
342
- # appScreenshotSets
343
- #
359
+ #
360
+ # appScreenshotSets
361
+ #
344
362
 
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
363
+ def get_app_screenshot_sets(filter: {}, includes: nil, limit: nil, sort: nil)
364
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
365
+ tunes_request_client.get("appScreenshotSets", params)
366
+ end
349
367
 
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
368
+ def get_app_screenshot_set(app_screenshot_set_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
369
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
370
+ tunes_request_client.get("appScreenshotSets/#{app_screenshot_set_id}", params)
371
+ end
354
372
 
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
373
+ def post_app_screenshot_set(app_store_version_localization_id: nil, attributes: {})
374
+ body = {
375
+ data: {
376
+ type: "appScreenshotSets",
377
+ attributes: attributes,
378
+ relationships: {
379
+ appStoreVersionLocalization: {
380
+ data: {
381
+ type: "appStoreVersionLocalizations",
382
+ id: app_store_version_localization_id
383
+ }
365
384
  }
366
385
  }
367
386
  }
368
387
  }
369
- }
370
388
 
371
- Client.instance.post("appScreenshotSets", body)
372
- end
389
+ tunes_request_client.post("appScreenshotSets", body)
390
+ end
373
391
 
374
- def patch_app_screenshot_set_screenshots(app_screenshot_set_id: nil, app_screenshot_ids: nil)
375
- app_screenshot_ids ||= []
392
+ def patch_app_screenshot_set_screenshots(app_screenshot_set_id: nil, app_screenshot_ids: nil)
393
+ app_screenshot_ids ||= []
376
394
 
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
- }
395
+ body = {
396
+ data: app_screenshot_ids.map do |app_screenshot_id|
397
+ {
398
+ type: "appScreenshots",
399
+ id: app_screenshot_id
400
+ }
401
+ end
402
+ }
385
403
 
386
- Client.instance.patch("appScreenshotSets/#{app_screenshot_set_id}/relationships/appScreenshots", body)
387
- end
404
+ tunes_request_client.patch("appScreenshotSets/#{app_screenshot_set_id}/relationships/appScreenshots", body)
405
+ end
388
406
 
389
- #
390
- # appScreenshots
391
- #
407
+ #
408
+ # appScreenshots
409
+ #
392
410
 
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
411
+ def get_app_screenshot(app_screenshot_id: nil)
412
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
413
+ tunes_request_client.get("appScreenshots/#{app_screenshot_id}", params)
414
+ end
397
415
 
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
416
+ def post_app_screenshot(app_screenshot_set_id: nil, attributes: {})
417
+ body = {
418
+ data: {
419
+ type: "appScreenshots",
420
+ attributes: attributes,
421
+ relationships: {
422
+ appScreenshotSet: {
423
+ data: {
424
+ type: "appScreenshotSets",
425
+ id: app_screenshot_set_id
426
+ }
408
427
  }
409
428
  }
410
429
  }
411
430
  }
412
- }
413
431
 
414
- Client.instance.post("appScreenshots", body, tries: 1)
415
- end
432
+ tunes_request_client.post("appScreenshots", body, tries: 1)
433
+ end
416
434
 
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
435
+ def patch_app_screenshot(app_screenshot_id: nil, attributes: {})
436
+ body = {
437
+ data: {
438
+ type: "appScreenshots",
439
+ id: app_screenshot_id,
440
+ attributes: attributes
441
+ }
423
442
  }
424
- }
425
443
 
426
- Client.instance.patch("appScreenshots/#{app_screenshot_id}", body)
427
- end
444
+ tunes_request_client.patch("appScreenshots/#{app_screenshot_id}", body)
445
+ end
428
446
 
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
447
+ def delete_app_screenshot(app_screenshot_id: nil)
448
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
449
+ tunes_request_client.delete("appScreenshots/#{app_screenshot_id}", params)
450
+ end
433
451
 
434
- #
435
- # appInfos
436
- #
452
+ #
453
+ # appInfos
454
+ #
437
455
 
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
456
+ def get_app_infos(filter: {}, includes: nil, limit: nil, sort: nil)
457
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
458
+ tunes_request_client.get("appInfos", params)
459
+ end
442
460
 
443
- def patch_app_info(app_info_id: nil, attributes: {})
444
- attributes ||= {}
461
+ def patch_app_info(app_info_id: nil, attributes: {})
462
+ attributes ||= {}
445
463
 
446
- data = {
447
- type: "appInfos",
448
- id: app_info_id
449
- }
450
- data[:attributes] = attributes unless attributes.empty?
464
+ data = {
465
+ type: "appInfos",
466
+ id: app_info_id
467
+ }
468
+ data[:attributes] = attributes unless attributes.empty?
451
469
 
452
- body = {
453
- data: data
454
- }
470
+ body = {
471
+ data: data
472
+ }
455
473
 
456
- Client.instance.patch("appInfos/#{app_info_id}", body)
457
- end
474
+ tunes_request_client.patch("appInfos/#{app_info_id}", body)
475
+ end
458
476
 
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]
477
+ #
478
+ # Adding the key will create/update (if value) or delete if nil
479
+ # Not including a key will leave as is
480
+ # category_id_map: {
481
+ # primary_category_id: "GAMES",
482
+ # primary_subcategory_one_id: "PUZZLE",
483
+ # primary_subcategory_two_id: "STRATEGY",
484
+ # secondary_category_id: nil,
485
+ # secondary_subcategory_one_id: nil,
486
+ # secondary_subcategory_two_id: nil
487
+ # }
488
+ #
489
+ def patch_app_info_categories(app_info_id: nil, category_id_map: nil)
490
+ category_id_map ||= {}
491
+ primary_category_id = category_id_map[:primary_category_id]
492
+ primary_subcategory_one_id = category_id_map[:primary_subcategory_one_id]
493
+ primary_subcategory_two_id = category_id_map[:primary_subcategory_two_id]
494
+ secondary_category_id = category_id_map[:secondary_category_id]
495
+ secondary_subcategory_one_id = category_id_map[:secondary_subcategory_one_id]
496
+ secondary_subcategory_two_id = category_id_map[:secondary_subcategory_two_id]
497
+
498
+ relationships = {}
499
+
500
+ # Only update if key is included (otherwise category will be removed)
501
+ if category_id_map.include?(:primary_category_id)
502
+ relationships[:primaryCategory] = {
503
+ data: primary_category_id ? { type: "appCategories", id: primary_category_id } : nil
504
+ }
505
+ end
479
506
 
480
- relationships = {}
507
+ # Only update if key is included (otherwise category will be removed)
508
+ if category_id_map.include?(:primary_subcategory_one_id)
509
+ relationships[:primarySubcategoryOne] = {
510
+ data: primary_subcategory_one_id ? { type: "appCategories", id: primary_subcategory_one_id } : nil
511
+ }
512
+ end
481
513
 
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
514
+ # Only update if key is included (otherwise category will be removed)
515
+ if category_id_map.include?(:primary_subcategory_two_id)
516
+ relationships[:primarySubcategoryTwo] = {
517
+ data: primary_subcategory_two_id ? { type: "appCategories", id: primary_subcategory_two_id } : nil
518
+ }
519
+ end
488
520
 
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
521
+ # Only update if key is included (otherwise category will be removed)
522
+ if category_id_map.include?(:secondary_category_id)
523
+ relationships[:secondaryCategory] = {
524
+ data: secondary_category_id ? { type: "appCategories", id: secondary_category_id } : nil
525
+ }
526
+ end
495
527
 
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
528
+ # Only update if key is included (otherwise category will be removed)
529
+ if category_id_map.include?(:secondary_subcategory_one_id)
530
+ relationships[:secondarySubcategoryOne] = {
531
+ data: secondary_subcategory_one_id ? { type: "appCategories", id: secondary_subcategory_one_id } : nil
532
+ }
533
+ end
502
534
 
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
535
+ # Only update if key is included (otherwise category will be removed)
536
+ if category_id_map.include?(:secondary_subcategory_two_id)
537
+ relationships[:secondarySubcategoryTwo] = {
538
+ data: secondary_subcategory_two_id ? { type: "appCategories", id: secondary_subcategory_two_id } : nil
539
+ }
540
+ end
509
541
 
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
542
+ data = {
543
+ type: "appInfos",
544
+ id: app_info_id
514
545
  }
515
- end
546
+ data[:relationships] = relationships unless relationships.empty?
516
547
 
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
548
+ body = {
549
+ data: data
521
550
  }
522
- end
523
-
524
- data = {
525
- type: "appInfos",
526
- id: app_info_id
527
- }
528
- data[:relationships] = relationships unless relationships.empty?
529
551
 
530
- body = {
531
- data: data
532
- }
533
-
534
- Client.instance.patch("appInfos/#{app_info_id}", body)
535
- end
552
+ tunes_request_client.patch("appInfos/#{app_info_id}", body)
553
+ end
536
554
 
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
555
+ def delete_app_info(app_info_id: nil)
556
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
557
+ tunes_request_client.delete("appInfos/#{app_info_id}", params)
558
+ end
541
559
 
542
- #
543
- # appInfoLocalizations
544
- #
560
+ #
561
+ # appInfoLocalizations
562
+ #
545
563
 
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
564
+ def get_app_info_localizations(app_info_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
565
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
566
+ tunes_request_client.get("appInfos/#{app_info_id}/appInfoLocalizations", params)
567
+ end
550
568
 
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
569
+ def post_app_info_localization(app_info_id: nil, attributes: {})
570
+ body = {
571
+ data: {
572
+ type: "appInfoLocalizations",
573
+ attributes: attributes,
574
+ relationships: {
575
+ appStoreVersion: {
576
+ data: {
577
+ type: "appStoreVersions",
578
+ id: app_info_id
579
+ }
561
580
  }
562
581
  }
563
582
  }
564
583
  }
565
- }
566
584
 
567
- Client.instance.post("appInfoLocalizations", body)
568
- end
585
+ tunes_request_client.post("appInfoLocalizations", body)
586
+ end
569
587
 
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
588
+ def patch_app_info_localization(app_info_localization_id: nil, attributes: {})
589
+ body = {
590
+ data: {
591
+ type: "appInfoLocalizations",
592
+ id: app_info_localization_id,
593
+ attributes: attributes
594
+ }
576
595
  }
577
- }
578
596
 
579
- Client.instance.patch("appInfoLocalizations/#{app_info_localization_id}", body)
580
- end
597
+ tunes_request_client.patch("appInfoLocalizations/#{app_info_localization_id}", body)
598
+ end
581
599
 
582
- #
583
- # appStoreReviewDetails
584
- #
600
+ #
601
+ # appStoreReviewDetails
602
+ #
585
603
 
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
604
+ def get_app_store_review_detail(app_store_version_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
605
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
606
+ tunes_request_client.get("appStoreVersions/#{app_store_version_id}/appStoreReviewDetail", params)
607
+ end
590
608
 
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
609
+ def post_app_store_review_detail(app_store_version_id: nil, attributes: {})
610
+ body = {
611
+ data: {
612
+ type: "appStoreReviewDetails",
613
+ attributes: attributes,
614
+ relationships: {
615
+ appStoreVersion: {
616
+ data: {
617
+ type: "appStoreVersions",
618
+ id: app_store_version_id
619
+ }
601
620
  }
602
621
  }
603
622
  }
604
623
  }
605
- }
606
624
 
607
- Client.instance.post("appStoreReviewDetails", body)
608
- end
625
+ tunes_request_client.post("appStoreReviewDetails", body)
626
+ end
609
627
 
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
628
+ def patch_app_store_review_detail(app_store_review_detail_id: nil, attributes: {})
629
+ body = {
630
+ data: {
631
+ type: "appStoreReviewDetails",
632
+ id: app_store_review_detail_id,
633
+ attributes: attributes
634
+ }
616
635
  }
617
- }
618
636
 
619
- Client.instance.patch("appStoreReviewDetails/#{app_store_review_detail_id}", body)
620
- end
637
+ tunes_request_client.patch("appStoreReviewDetails/#{app_store_review_detail_id}", body)
638
+ end
621
639
 
622
- #
623
- # appStoreVersionLocalizations
624
- #
640
+ #
641
+ # appStoreVersionLocalizations
642
+ #
625
643
 
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
644
+ def get_app_store_version_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
645
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
646
+ tunes_request_client.get("appStoreVersionLocalizations", params)
647
+ end
630
648
 
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
649
+ def post_app_store_version_localization(app_store_version_id: nil, attributes: {})
650
+ body = {
651
+ data: {
652
+ type: "appStoreVersionLocalizations",
653
+ attributes: attributes,
654
+ relationships: {
655
+ appStoreVersion: {
656
+ data: {
657
+ type: "appStoreVersions",
658
+ id: app_store_version_id
659
+ }
641
660
  }
642
661
  }
643
662
  }
644
663
  }
645
- }
646
664
 
647
- Client.instance.post("appStoreVersionLocalizations", body)
648
- end
665
+ tunes_request_client.post("appStoreVersionLocalizations", body)
666
+ end
649
667
 
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
668
+ def patch_app_store_version_localization(app_store_version_localization_id: nil, attributes: {})
669
+ body = {
670
+ data: {
671
+ type: "appStoreVersionLocalizations",
672
+ id: app_store_version_localization_id,
673
+ attributes: attributes
674
+ }
656
675
  }
657
- }
658
676
 
659
- Client.instance.patch("appStoreVersionLocalizations/#{app_store_version_localization_id}", body)
660
- end
677
+ tunes_request_client.patch("appStoreVersionLocalizations/#{app_store_version_localization_id}", body)
678
+ end
661
679
 
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
680
+ def delete_app_store_version_localization(app_store_version_localization_id: nil)
681
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
682
+ tunes_request_client.delete("appStoreVersionLocalizations/#{app_store_version_localization_id}", params)
683
+ end
666
684
 
667
- #
668
- # appStoreVersionPhasedReleases
669
- #
685
+ #
686
+ # appStoreVersionPhasedReleases
687
+ #
670
688
 
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
689
+ def get_app_store_version_phased_release(app_store_version_id: nil)
690
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
691
+ tunes_request_client.get("appStoreVersions/#{app_store_version_id}/appStoreVersionPhasedRelease", params)
692
+ end
675
693
 
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
694
+ def post_app_store_version_phased_release(app_store_version_id: nil, attributes: {})
695
+ body = {
696
+ data: {
697
+ type: "appStoreVersionPhasedReleases",
698
+ attributes: attributes,
699
+ relationships: {
700
+ appStoreVersion: {
701
+ data: {
702
+ type: "appStoreVersions",
703
+ id: app_store_version_id
704
+ }
686
705
  }
687
706
  }
688
707
  }
689
708
  }
690
- }
691
709
 
692
- Client.instance.post("appStoreVersionPhasedReleases", body)
693
- end
710
+ tunes_request_client.post("appStoreVersionPhasedReleases", body)
711
+ end
694
712
 
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
713
+ def delete_app_store_version_phased_release(app_store_version_phased_release_id: nil)
714
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
715
+ tunes_request_client.delete("appStoreVersionPhasedReleases/#{app_store_version_phased_release_id}", params)
716
+ end
699
717
 
700
- #
701
- # appStoreVersions
702
- #
718
+ #
719
+ # appStoreVersions
720
+ #
703
721
 
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
722
+ def get_app_store_versions(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
723
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
724
+ tunes_request_client.get("apps/#{app_id}/appStoreVersions", params)
725
+ end
708
726
 
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
727
+ def get_app_store_version(app_store_version_id: nil, includes: nil)
728
+ params = tunes_request_client.build_params(filter: nil, includes: includes, limit: nil, sort: nil)
729
+ tunes_request_client.get("appStoreVersions/#{app_store_version_id}", params)
730
+ end
713
731
 
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
732
+ def post_app_store_version(app_id: nil, attributes: {})
733
+ body = {
734
+ data: {
735
+ type: "appStoreVersions",
736
+ attributes: attributes,
737
+ relationships: {
738
+ app: {
739
+ data: {
740
+ type: "apps",
741
+ id: app_id
742
+ }
724
743
  }
725
744
  }
726
745
  }
727
746
  }
728
- }
729
747
 
730
- Client.instance.post("appStoreVersions", body)
731
- end
748
+ tunes_request_client.post("appStoreVersions", body)
749
+ end
732
750
 
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
751
+ def patch_app_store_version(app_store_version_id: nil, attributes: {})
752
+ body = {
753
+ data: {
754
+ type: "appStoreVersions",
755
+ id: app_store_version_id,
756
+ attributes: attributes
757
+ }
739
758
  }
740
- }
741
759
 
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
- }
760
+ tunes_request_client.patch("appStoreVersions/#{app_store_version_id}", body)
752
761
  end
753
762
 
754
- body = {
755
- data: {
756
- type: "appStoreVersions",
757
- id: app_store_version_id,
758
- relationships: {
759
- build: {
760
- data: data
763
+ def patch_app_store_version_with_build(app_store_version_id: nil, build_id: nil)
764
+ data = nil
765
+ if build_id
766
+ data = {
767
+ type: "builds",
768
+ id: build_id
769
+ }
770
+ end
771
+
772
+ body = {
773
+ data: {
774
+ type: "appStoreVersions",
775
+ id: app_store_version_id,
776
+ relationships: {
777
+ build: {
778
+ data: data
779
+ }
761
780
  }
762
781
  }
763
782
  }
764
- }
765
783
 
766
- Client.instance.patch("appStoreVersions/#{app_store_version_id}", body)
767
- end
784
+ tunes_request_client.patch("appStoreVersions/#{app_store_version_id}", body)
785
+ end
768
786
 
769
- #
770
- # appStoreVersionPhasedReleases
771
- #
787
+ #
788
+ # appStoreVersionPhasedReleases
789
+ #
772
790
 
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
791
+ def get_reset_ratings_request(app_store_version_id: nil)
792
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
793
+ tunes_request_client.get("appStoreVersions/#{app_store_version_id}/resetRatingsRequest", params)
794
+ end
777
795
 
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
796
+ def post_reset_ratings_request(app_store_version_id: nil)
797
+ body = {
798
+ data: {
799
+ type: "resetRatingsRequests",
800
+ relationships: {
801
+ appStoreVersion: {
802
+ data: {
803
+ type: "appStoreVersions",
804
+ id: app_store_version_id
805
+ }
787
806
  }
788
807
  }
789
808
  }
790
809
  }
791
- }
792
810
 
793
- Client.instance.post("resetRatingsRequests", body)
794
- end
811
+ tunes_request_client.post("resetRatingsRequests", body)
812
+ end
795
813
 
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
814
+ def delete_reset_ratings_request(reset_ratings_request_id: nil)
815
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
816
+ tunes_request_client.delete("resetRatingsRequests/#{reset_ratings_request_id}", params)
817
+ end
800
818
 
801
- #
802
- # appStoreVersionSubmissions
803
- #
819
+ #
820
+ # appStoreVersionSubmissions
821
+ #
804
822
 
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
823
+ def get_app_store_version_submission(app_store_version_id: nil)
824
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
825
+ tunes_request_client.get("appStoreVersions/#{app_store_version_id}/appStoreVersionSubmission", params)
826
+ end
809
827
 
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
828
+ def post_app_store_version_submission(app_store_version_id: nil)
829
+ body = {
830
+ data: {
831
+ type: "appStoreVersionSubmissions",
832
+ relationships: {
833
+ appStoreVersion: {
834
+ data: {
835
+ type: "appStoreVersions",
836
+ id: app_store_version_id
837
+ }
819
838
  }
820
839
  }
821
840
  }
822
841
  }
823
- }
824
-
825
- Client.instance.post("appStoreVersionSubmissions", body)
826
- end
827
842
 
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
843
+ tunes_request_client.post("appStoreVersionSubmissions", body)
844
+ end
832
845
 
833
- #
834
- # appStoreVersionReleaseRequests
835
- #
846
+ def delete_app_store_version_submission(app_store_version_submission_id: nil)
847
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
848
+ tunes_request_client.delete("appStoreVersionSubmissions/#{app_store_version_submission_id}", params)
849
+ end
836
850
 
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
- }
851
+ #
852
+ # appStoreVersionReleaseRequests
853
+ #
854
+
855
+ def post_app_store_version_release_request(app_store_version_id: nil)
856
+ body = {
857
+ data: {
858
+ type: "appStoreVersionReleaseRequests",
859
+ relationships: {
860
+ appStoreVersion: {
861
+ data: {
862
+ type: "appStoreVersions",
863
+ id: app_store_version_id
864
+ }
865
+ }
866
+ }
867
+ }
868
+ }
851
869
 
852
- Client.instance.post("appStoreVersionReleaseRequests", body)
853
- end
870
+ tunes_request_client.post("appStoreVersionReleaseRequests", body)
871
+ end
854
872
 
855
- #
856
- # idfaDeclarations
857
- #
873
+ #
874
+ # idfaDeclarations
875
+ #
858
876
 
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
877
+ def get_idfa_declaration(app_store_version_id: nil)
878
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
879
+ tunes_request_client.get("appStoreVersions/#{app_store_version_id}/idfaDeclaration", params)
880
+ end
863
881
 
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
882
+ def post_idfa_declaration(app_store_version_id: nil, attributes: nil)
883
+ body = {
884
+ data: {
885
+ type: "idfaDeclarations",
886
+ attributes: attributes,
887
+ relationships: {
888
+ appStoreVersion: {
889
+ data: {
890
+ type: "appStoreVersions",
891
+ id: app_store_version_id
892
+ }
874
893
  }
875
894
  }
876
895
  }
877
896
  }
878
- }
879
897
 
880
- Client.instance.post("idfaDeclarations", body)
881
- end
898
+ tunes_request_client.post("idfaDeclarations", body)
899
+ end
882
900
 
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
901
+ def patch_idfa_declaration(idfa_declaration_id: nil, attributes: nil)
902
+ body = {
903
+ data: {
904
+ type: "idfaDeclarations",
905
+ id: idfa_declaration_id,
906
+ attributes: attributes
907
+ }
889
908
  }
890
- }
891
909
 
892
- Client.instance.patch("idfaDeclarations/#{idfa_declaration_id}", body)
893
- end
910
+ tunes_request_client.patch("idfaDeclarations/#{idfa_declaration_id}", body)
911
+ end
894
912
 
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
913
+ def delete_idfa_declaration(idfa_declaration_id: nil)
914
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
915
+ tunes_request_client.delete("idfaDeclarations/#{idfa_declaration_id}", params)
916
+ end
899
917
 
900
- #
901
- # sandboxTesters
902
- #
918
+ #
919
+ # sandboxTesters
920
+ #
903
921
 
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
922
+ def get_sandbox_testers(filter: nil, includes: nil, limit: nil, sort: nil)
923
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
924
+ tunes_request_client.get("sandboxTesters", params)
925
+ end
908
926
 
909
- def post_sandbox_tester(attributes: {})
910
- body = {
911
- data: {
912
- type: "sandboxTesters",
913
- attributes: attributes
927
+ def post_sandbox_tester(attributes: {})
928
+ body = {
929
+ data: {
930
+ type: "sandboxTesters",
931
+ attributes: attributes
932
+ }
914
933
  }
915
- }
916
934
 
917
- Client.instance.post("sandboxTesters", body)
918
- end
935
+ tunes_request_client.post("sandboxTesters", body)
936
+ end
919
937
 
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
938
+ def delete_sandbox_tester(sandbox_tester_id: nil)
939
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
940
+ tunes_request_client.delete("sandboxTesters/#{sandbox_tester_id}", params)
941
+ end
924
942
 
925
- #
926
- # territories
927
- #
943
+ #
944
+ # territories
945
+ #
928
946
 
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)
947
+ def get_territories(filter: {}, includes: nil, limit: nil, sort: nil)
948
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
949
+ tunes_request_client.get("territories", params)
950
+ end
932
951
  end
933
952
  end
934
953
  end