storyblok 3.1.0 → 3.3.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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/Gemfile +1 -1
  4. data/LICENSE +21 -0
  5. data/README.md +5 -1
  6. data/lib/storyblok/client.rb +26 -6
  7. data/lib/storyblok/version.rb +1 -1
  8. metadata +4 -32
  9. data/Gemfile.lock +0 -128
  10. data/coverage/.last_run.json +0 -5
  11. data/coverage/.resultset.json +0 -547
  12. data/coverage/.resultset.json.lock +0 -0
  13. data/coverage/assets/0.10.2/application.css +0 -799
  14. data/coverage/assets/0.10.2/application.js +0 -1707
  15. data/coverage/assets/0.10.2/colorbox/border.png +0 -0
  16. data/coverage/assets/0.10.2/colorbox/controls.png +0 -0
  17. data/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
  18. data/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
  19. data/coverage/assets/0.10.2/favicon_green.png +0 -0
  20. data/coverage/assets/0.10.2/favicon_red.png +0 -0
  21. data/coverage/assets/0.10.2/favicon_yellow.png +0 -0
  22. data/coverage/assets/0.10.2/loading.gif +0 -0
  23. data/coverage/assets/0.10.2/magnify.png +0 -0
  24. data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  25. data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  26. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  27. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  28. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  29. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  30. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  31. data/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  32. data/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
  33. data/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  34. data/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
  35. data/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
  36. data/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  37. data/coverage/index.html +0 -3380
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd63f68ec8b4a15eb75df4240e3ab65117e44bf4f149d81814fd019f919d2b3f
4
- data.tar.gz: 5de614478e045a878c41755fd342798860d8980d492687fd904dae34a94d5f34
3
+ metadata.gz: ff2b96538cd2959b1a5f3e75a8fe05698875a8daea71fe5ddcf703206fc1efa2
4
+ data.tar.gz: c2c68e5926b227fb615311fe27da54f710b607cd9ab1282808219522ccbb4777
5
5
  SHA512:
6
- metadata.gz: c6ba6fa2345e29b5a9fc8d23bdbac78a89a60322dca1e7a578c7e74e3ea487d94ffd3f5f5218ed3efd708d918a07f2db54a20d509a39977012fc068528542b6c
7
- data.tar.gz: e9774ef478fa2429a50e2c41fc4193c54404f18ed65b1bdb4863a42ede67b38193bf400670bd8e49c8d8bc4ff51f68979ef0cca5f4c66af46e9fe5f2bf322c53
6
+ metadata.gz: 54f690a2d6e335334dbaf384576023b5d8571100ad9ba6df9f4187adb9ff87bc5b2fc2f4268314e7f8348ae956727c94c95af5fc1ddebadf70f87d1a5f3a399c
7
+ data.tar.gz: 319006f9bd1f30487135838e120815d85350e06b49cdbae82190736aeba130a6c2fb35186b27149a24d72f6265695b8ba250842fc3db9fbb9bbf55b7fa143626
data/.gitignore CHANGED
@@ -1,3 +1,6 @@
1
+ # Ignore bundler config.
2
+ /.bundle
3
+
1
4
  pkg
2
5
  doc/
3
6
  .yardoc/
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "redis"
5
+ gem "redis", "~> 4.4.0"
6
6
  gem "storyblok-richtext-renderer"
7
7
 
8
8
  gem "rubocop", require: false
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Storyblok GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -43,7 +43,11 @@ Storyblok::Client.new(version: 'published')
43
43
 
44
44
  #### Using the APIs on other regions
45
45
 
46
- You should use the space access token AND `api_region: 'us'` whenever your space was created under `US` Server Location.
46
+ You should use the space access token with the `api_region` parameter whenever your space belongs to other server locations.
47
+
48
+ Available regions: `eu`, `us`, `ca` and `ap`.
49
+
50
+ Example on US region:
47
51
 
