app_store_connect 0.37.0 → 0.38.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +12 -0
  3. data/CHANGELOG.md +40 -0
  4. data/Gemfile.lock +42 -33
  5. data/README.md +55 -44
  6. data/app_store_connect.gemspec +6 -3
  7. data/bin/console +3 -8
  8. data/lib/app_store_connect/app_store_version_build_linkage_request.rb +1 -3
  9. data/lib/app_store_connect/app_store_version_create_request.rb +1 -3
  10. data/lib/app_store_connect/app_store_version_phased_release_create_request.rb +1 -3
  11. data/lib/app_store_connect/app_store_version_phased_release_update_request.rb +1 -3
  12. data/lib/app_store_connect/app_store_version_release_request_create_request.rb +1 -3
  13. data/lib/app_store_connect/app_store_version_update_request.rb +1 -3
  14. data/lib/app_store_connect/base.rb +83 -0
  15. data/lib/app_store_connect/beta_build_localization_create_request.rb +1 -3
  16. data/lib/app_store_connect/beta_build_localization_modify_request.rb +2 -3
  17. data/lib/app_store_connect/build_update_request.rb +1 -3
  18. data/lib/app_store_connect/bundle_id_capability_create_request.rb +1 -3
  19. data/lib/app_store_connect/bundle_id_create_request.rb +1 -3
  20. data/lib/app_store_connect/certificate_create_request.rb +1 -3
  21. data/lib/app_store_connect/client/builder.rb +91 -0
  22. data/lib/app_store_connect/client.rb +45 -71
  23. data/lib/app_store_connect/device_create_request.rb +1 -3
  24. data/lib/app_store_connect/object/data.rb +19 -7
  25. data/lib/app_store_connect/object/data_type.rb +23 -0
  26. data/lib/app_store_connect/object/included.rb +27 -0
  27. data/lib/app_store_connect/profile_create_request.rb +1 -3
  28. data/lib/app_store_connect/request/body.rb +26 -0
  29. data/lib/app_store_connect/request/builder/create.rb +69 -0
  30. data/lib/app_store_connect/request.rb +2 -2
  31. data/lib/app_store_connect/requests/delete_with_body.rb +11 -0
  32. data/lib/app_store_connect/requests/v1/app_store_version_localization/create.rb +25 -0
  33. data/lib/app_store_connect/requests/v1/app_store_version_localization/update.rb +25 -0
  34. data/lib/app_store_connect/requests/v1/beta_app_review_submission/create.rb +15 -0
  35. data/lib/app_store_connect/requests/v1/build_beta_detail/update.rb +20 -0
  36. data/lib/app_store_connect/requests/v1/build_beta_groups/create.rb +16 -0
  37. data/lib/app_store_connect/requests/v1/build_beta_groups/delete.rb +16 -0
  38. data/lib/app_store_connect/requests/v1/in_app_purchase_localization/create.rb +1 -3
  39. data/lib/app_store_connect/requests/v1/in_app_purchase_localization/update.rb +1 -3
  40. data/lib/app_store_connect/requests/v1/in_app_purchase_price_schedule/create.rb +1 -3
  41. data/lib/app_store_connect/requests/v1/in_app_purchase_review_screenshot/create.rb +1 -3
  42. data/lib/app_store_connect/requests/v1/in_app_purchase_review_screenshot/update.rb +21 -0
  43. data/lib/app_store_connect/requests/v1/in_app_purchase_submission/create.rb +1 -3
  44. data/lib/app_store_connect/requests/v2/in_app_purchase/create.rb +1 -3
  45. data/lib/app_store_connect/requests/v2/in_app_purchase/update.rb +1 -3
  46. data/lib/app_store_connect/review_submission_create_request.rb +1 -3
  47. data/lib/app_store_connect/review_submission_item_create_request.rb +1 -3
  48. data/lib/app_store_connect/review_submission_update_request.rb +1 -3
  49. data/lib/app_store_connect/specification/component/schema.rb +25 -0
  50. data/lib/app_store_connect/specification.rb +54 -0
  51. data/lib/app_store_connect/user_invitation_create_request.rb +1 -3
  52. data/lib/app_store_connect/version.rb +1 -1
  53. data/lib/app_store_connect.rb +4 -32
  54. data/lib/config/schema.json +54 -23
  55. metadata +67 -10
  56. data/lib/app_store_connect/create_request.rb +0 -14
  57. data/lib/app_store_connect/modify_request.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c2de00dda29abd9da8b87ce52e8f8e6eacf387d9607c29c8f03a390707b8f27