48
52
  ```ruby
49
53
  client = Storyblok::Client.new(token: 'YOUR_TOKEN', api_region: 'us')
@@ -19,7 +19,8 @@ module Storyblok
19
19
  component_resolver: ->(component, data) { '' },
20
20
  # :nocov:
21
21
  cache_version: Time.now.to_i,
22
- cache: nil
22
+ cache: nil,
23
+ request_type: nil
23
24
  }
24
25
 
25
26
  attr_reader :configuration, :logger
@@ -33,16 +34,23 @@ module Storyblok
33
34
  # @option given_configuration [Number] :api_version
34
35
  # @option given_configuration [String] :api_region
35
36
  # @option given_configuration [false, ::Logger] :logger
36
- # @option given_configuration [::Logger::DEBUG, ::Logger::INFO, ::Logger::WARN, ::Logger::ERROR] :log_level
37
+ # @option given_configuration [String] :token Required if oauth_token is not set
38
+ # @option given_configuration [String] :request_type
37
39
  def initialize(given_configuration = {})
38
40
  @configuration = default_configuration.merge(given_configuration)
39
41
  @cache_version = '0'
40
42
  validate_configuration!
41
43
 
42
44
  if configuration[:oauth_token]
43
- @rest_client = RestClient::Resource.new(base_url, :headers => {
44
- :authorization => configuration[:oauth_token]
45
- })
45
+ @configuration[:api_version] = 1
46
+ @rest_client = RestClient::Resource.new(
47
+ base_url,
48
+ headers: {
49
+ authorization: configuration[:oauth_token],
50
+ 'SB-Agent-Version': Storyblok::VERSION,
51
+ 'SB-Agent': 'SB-RB'
52
+ }
53
+ )
46
54
  end
47
55
 
48
56
  @renderer = Richtext::HtmlRenderer.new
@@ -232,7 +240,19 @@ module Storyblok
232
240
  retries_left = 3
233
241
 
234
242
  begin
235
- res = RestClient.get "#{endpoint}?#{query_string}"
243
+ headers = {
244
+ 'SB-Agent-Version': Storyblok::VERSION,
245
+ 'SB-Agent': 'SB-RB'
246
+ }
247
+
248
+ headers['X-Request-Type'] = @configuration[:request_type] unless @configuration[:request_type].to_s.empty?
249
+
250
+ # rubocop:disable Lint/UselessAssignment
251
+ res = RestClient.get(
252
+ "#{endpoint}?#{query_string}",
253
+ headers = headers
254
+ )
255
+ # rubocop:enable Lint/UselessAssignment
236
256
  rescue RestClient::TooManyRequests
237
257
  if retries_left != 0
238
258
  retries_left -= 1
@@ -1,4 +1,4 @@
1
1
  module Storyblok
2
2
  # Gem Version
3
- VERSION = "3.1.0"
3
+ VERSION = "3.3.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: storyblok
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Storyblok (Alexander Feiglstorfer)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-02 00:00:00.000000000 Z
11
+ date: 2025-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -147,36 +147,8 @@ files:
147
147
  - ".rubocop_strict.yml"
148
148
  - ".rubocop_todo.yml"
149
149
  - Gemfile
150
- - Gemfile.lock
150
+ - LICENSE
151
151
  - README.md
152
- - coverage/.last_run.json
153
- - coverage/.resultset.json
154
- - coverage/.resultset.json.lock
155
- - coverage/assets/0.10.2/application.css
156
- - coverage/assets/0.10.2/application.js
157
- - coverage/assets/0.10.2/colorbox/border.png
158
- - coverage/assets/0.10.2/colorbox/controls.png
159
- - coverage/assets/0.10.2/colorbox/loading.gif
160
- - coverage/assets/0.10.2/colorbox/loading_background.png
161
- - coverage/assets/0.10.2/favicon_green.png
162
- - coverage/assets/0.10.2/favicon_red.png
163
- - coverage/assets/0.10.2/favicon_yellow.png
164
- - coverage/assets/0.10.2/loading.gif
165
- - coverage/assets/0.10.2/magnify.png
166
- - coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
167
- - coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
168
- - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
169
- - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
170
- - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png
171
- - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
172
- - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
173
- - coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
174
- - coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png
175
- - coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png
176
- - coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png
177
- - coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png
178
- - coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png
179
- - coverage/index.html
180
152
  - examples/cache.rb
181
153
  - examples/example_queries.rb
182
154
  - examples/management_api.rb
@@ -206,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
178
  - !ruby/object:Gem::Version
207
179
  version: '0'
208
180
  requirements: []
209
- rubygems_version: 3.1.4
181
+ rubygems_version: 3.1.2
210
182
  signing_key:
211
183
  specification_version: 4
212
184
  summary: storyblok
data/Gemfile.lock DELETED
@@ -1,128 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- storyblok (3.0.1)
5
- rest-client (>= 1.8.0, < 3)
6
- storyblok-richtext-renderer (>= 0.0.4, < 1)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- activesupport (6.0.4.7)
12
- concurrent-ruby (~> 1.0, >= 1.0.2)
13
- i18n (>= 0.7, < 2)
14
- minitest (~> 5.1)
15
- tzinfo (~> 1.1)
16
- zeitwerk (~> 2.2, >= 2.2.2)
17
- addressable (2.8.0)
18
- public_suffix (>= 2.0.2, < 5.0)
19
- ast (2.4.1)
20
- coderay (1.1.3)
21
- concurrent-ruby (1.1.9)
22
- crack (0.4.5)
23
- rexml
24
- diff-lcs (1.4.4)
25
- docile (1.4.0)
26
- domain_name (0.5.20190701)
27
- unf (>= 0.0.5, < 1.0.0)
28
- hashdiff (1.0.1)
29
- http-accept (1.7.0)
30
- http-cookie (1.0.4)
31
- domain_name (~> 0.5)
32
- i18n (1.10.0)
33
- concurrent-ruby (~> 1.0)
34
- jaro_winkler (1.5.4)
35
- json (2.6.1)
36
- method_source (1.0.0)
37
- mime-types (3.4.1)
38
- mime-types-data (~> 3.2015)
39
- mime-types-data (3.2022.0105)
40
- minitest (5.15.0)
41
- netrc (0.11.0)
42
- parallel (1.19.2)
43
- parser (2.7.1.4)
44
- ast (~> 2.4.1)
45
- pry (0.13.1)
46
- coderay (~> 1.1)
47
- method_source (~> 1.0)
48
- public_suffix (4.0.6)
49
- rack (2.2.3)
50
- rainbow (3.0.0)
51
- redis (4.5.1)
52
- rest-client (2.1.0)
53
- http-accept (>= 1.7.0, < 2.0)
54
- http-cookie (>= 1.0.2, < 2.0)
55
- mime-types (>= 1.16, < 4.0)
56
- netrc (~> 0.8)
57
- rexml (3.2.5)
58
- rspec (3.10.0)
59
- rspec-core (~> 3.10.0)
60
- rspec-expectations (~> 3.10.0)
61
- rspec-mocks (~> 3.10.0)
62
- rspec-core (3.10.1)
63
- rspec-support (~> 3.10.0)
64
- rspec-expectations (3.10.1)
65
- diff-lcs (>= 1.2.0, < 2.0)
66
- rspec-support (~> 3.10.0)
67
- rspec-mocks (3.10.2)
68
- diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.10.0)
70
- rspec-support (3.10.3)
71
- rubocop (0.81.0)
72
- jaro_winkler (~> 1.5.1)
73
- parallel (~> 1.10)
74
- parser (>= 2.7.0.1)
75
- rainbow (>= 2.2.2, < 4.0)
76
- rexml
77
- ruby-progressbar (~> 1.7)
78
- unicode-display_width (>= 1.4.0, < 2.0)
79
- rubocop-performance (1.5.2)
80
- rubocop (>= 0.71.0)
81
- rubocop-rails (2.5.2)
82
- activesupport
83
- rack (>= 1.1)
84
- rubocop (>= 0.72.0)
85
- rubocop-rspec (1.38.1)
86
- rubocop (>= 0.68.1)
87
- ruby-progressbar (1.10.1)
88
- simplecov (0.17.1)
89
- docile (~> 1.1)
90
- json (>= 1.8, < 3)
91
- simplecov-html (~> 0.10.0)
92
- simplecov-html (0.10.2)
93
- storyblok-richtext-renderer (0.0.6)
94
- thread_safe (0.3.6)
95
- tzinfo (1.2.9)
96
- thread_safe (~> 0.1)
97
- unf (0.1.4)
98
- unf_ext
99
- unf_ext (0.0.8.1)
100
- unicode-display_width (1.7.0)
101
- vcr (6.0.0)
102
- webmock (3.14.0)
103
- addressable (>= 2.8.0)
104
- crack (>= 0.3.2)
105
- hashdiff (>= 0.4.0, < 2.0.0)
106
- zeitwerk (2.5.4)
107
-
108
- PLATFORMS
109
- ruby
110
-
111
- DEPENDENCIES
112
- bundler (~> 1.5)
113
- hashdiff (~> 1.0.1)
114
- pry
115
- redis
116
- rspec (~> 3)
117
- rubocop
118
- rubocop-performance
119
- rubocop-rails
120
- rubocop-rspec
121
- simplecov (< 0.18.0)
122
- storyblok!
123
- storyblok-richtext-renderer
124
- vcr (= 6.0.0)
125
- webmock (= 3.14.0)
126
-
127
- BUNDLED WITH
128
- 1.17.3
@@ -1,5 +0,0 @@
1
- {
2
- "result": {
3
- "covered_percent": 53.06
4
- }
5
- }