4
- data.tar.gz: eb9072553b8f34d7729610ebade2ffdd123f3100e8253f854428f54751bf7c71
3
+ metadata.gz: 257871e156a1619ec0a6be8c6e699cc000e8b8d532440da7157f38b49a3bbd7c
4
+ data.tar.gz: ca0eaa4aaac0a28f0b0ba4e22dcc262d456101bbb7b26fb3f40b95ec46bc1f18
5
5
  SHA512:
6
- metadata.gz: 0fce51dd37645410baa0124ae6e841222ee0cd81b6568f6973dbb27c7a2a9b44a68aae04eba7c51d500d288e7863d96e6e911e4a940e15515fbff9a8ea2be18d
7
- data.tar.gz: 8d7121973eafead5f0bbc1dae7c7a7177716312bfdefbe2189513c4b4f0ab69425dcc54027f8cda401239aac0bdd53a7cfa58fa1d9984dd7ddc0e30bffd19985
6
+ metadata.gz: 44beed8e0e283ee0bb341fc003e94afefd5ea1b0c551221af28f1f8afc90665fde5be8ddf471192f5b54632691f22d25d67df25997bd1df1bc24ec066a8f7c22
7
+ data.tar.gz: e28552d38359300aa6081265b542b828aef5ac06d5f73a8a58d6bf08cb4dc7622fb2c0b1a1d647bc63e776bbc60baeae6eafb1de950176b7b12175a35d7a6968
@@ -0,0 +1,12 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: bundler
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "weekly"
12
+
data/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.38.0](https://github.com/kyledecot/app_store_connect/tree/v0.38.0) (2023-05-02)
4
+
5
+ [Full Changelog](https://github.com/kyledecot/app_store_connect/compare/v0.37.0...v0.38.0)
6
+
7
+ **Closed issues:**
8
+
9
+ - execution expired \(Net::OpenTimeout\) [\#128](https://github.com/kyledecot/app_store_connect/issues/128)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Bump zeitwerk from 2.6.7 to 2.6.8 [\#166](https://github.com/kyledecot/app_store_connect/pull/166) ([dependabot[bot]](https://github.com/apps/dependabot))
14
+ - Bump rubocop from 1.50.1 to 1.50.2 [\#165](https://github.com/kyledecot/app_store_connect/pull/165) ([dependabot[bot]](https://github.com/apps/dependabot))
15
+ - Add ability to add or remove access for beta groups to a build [\#164](https://github.com/kyledecot/app_store_connect/pull/164) ([zormandi](https://github.com/zormandi))
16
+ - Update rubocop requirement from ~\> 1.49.0 to ~\> 1.50.1 [\#163](https://github.com/kyledecot/app_store_connect/pull/163) ([dependabot[bot]](https://github.com/apps/dependabot))
17
+ - Update rubocop requirement from ~\> 1.48.0 to ~\> 1.49.0 [\#162](https://github.com/kyledecot/app_store_connect/pull/162) ([dependabot[bot]](https://github.com/apps/dependabot))
18
+ - Update deprecated app price points endpoint [\#161](https://github.com/kyledecot/app_store_connect/pull/161) ([tmarkanov](https://github.com/tmarkanov))
19
+ - Bump rubocop from 1.48.0 to 1.48.1 [\#160](https://github.com/kyledecot/app_store_connect/pull/160) ([dependabot[bot]](https://github.com/apps/dependabot))
20
+ - Bump activesupport from 7.0.4.2 to 7.0.4.3 [\#159](https://github.com/kyledecot/app_store_connect/pull/159) ([dependabot[bot]](https://github.com/apps/dependabot))
21
+ - Update rubocop requirement from ~\> 1.47.0 to ~\> 1.48.0 [\#157](https://github.com/kyledecot/app_store_connect/pull/157) ([dependabot[bot]](https://github.com/apps/dependabot))
22
+ - Fix bug in BetaBuildLocalizationModifyRequest [\#156](https://github.com/kyledecot/app_store_connect/pull/156) ([zormandi](https://github.com/zormandi))
23
+ - Update rubocop requirement from ~\> 1.46.0 to ~\> 1.47.0 [\#155](https://github.com/kyledecot/app_store_connect/pull/155) ([dependabot[bot]](https://github.com/apps/dependabot))
24
+ - Update rubocop requirement from ~\> 1.45.1 to ~\> 1.46.0 [\#153](https://github.com/kyledecot/app_store_connect/pull/153) ([dependabot[bot]](https://github.com/apps/dependabot))
25
+ - Add Spec for Request Body [\#152](https://github.com/kyledecot/app_store_connect/pull/152) ([kyledecot](https://github.com/kyledecot))
26
+ - Add Spec for Object::Properties [\#151](https://github.com/kyledecot/app_store_connect/pull/151) ([kyledecot](https://github.com/kyledecot))
27
+ - Add App Store Version Localization management capability [\#150](https://github.com/kyledecot/app_store_connect/pull/150) ([zormandi](https://github.com/zormandi))
28
+ - Commit In-App Purchase Review Screenshot [\#149](https://github.com/kyledecot/app_store_connect/pull/149) ([gregg-platogo](https://github.com/gregg-platogo))
29
+ - Add Client Builder [\#147](https://github.com/kyledecot/app_store_connect/pull/147) ([kyledecot](https://github.com/kyledecot))
30
+ - Add Request Body \(Create/Update\) [\#146](https://github.com/kyledecot/app_store_connect/pull/146) ([kyledecot](https://github.com/kyledecot))
31
+ - Use zeitwerk for autoloading [\#145](https://github.com/kyledecot/app_store_connect/pull/145) ([kyledecot](https://github.com/kyledecot))
32
+ - Ability to build create request from schema [\#144](https://github.com/kyledecot/app_store_connect/pull/144) ([kyledecot](https://github.com/kyledecot))
33
+ - Add ability to read/file specification [\#143](https://github.com/kyledecot/app_store_connect/pull/143) ([kyledecot](https://github.com/kyledecot))
34
+ - Add ability to download OpenAPI Specification [\#142](https://github.com/kyledecot/app_store_connect/pull/142) ([kyledecot](https://github.com/kyledecot))
35
+ - Add Create Request Builder [\#141](https://github.com/kyledecot/app_store_connect/pull/141) ([kyledecot](https://github.com/kyledecot))
36
+ - Update rubocop requirement from ~\> 1.36.0 to ~\> 1.45.1 [\#140](https://github.com/kyledecot/app_store_connect/pull/140) ([dependabot[bot]](https://github.com/apps/dependabot))
37
+ - Bump timecop from 0.9.5 to 0.9.6 [\#139](https://github.com/kyledecot/app_store_connect/pull/139) ([dependabot[bot]](https://github.com/apps/dependabot))
38
+ - Update simplecov requirement from ~\> 0.21.2 to ~\> 0.22.0 [\#138](https://github.com/kyledecot/app_store_connect/pull/138) ([dependabot[bot]](https://github.com/apps/dependabot))
39
+ - Update rspec requirement from ~\> 3.11.0 to ~\> 3.12.0 [\#137](https://github.com/kyledecot/app_store_connect/pull/137) ([dependabot[bot]](https://github.com/apps/dependabot))
40
+ - Bump pry from 0.14.1 to 0.14.2 [\#136](https://github.com/kyledecot/app_store_connect/pull/136) ([dependabot[bot]](https://github.com/apps/dependabot))
41
+ - Create Included Concern [\#135](https://github.com/kyledecot/app_store_connect/pull/135) ([kyledecot](https://github.com/kyledecot))
42
+
3
43
  ## [v0.37.0](https://github.com/kyledecot/app_store_connect/tree/v0.37.0) (2023-02-14)
4
44
 
5
45
  [Full Changelog](https://github.com/kyledecot/app_store_connect/compare/v0.36.0...v0.37.0)
data/Gemfile.lock CHANGED
@@ -1,14 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_store_connect (0.37.0)
4
+ app_store_connect (0.38.0)
5
5
  activesupport (>= 6.0.0)
6
6
  jwt (>= 1.4)
7
+ zeitwerk (>= 2.6.7)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
11
- activesupport (7.0.4.2)
12
+ activesupport (7.0.4.3)
12
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
14
  i18n (>= 1.6, < 2)
14
15
  minitest (>= 5.1)
@@ -35,14 +36,17 @@ GEM
35
36
  async
36
37
  async-pool (0.3.12)
37
38
  async (>= 1.25)
39
+ cgi (0.3.6)
38
40
  coderay (1.1.3)
39
- concurrent-ruby (1.2.0)
41
+ concurrent-ruby (1.2.2)
40
42
  console (1.16.2)
41
43
  fiber-local
42
44
  crack (0.4.5)
43
45
  rexml
44
46
  diff-lcs (1.5.0)
45
47
  docile (1.4.0)
48
+ erb (4.0.2)
49
+ cgi (>= 0.3.3)
46
50
  factory_bot (6.2.1)
47
51
  activesupport (>= 5.0.0)
48
52
  faraday (2.7.4)
@@ -80,14 +84,14 @@ GEM
80
84
  hashdiff (1.0.1)
81
85
  i18n (1.12.0)
82
86
  concurrent-ruby (~> 1.0)
83
- json (2.6.2)
87
+ json (2.6.3)
84
88
  jwt (2.7.0)
85
89
  listen (3.7.1)
86
90
  rb-fsevent (~> 0.10, >= 0.10.3)
87
91
  rb-inotify (~> 0.9, >= 0.9.10)
88
92
  lumberjack (1.2.8)
89
93
  method_source (1.0.0)
90
- minitest (5.17.0)
94
+ minitest (5.18.0)
91
95
  multi_json (1.15.0)
92
96
  nenv (0.3.0)
93
97
  nio4r (2.5.8)
@@ -97,8 +101,8 @@ GEM
97
101
  octokit (4.25.1)
98
102
  faraday (>= 1, < 3)
99
103
  sawyer (~> 0.9)
100
- parallel (1.22.1)
101
- parser (3.1.2.1)
104
+ parallel (1.23.0)
105
+ parser (3.2.2.0)
102
106
  ast (~> 2.4.1)
103
107
  protocol-hpack (1.4.2)
104
108
  protocol-http (0.24.0)
@@ -107,7 +111,7 @@ GEM
107
111
  protocol-http2 (0.15.0)
108
112
  protocol-hpack (~> 1.4)
109
113
  protocol-http (~> 0.18)
110
- pry (0.14.1)
114
+ pry (0.14.2)
111
115
  coderay (~> 1.1)
112
116
  method_source (~> 1.0)
113
117
  public_suffix (5.0.0)
@@ -116,75 +120,80 @@ GEM
116
120
  rb-fsevent (0.11.2)
117
121
  rb-inotify (0.10.1)
118
122
  ffi (~> 1.0)
119
- regexp_parser (2.5.0)
123
+ regexp_parser (2.8.0)
120
124
  rexml (3.2.5)
121
- rspec (3.11.0)
122
- rspec-core (~> 3.11.0)
123
- rspec-expectations (~> 3.11.0)
124
- rspec-mocks (~> 3.11.0)
125
- rspec-core (3.11.0)
126
- rspec-support (~> 3.11.0)
127
- rspec-expectations (3.11.1)
125
+ rspec (3.12.0)
126
+ rspec-core (~> 3.12.0)
127
+ rspec-expectations (~> 3.12.0)
128
+ rspec-mocks (~> 3.12.0)
129
+ rspec-core (3.12.1)
130
+ rspec-support (~> 3.12.0)
131
+ rspec-expectations (3.12.2)
128
132
  diff-lcs (>= 1.2.0, < 2.0)
129
- rspec-support (~> 3.11.0)
130
- rspec-mocks (3.11.1)
133
+ rspec-support (~> 3.12.0)
134
+ rspec-mocks (3.12.3)
131
135
  diff-lcs (>= 1.2.0, < 2.0)
132
- rspec-support (~> 3.11.0)
133
- rspec-support (3.11.1)
134
- rubocop (1.36.0)
136
+ rspec-support (~> 3.12.0)
137
+ rspec-support (3.12.0)
138
+ rubocop (1.50.2)
135
139
  json (~> 2.3)
136
140
  parallel (~> 1.10)
137
- parser (>= 3.1.2.1)
141
+ parser (>= 3.2.0.0)
138
142
  rainbow (>= 2.2.2, < 4.0)
139
143
  regexp_parser (>= 1.8, < 3.0)
140
144
  rexml (>= 3.2.5, < 4.0)
141
- rubocop-ast (>= 1.20.1, < 2.0)
145
+ rubocop-ast (>= 1.28.0, < 2.0)
142
146
  ruby-progressbar (~> 1.7)
143
- unicode-display_width (>= 1.4.0, < 3.0)
144
- rubocop-ast (1.21.0)
145
- parser (>= 3.1.1.0)
146
- ruby-progressbar (1.11.0)
147
+ unicode-display_width (>= 2.4.0, < 3.0)
148
+ rubocop-ast (1.28.0)
149
+ parser (>= 3.2.1.0)
150
+ ruby-progressbar (1.13.0)
147
151
  ruby2_keywords (0.0.5)
152
+ rubyzip (2.3.2)
148
153
  sawyer (0.9.2)
149
154
  addressable (>= 2.3.5)
150
155
  faraday (>= 0.17.3, < 3)
151
156
  semantic (1.6.1)
152
157
  shellany (0.0.1)
153
- simplecov (0.21.2)
158
+ simplecov (0.22.0)
154
159
  docile (~> 1.1)
155
160
  simplecov-html (~> 0.11)
156
161
  simplecov_json_formatter (~> 0.1)
157
162
  simplecov-html (0.12.3)
158
163
  simplecov_json_formatter (0.1.4)
159
164
  thor (1.2.1)
160
- timecop (0.9.5)
165
+ timecop (0.9.6)
161
166
  timers (4.3.5)
162
167
  traces (0.8.0)
163
168
  tzinfo (2.0.6)
164
169
  concurrent-ruby (~> 1.0)
165
- unicode-display_width (2.3.0)
170
+ unicode-display_width (2.4.2)
166
171
  webmock (3.18.1)
167
172
  addressable (>= 2.8.0)
168
173
  crack (>= 0.3.2)
169
174
  hashdiff (>= 0.4.0, < 2.0.0)
175
+ zeitwerk (2.6.8)
170
176
 
171
177
  PLATFORMS
172
178
  arm64-darwin-21
179
+ arm64-darwin-22
173
180
  x86_64-darwin-22
174
181
  x86_64-linux
175
182
 
176
183
  DEPENDENCIES
177
184
  app_store_connect!
178
185
  bundler
186
+ erb (~> 4.0.2)
179
187
  factory_bot (~> 6.2.1)
180
188
  github_changelog_generator (= 1.16.4)
181
189
  guard-rspec (~> 4.7.3)
182
190
  pry (~> 0.14.1)
183
191
  rake (~> 13.0.6)
184
- rspec (~> 3.11.0)
185
- rubocop (~> 1.36.0)
192
+ rspec (~> 3.12.0)
193
+ rubocop (~> 1.50.1)
194
+ rubyzip
186
195
  semantic (~> 1.6.1)
187
- simplecov (~> 0.21.2)
196
+ simplecov (~> 0.22.0)
188
197
  timecop (~> 0.9.5)
189
198
  webmock (~> 3.18.1)
190
199
 
data/README.md CHANGED
@@ -134,51 +134,62 @@ app_store_connect.create_review_submission_item(
134
134
  ### Create In-App Purchase Price Schedule
135
135
 
136
136
  ```ruby
137
+ app_store_connect.create_in_app_purchase_price_schedule(
138
+ relationships: {
139
+ manual_prices: {
140
+ data: [
141
+ {
142
+ type: 'inAppPurchasePrices',
143
+ id: '${price1}'
144
+ }
145
+ ]
146
+ },
147
+ in_app_purchase: {
148
+ data: {
149
+ type: 'inAppPurchases',
150
+ id: '<in-app-purchase-id>'
151
+ }
152
+ }
153
+ },
154
+ included: [
155
+ {
156
+ type: 'inAppPurchasePrices',
157
+ id: '${price1}',
158
+ attributes: {
159
+ startDate: nil
160
+ },
161
+ relationships: {
162
+ inAppPurchaseV2: {
163
+ data: {
164
+ type: 'inAppPurchases',
165
+ id: '<in-app-purchase-id>'
166
+ }
167
+ },
168
+ inAppPurchasePricePoint: {
169
+ data: {
170
+ type: 'inAppPurchasePricePoints',
171
+ id: '<price-point-id>'
172
+ }
173
+ }
174
+ }
175
+ }
176
+ ]
177
+ )
178
+ ```
179
+
180
+ ### Add or remove access for a Beta Group to a Build
181
+
182
+ ```ruby
183
+ app_store_connect.add_build_beta_groups(
184
+ id: '<build-id>',
185
+ data: [{id: '<beta-group-id>'}]
186
+ )
187
+
188
+ app_store_connect.delete_build_beta_groups(
189
+ id: '<build-id>',
190
+ data: [{id: '<beta-group-id>'}]
191
+ )
137
192
 
138
- app_store_connect.create_in_app_purchase_price_schedule(relationships: {
139
- manual_prices: {
140
- data: [
141
- {
142
- type: 'inAppPurchasePrices',
143
- id: '${price1}'
144
- }
145
- ]
146
- },
147
- in_app_purchase: {
148
- data: {
149
- type: 'inAppPurchases',
150
- id: '<in-app-purchase-id>'
151
- }
152
- }
153
- }, included: [
154
- {
155
- type: 'inAppPurchasePrices',
156
- id: '${price1}',
157
- attributes:
158
- {
159
- startDate: nil
160
- },
161
- relationships:
162
- {
163
- inAppPurchaseV2:
164
- {
165
- data:
166
- {
167
- type: 'inAppPurchases',
168
- id: '<in-app-purchase-id>'
169
- }
170
- },
171
- inAppPurchasePricePoint:
172
- {
173
- data:
174
- {
175
- type: 'inAppPurchasePricePoints',
176
- id: '<price-point-id>'
177
- }
178
- }
179
- }
180
- }
181
- ])
182
193
  ```
183
194
 
184
195
  ## FAQ
@@ -25,17 +25,20 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_runtime_dependency 'activesupport', '>= 6.0.0'
27
27
  spec.add_runtime_dependency 'jwt', '>= 1.4'
28
+ spec.add_runtime_dependency 'zeitwerk', '>= 2.6.7'
28
29
 
29
30
  spec.add_development_dependency 'bundler'
31
+ spec.add_development_dependency 'erb', '~> 4.0.2'
30
32
  spec.add_development_dependency 'factory_bot', '~> 6.2.1'
31
33
  spec.add_development_dependency 'github_changelog_generator', '1.16.4'
32
34
  spec.add_development_dependency 'guard-rspec', '~> 4.7.3'
33
35
  spec.add_development_dependency 'pry', '~> 0.14.1'
34
36
  spec.add_development_dependency 'rake', '~> 13.0.6'
35
- spec.add_development_dependency 'rspec', '~> 3.11.0'
36
- spec.add_development_dependency 'rubocop', '~> 1.36.0'
37
+ spec.add_development_dependency 'rspec', '~> 3.12.0'
38
+ spec.add_development_dependency 'rubocop', '~> 1.50.1'
39
+ spec.add_development_dependency 'rubyzip'
37
40
  spec.add_development_dependency 'semantic', '~> 1.6.1'
38
- spec.add_development_dependency 'simplecov', '~> 0.21.2'
41
+ spec.add_development_dependency 'simplecov', '~> 0.22.0'
39
42
  spec.add_development_dependency 'timecop', '~> 0.9.5'
40
43
  spec.add_development_dependency 'webmock', '~> 3.18.1'
41
44
  end
data/bin/console CHANGED
@@ -3,13 +3,8 @@
3
3
 
4
4
  require 'bundler/setup'
5
5
  require 'app_store_connect'
6
+ require 'rake'
6
7
 
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
8
+ load './lib/tasks/console.rake'
9
9
 
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require 'irb'
15
- IRB.start(__FILE__)
10
+ Rake::Task['console'].execute
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'app_store_connect/create_request'
4
-
5
3
  module AppStoreConnect
6
- class AppStoreVersionBuildLinkageRequest < CreateRequest
4
+ class AppStoreVersionBuildLinkageRequest < Request::Body
7
5
  data do
8
6
  id :build_id
9
7
  type 'builds'
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'app_store_connect/create_request'
4
-
5
3
  module AppStoreConnect
6
- class AppStoreVersionCreateRequest < CreateRequest
4
+ class AppStoreVersionCreateRequest < Request::Body
7
5
  data do
8
6
  type 'appStoreVersions'
9
7
 
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'app_store_connect/create_request'
4
-
5
3
  module AppStoreConnect
6
- class AppStoreVersionPhasedReleaseCreateRequest < CreateRequest
4
+ class AppStoreVersionPhasedReleaseCreateRequest < Request::Body
7
5
  data do
8
6
  type 'appStoreVersionPhasedReleases'
9
7
 
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'app_store_connect/create_request'
4
-
5
3
  module AppStoreConnect
6
- class AppStoreVersionPhasedReleaseUpdateRequest < CreateRequest
4
+ class AppStoreVersionPhasedReleaseUpdateRequest < Request::Body
7
5
  data do
8
6
  id
9
7
  type 'appStoreVersionPhasedReleases'
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'app_store_connect/create_request'
4
-
5
3
  module AppStoreConnect
6
- class AppStoreVersionReleaseRequestCreateRequest < CreateRequest
4
+ class AppStoreVersionReleaseRequestCreateRequest < Request::Body
7
5
  data do
8
6
  type 'appStoreVersionReleaseRequests'
9
7
  end
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'app_store_connect/create_request'
4
-
5
3
  module AppStoreConnect
6
- class AppStoreVersionUpdateRequest < CreateRequest
4
+ class AppStoreVersionUpdateRequest < Request::Body
7
5
  data do
8
6
  id
9
7
  type 'appStoreVersions'
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AppStoreConnect
4
+ class Base
5
+ def initialize(**kwargs)
6
+ @options = Client::Options.new(kwargs)
7
+ @authorization = Client::Authorization.new(@options.slice(*Client::Authorization::OPTIONS))
8
+ @registry = Client::Registry.new(@options.slice(*Client::Registry::OPTIONS))
9
+ end
10
+
11
+ def respond_to_missing?(method_name, include_private = false)
12
+ web_service_endpoint_aliases.include?(method_name) || super
13
+ end
14
+
15
+ def method_missing(method_name, **kwargs)
16
+ super unless web_service_endpoint_aliases.include?(method_name)
17
+
18
+ web_service_endpoint = web_service_endpoint_by(method_name)
19
+
20
+ call(web_service_endpoint, **kwargs)
21
+ end
22
+
23
+ # :nocov:
24
+ def inspect
25
+ "#<#{self.class.name}:#{object_id}>"
26
+ end
27
+ # :nocov:
28
+
29
+ def web_service_endpoint_aliases
30
+ @registry.keys
31
+ end
32
+
33
+ private
34
+
35
+ def call(web_service_endpoint, **kwargs)
36
+ raise "invalid http method: #{web_service_endpoint.http_method}" unless %i[get delete post patch].include?(web_service_endpoint.http_method)
37
+
38
+ request = build_request(web_service_endpoint, **kwargs)
39
+
40
+ response = request.execute
41
+
42
+ Client::Utils.decode(response.body, response.content_type) if response.body
43
+ end
44
+
45
+ def build_uri(web_service_endpoint, **kwargs)
46
+ URI(web_service_endpoint
47
+ .url
48
+ .gsub(/(\{(\w+)\})/) { kwargs.fetch(Regexp.last_match(2).to_sym) })
49
+ end
50
+
51
+ def web_service_endpoint_by(alias_sym)
52
+ @registry[alias_sym]
53
+ end
54
+
55
+ def http_body(web_service_endpoint, **kwargs)
56
+ Client::Utils.encode("AppStoreConnect::#{web_service_endpoint.http_body_type}"
57
+ .constantize
58
+ .new(**kwargs)
59
+ .to_h)
60
+ end
61
+
62
+ def build_request(web_service_endpoint, **kwargs)
63
+ options = {
64
+ kwargs: kwargs,
65
+ web_service_endpoint: web_service_endpoint,
66
+ http_method: web_service_endpoint.http_method,
67
+ uri: build_uri(web_service_endpoint, **kwargs),
68
+ headers: headers
69
+ }
70
+
71
+ options[:http_body] = http_body(web_service_endpoint, **kwargs) if web_service_endpoint.http_body_type.present?
72
+
73
+ Request.new(**options)
74
+ end
75
+
76
+ def headers
77
+ {
78
+ 'Authorization' => "Bearer #{@authorization.token}",
79
+ 'Content-Type' => 'application/json'
80
+ }
81
+ end
82
+ end
83
+ end
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'app_store_connect/create_request'
4
-
5
3
  module AppStoreConnect
6
- class BetaBuildLocalizationCreateRequest < CreateRequest
4
+ class BetaBuildLocalizationCreateRequest < Request::Body
7
5
  data do
8
6
  type 'betaBuildLocalizations'
9
7
 
@@ -1,10 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'app_store_connect/modify_request'
4
-
5
3
  module AppStoreConnect
6
- class BetaBuildLocalizationModifyRequest < ModifyRequest
4
+ class BetaBuildLocalizationModifyRequest < Request::Body
7
5
  data do
6
+ id
8
7
  type 'betaBuildLocalizations'
9
8
 
10
9
  attributes do
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'app_store_connect/create_request'
4
-
5
3
  module AppStoreConnect
6
- class BuildUpdateRequest < CreateRequest
4
+ class BuildUpdateRequest < Request::Body
7
5
  data do
8
6
  id
9
7
  type 'builds'
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'app_store_connect/create_request'
4
-
5
3
  module AppStoreConnect
6
- class BundleIdCapabilityCreateRequest < CreateRequest
4
+ class BundleIdCapabilityCreateRequest < Request::Body
7
5
  data do
8
6
  type 'bundleIdCapabilities'
9
7
 
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'app_store_connect/create_request'
4
-
5
3
  module AppStoreConnect
6
- class BundleIdCreateRequest < CreateRequest
4
+ class BundleIdCreateRequest < Request::Body
7
5
  data do
8
6
  type 'bundleIds'
9
7
 
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'app_store_connect/create_request'
4
-
5
3
  module AppStoreConnect
6
- class CertificateCreateRequest < CreateRequest
4
+ class CertificateCreateRequest < Request::Body
7
5
  data do
8
6
  type 'certificates'
9
7