storyblok 3.0.1 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +282 -0
- data/.rubocop_strict.yml +30 -0
- data/.rubocop_todo.yml +405 -0
- data/Gemfile +8 -3
- data/README.md +72 -32
- data/examples/cache.rb +5 -6
- data/examples/example_queries.rb +6 -6
- data/examples/management_api.rb +2 -4
- data/examples/renderer.rb +11 -12
- data/examples/tree.rb +12 -12
- data/lib/storyblok/cache/redis.rb +0 -1
- data/lib/storyblok/client.rb +152 -134
- data/lib/storyblok/links.rb +16 -17
- data/lib/storyblok/version.rb +1 -1
- data/lib/storyblok.rb +3 -3
- metadata +10 -14
- data/.DS_Store +0 -0
- data/.ruby-version +0 -1
- data/Gemfile.lock +0 -56
- data/lib/.DS_Store +0 -0
- data/lib/storyblok/.DS_Store +0 -0
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,405 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 10000`
|
3
|
+
# on 2022-02-21 18:24:20 UTC using RuboCop version 1.25.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 2
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
12
|
+
# Include: **/*.gemspec
|
13
|
+
Gemspec/OrderedDependencies:
|
14
|
+
Exclude:
|
15
|
+
- 'storyblok.gemspec'
|
16
|
+
|
17
|
+
# Offense count: 1
|
18
|
+
# Configuration parameters: Include.
|
19
|
+
# Include: **/*.gemspec
|
20
|
+
Gemspec/RequiredRubyVersion:
|
21
|
+
Exclude:
|
22
|
+
- 'storyblok.gemspec'
|
23
|
+
|
24
|
+
# Offense count: 2
|
25
|
+
# Cop supports --auto-correct.
|
26
|
+
# Configuration parameters: EnforcedStyle.
|
27
|
+
# SupportedStyles: around, only_before
|
28
|
+
Layout/EmptyLinesAroundAccessModifier:
|
29
|
+
Exclude:
|
30
|
+
- 'lib/storyblok/client.rb'
|
31
|
+
- 'lib/storyblok/links.rb'
|
32
|
+
|
33
|
+
# Offense count: 13
|
34
|
+
# Cop supports --auto-correct.
|
35
|
+
# Configuration parameters: EnforcedStyle.
|
36
|
+
# SupportedStyles: normal, indented_internal_methods
|
37
|
+
Layout/IndentationConsistency:
|
38
|
+
Exclude:
|
39
|
+
- 'lib/storyblok/client.rb'
|
40
|
+
- 'lib/storyblok/links.rb'
|
41
|
+
|
42
|
+
# Offense count: 13
|
43
|
+
# Cop supports --auto-correct.
|
44
|
+
# Configuration parameters: Width, IgnoredPatterns.
|
45
|
+
Layout/IndentationWidth:
|
46
|
+
Exclude:
|
47
|
+
- 'lib/storyblok/client.rb'
|
48
|
+
- 'lib/storyblok/links.rb'
|
49
|
+
|
50
|
+
# Offense count: 2
|
51
|
+
# Configuration parameters: IgnoredMethods.
|
52
|
+
Lint/AmbiguousBlockAssociation:
|
53
|
+
Exclude:
|
54
|
+
- 'spec/lib/storyblok_cache_redis_spec.rb'
|
55
|
+
|
56
|
+
# Offense count: 2
|
57
|
+
# Cop supports --auto-correct.
|
58
|
+
Lint/RedundantStringCoercion:
|
59
|
+
Exclude:
|
60
|
+
- 'lib/storyblok/client.rb'
|
61
|
+
|
62
|
+
# Offense count: 1
|
63
|
+
Lint/ShadowingOuterLocalVariable:
|
64
|
+
Exclude:
|
65
|
+
- 'examples/tree.rb'
|
66
|
+
|
67
|
+
# Offense count: 5
|
68
|
+
# Cop supports --auto-correct.
|
69
|
+
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
70
|
+
Lint/UnusedBlockArgument:
|
71
|
+
Exclude:
|
72
|
+
- 'examples/tree.rb'
|
73
|
+
- 'lib/storyblok/client.rb'
|
74
|
+
- 'lib/storyblok/links.rb'
|
75
|
+
|
76
|
+
# Offense count: 8
|
77
|
+
Lint/UselessAssignment:
|
78
|
+
Exclude:
|
79
|
+
- 'examples/cache.rb'
|
80
|
+
- 'examples/renderer.rb'
|
81
|
+
|
82
|
+
# Offense count: 8
|
83
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes, Max.
|
84
|
+
Metrics/AbcSize:
|
85
|
+
Exclude:
|
86
|
+
- 'lib/storyblok/client.rb'
|
87
|
+
- 'lib/storyblok/links.rb'
|
88
|
+
|
89
|
+
# Offense count: 50
|
90
|
+
# Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, IgnoredMethods.
|
91
|
+
# IgnoredMethods: refine
|
92
|
+
Metrics/BlockLength:
|
93
|
+
Exclude:
|
94
|
+
- '**/*.gemspec'
|
95
|
+
- 'spec/lib/storyblok_cache_redis_spec.rb'
|
96
|
+
- 'spec/lib/storyblok_client_spec.rb'
|
97
|
+
- 'spec/v2/storyblok_client_spec.rb'
|
98
|
+
|
99
|
+
# Offense count: 3
|
100
|
+
# Configuration parameters: CountBlocks, Max.
|
101
|
+
Metrics/BlockNesting:
|
102
|
+
Exclude:
|
103
|
+
- 'lib/storyblok/client.rb'
|
104
|
+
|
105
|
+
# Offense count: 1
|
106
|
+
# Configuration parameters: CountComments, Max, CountAsOne.
|
107
|
+
Metrics/ClassLength:
|
108
|
+
Exclude:
|
109
|
+
- 'lib/storyblok/client.rb'
|
110
|
+
|
111
|
+
# Offense count: 3
|
112
|
+
# Configuration parameters: IgnoredMethods, Max.
|
113
|
+
Metrics/CyclomaticComplexity:
|
114
|
+
Exclude:
|
115
|
+
- 'lib/storyblok/client.rb'
|
116
|
+
|
117
|
+
# Offense count: 10
|
118
|
+
# Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, IgnoredMethods.
|
119
|
+
Metrics/MethodLength:
|
120
|
+
Exclude:
|
121
|
+
- 'lib/storyblok/client.rb'
|
122
|
+
- 'lib/storyblok/links.rb'
|
123
|
+
- 'lib/storyblok/request.rb'
|
124
|
+
|
125
|
+
# Offense count: 2
|
126
|
+
# Configuration parameters: IgnoredMethods, Max.
|
127
|
+
Metrics/PerceivedComplexity:
|
128
|
+
Exclude:
|
129
|
+
- 'lib/storyblok/client.rb'
|
130
|
+
|
131
|
+
# Offense count: 1
|
132
|
+
Naming/AccessorMethodName:
|
133
|
+
Exclude:
|
134
|
+
- 'lib/storyblok/client.rb'
|
135
|
+
|
136
|
+
# Offense count: 1
|
137
|
+
# Cop supports --auto-correct.
|
138
|
+
# Configuration parameters: EnforcedStyle.
|
139
|
+
# SupportedStyles: always, conditionals
|
140
|
+
Style/AndOr:
|
141
|
+
Exclude:
|
142
|
+
- 'lib/storyblok/client.rb'
|
143
|
+
|
144
|
+
# Offense count: 11
|
145
|
+
# Cop supports --auto-correct.
|
146
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
147
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
148
|
+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
149
|
+
# FunctionalMethods: let, let!, subject, watch
|
150
|
+
# IgnoredMethods: lambda, proc, it
|
151
|
+
Style/BlockDelimiters:
|
152
|
+
Exclude:
|
153
|
+
- 'lib/storyblok/client.rb'
|
154
|
+
- 'spec/lib/storyblok_cache_redis_spec.rb'
|
155
|
+
- 'spec/lib/storyblok_client_spec.rb'
|
156
|
+
- 'storyblok.gemspec'
|
157
|
+
|
158
|
+
# Offense count: 2
|
159
|
+
# Cop supports --auto-correct-all.
|
160
|
+
Style/CaseLikeIf:
|
161
|
+
Exclude:
|
162
|
+
- 'lib/storyblok/client.rb'
|
163
|
+
|
164
|
+
# Offense count: 1
|
165
|
+
# Cop supports --auto-correct.
|
166
|
+
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
167
|
+
# SupportedStyles: assign_to_condition, assign_inside_condition
|
168
|
+
Style/ConditionalAssignment:
|
169
|
+
Exclude:
|
170
|
+
- 'lib/storyblok/client.rb'
|
171
|
+
|
172
|
+
# Offense count: 3
|
173
|
+
# Configuration parameters: AllowedConstants.
|
174
|
+
Style/Documentation:
|
175
|
+
Exclude:
|
176
|
+
- 'spec/**/*'
|
177
|
+
- 'test/**/*'
|
178
|
+
- 'lib/storyblok/cache/redis.rb'
|
179
|
+
- 'lib/storyblok/client.rb'
|
180
|
+
- 'lib/storyblok/links.rb'
|
181
|
+
|
182
|
+
# Offense count: 1
|
183
|
+
# Cop supports --auto-correct.
|
184
|
+
Style/ExpandPathArguments:
|
185
|
+
Exclude:
|
186
|
+
- 'storyblok.gemspec'
|
187
|
+
|
188
|
+
# Offense count: 17
|
189
|
+
# Cop supports --auto-correct.
|
190
|
+
# Configuration parameters: EnforcedStyle.
|
191
|
+
# SupportedStyles: always, always_true, never
|
192
|
+
Style/FrozenStringLiteralComment:
|
193
|
+
Exclude:
|
194
|
+
- 'Gemfile'
|
195
|
+
- 'examples/cache.rb'
|
196
|
+
- 'examples/example_queries.rb'
|
197
|
+
- 'examples/management_api.rb'
|
198
|
+
- 'examples/renderer.rb'
|
199
|
+
- 'examples/tree.rb'
|
200
|
+
- 'lib/storyblok.rb'
|
201
|
+
- 'lib/storyblok/cache/redis.rb'
|
202
|
+
- 'lib/storyblok/client.rb'
|
203
|
+
- 'lib/storyblok/links.rb'
|
204
|
+
- 'lib/storyblok/request.rb'
|
205
|
+
- 'lib/storyblok/version.rb'
|
206
|
+
- 'spec/lib/storyblok_cache_redis_spec.rb'
|
207
|
+
- 'spec/lib/storyblok_client_spec.rb'
|
208
|
+
- 'spec/lib/storyblok_request_spec.rb'
|
209
|
+
- 'spec/v2/storyblok_client_spec.rb'
|
210
|
+
- 'storyblok.gemspec'
|
211
|
+
|
212
|
+
# Offense count: 5
|
213
|
+
# Cop supports --auto-correct.
|
214
|
+
Style/GlobalStdStream:
|
215
|
+
Exclude:
|
216
|
+
- 'examples/cache.rb'
|
217
|
+
- 'examples/example_queries.rb'
|
218
|
+
- 'examples/management_api.rb'
|
219
|
+
- 'examples/renderer.rb'
|
220
|
+
- 'examples/tree.rb'
|
221
|
+
|
222
|
+
# Offense count: 2
|
223
|
+
# Configuration parameters: MinBodyLength.
|
224
|
+
Style/GuardClause:
|
225
|
+
Exclude:
|
226
|
+
- 'lib/storyblok/cache/redis.rb'
|
227
|
+
- 'lib/storyblok/client.rb'
|
228
|
+
|
229
|
+
# Offense count: 4
|
230
|
+
# Cop supports --auto-correct.
|
231
|
+
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
232
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
233
|
+
# SupportedShorthandSyntax: always, never, either
|
234
|
+
Style/HashSyntax:
|
235
|
+
Exclude:
|
236
|
+
- 'examples/cache.rb'
|
237
|
+
- 'lib/storyblok/client.rb'
|
238
|
+
- 'spec/spec_helper.rb'
|
239
|
+
|
240
|
+
# Offense count: 7
|
241
|
+
# Cop supports --auto-correct.
|
242
|
+
Style/IfUnlessModifier:
|
243
|
+
Exclude:
|
244
|
+
- 'lib/storyblok/cache/redis.rb'
|
245
|
+
- 'lib/storyblok/client.rb'
|
246
|
+
- 'lib/storyblok/links.rb'
|
247
|
+
|
248
|
+
# Offense count: 1
|
249
|
+
# Cop supports --auto-correct.
|
250
|
+
# Configuration parameters: EnforcedStyle.
|
251
|
+
# SupportedStyles: line_count_dependent, lambda, literal
|
252
|
+
Style/Lambda:
|
253
|
+
Exclude:
|
254
|
+
- 'examples/renderer.rb'
|
255
|
+
|
256
|
+
# Offense count: 2
|
257
|
+
# Cop supports --auto-correct.
|
258
|
+
# Configuration parameters: EnforcedStyle.
|
259
|
+
# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
|
260
|
+
Style/MethodDefParentheses:
|
261
|
+
Exclude:
|
262
|
+
- 'lib/storyblok/client.rb'
|
263
|
+
|
264
|
+
# Offense count: 1
|
265
|
+
# Cop supports --auto-correct.
|
266
|
+
Style/MultilineIfModifier:
|
267
|
+
Exclude:
|
268
|
+
- 'lib/storyblok/client.rb'
|
269
|
+
|
270
|
+
# Offense count: 2
|
271
|
+
# Cop supports --auto-correct.
|
272
|
+
# Configuration parameters: EnforcedStyle.
|
273
|
+
# SupportedStyles: literals, strict
|
274
|
+
Style/MutableConstant:
|
275
|
+
Exclude:
|
276
|
+
- 'lib/storyblok/client.rb'
|
277
|
+
- 'lib/storyblok/version.rb'
|
278
|
+
|
279
|
+
# Offense count: 4
|
280
|
+
# Cop supports --auto-correct.
|
281
|
+
# Configuration parameters: EnforcedStyle.
|
282
|
+
# SupportedStyles: both, prefix, postfix
|
283
|
+
Style/NegatedIf:
|
284
|
+
Exclude:
|
285
|
+
- 'examples/tree.rb'
|
286
|
+
- 'lib/storyblok/client.rb'
|
287
|
+
- 'lib/storyblok/links.rb'
|
288
|
+
|
289
|
+
# Offense count: 1
|
290
|
+
# Cop supports --auto-correct.
|
291
|
+
# Configuration parameters: EnforcedStyle, MinBodyLength.
|
292
|
+
# SupportedStyles: skip_modifier_ifs, always
|
293
|
+
Style/Next:
|
294
|
+
Exclude:
|
295
|
+
- 'lib/storyblok/client.rb'
|
296
|
+
|
297
|
+
# Offense count: 67
|
298
|
+
# Cop supports --auto-correct.
|
299
|
+
# Configuration parameters: MinDigits, Strict, AllowedNumbers.
|
300
|
+
Style/NumericLiterals:
|
301
|
+
Exclude:
|
302
|
+
- 'spec/lib/storyblok_client_spec.rb'
|
303
|
+
- 'spec/v2/storyblok_client_spec.rb'
|
304
|
+
|
305
|
+
# Offense count: 1
|
306
|
+
# Cop supports --auto-correct-all.
|
307
|
+
# Configuration parameters: EnforcedStyle, IgnoredMethods.
|
308
|
+
# SupportedStyles: predicate, comparison
|
309
|
+
Style/NumericPredicate:
|
310
|
+
Exclude:
|
311
|
+
- 'spec/**/*'
|
312
|
+
- 'lib/storyblok/cache/redis.rb'
|
313
|
+
|
314
|
+
# Offense count: 1
|
315
|
+
Style/OptionalArguments:
|
316
|
+
Exclude:
|
317
|
+
- 'lib/storyblok/links.rb'
|
318
|
+
|
319
|
+
# Offense count: 3
|
320
|
+
# Configuration parameters: AllowedMethods.
|
321
|
+
# AllowedMethods: respond_to_missing?
|
322
|
+
Style/OptionalBooleanParameter:
|
323
|
+
Exclude:
|
324
|
+
- 'lib/storyblok/cache/redis.rb'
|
325
|
+
- 'lib/storyblok/client.rb'
|
326
|
+
- 'lib/storyblok/request.rb'
|
327
|
+
|
328
|
+
# Offense count: 6
|
329
|
+
# Cop supports --auto-correct.
|
330
|
+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
|
331
|
+
# AllowedMethods: present?, blank?, presence, try, try!
|
332
|
+
Style/SafeNavigation:
|
333
|
+
Exclude:
|
334
|
+
- 'lib/storyblok/client.rb'
|
335
|
+
|
336
|
+
# Offense count: 3
|
337
|
+
# Cop supports --auto-correct.
|
338
|
+
# Configuration parameters: EnforcedStyle.
|
339
|
+
# SupportedStyles: only_raise, only_fail, semantic
|
340
|
+
Style/SignalException:
|
341
|
+
Exclude:
|
342
|
+
- 'lib/storyblok/client.rb'
|
343
|
+
|
344
|
+
# Offense count: 1
|
345
|
+
# Cop supports --auto-correct.
|
346
|
+
# Configuration parameters: AllowModifier.
|
347
|
+
Style/SoleNestedConditional:
|
348
|
+
Exclude:
|
349
|
+
- 'lib/storyblok/client.rb'
|
350
|
+
|
351
|
+
# Offense count: 6
|
352
|
+
# Cop supports --auto-correct-all.
|
353
|
+
# Configuration parameters: Mode.
|
354
|
+
Style/StringConcatenation:
|
355
|
+
Exclude:
|
356
|
+
- 'examples/tree.rb'
|
357
|
+
- 'lib/storyblok/client.rb'
|
358
|
+
|
359
|
+
# Offense count: 1217
|
360
|
+
# Cop supports --auto-correct.
|
361
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
362
|
+
# SupportedStyles: single_quotes, double_quotes
|
363
|
+
Style/StringLiterals:
|
364
|
+
Exclude:
|
365
|
+
- 'Gemfile'
|
366
|
+
- 'examples/cache.rb'
|
367
|
+
- 'examples/example_queries.rb'
|
368
|
+
- 'examples/management_api.rb'
|
369
|
+
- 'examples/renderer.rb'
|
370
|
+
- 'examples/tree.rb'
|
371
|
+
- 'lib/storyblok.rb'
|
372
|
+
- 'lib/storyblok/cache/redis.rb'
|
373
|
+
- 'lib/storyblok/client.rb'
|
374
|
+
- 'lib/storyblok/links.rb'
|
375
|
+
- 'lib/storyblok/version.rb'
|
376
|
+
- 'spec/lib/storyblok_cache_redis_spec.rb'
|
377
|
+
- 'spec/lib/storyblok_client_spec.rb'
|
378
|
+
- 'spec/lib/storyblok_request_spec.rb'
|
379
|
+
- 'spec/spec_helper.rb'
|
380
|
+
- 'spec/v2/storyblok_client_spec.rb'
|
381
|
+
- 'storyblok.gemspec'
|
382
|
+
|
383
|
+
# Offense count: 1
|
384
|
+
# Cop supports --auto-correct.
|
385
|
+
# Configuration parameters: MinSize.
|
386
|
+
# SupportedStyles: percent, brackets
|
387
|
+
Style/SymbolArray:
|
388
|
+
EnforcedStyle: brackets
|
389
|
+
|
390
|
+
# Offense count: 1
|
391
|
+
# Cop supports --auto-correct.
|
392
|
+
Style/UnlessElse:
|
393
|
+
Exclude:
|
394
|
+
- 'lib/storyblok/client.rb'
|
395
|
+
|
396
|
+
# Offense count: 104
|
397
|
+
# Cop supports --auto-correct.
|
398
|
+
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
399
|
+
# URISchemes: http, https
|
400
|
+
Layout/LineLength:
|
401
|
+
Exclude:
|
402
|
+
- 'lib/storyblok/client.rb'
|
403
|
+
- 'spec/lib/storyblok_cache_redis_spec.rb'
|
404
|
+
- 'spec/lib/storyblok_client_spec.rb'
|
405
|
+
- 'spec/v2/storyblok_client_spec.rb'
|
data/Gemfile
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem
|
6
|
-
gem
|
5
|
+
gem "redis", "~> 4.4.0"
|
6
|
+
gem "storyblok-richtext-renderer"
|
7
|
+
|
8
|
+
gem "rubocop", require: false
|
9
|
+
gem "rubocop-performance", require: false
|
10
|
+
gem "rubocop-rails", require: false
|
11
|
+
gem "rubocop-rspec", require: false
|
data/README.md
CHANGED
@@ -1,19 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
<div align="center">
|
2
|
+
<a href="https://www.storyblok.com?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-ruby" align="center">
|
3
|
+
<img src="https://a.storyblok.com/f/88751/1776x360/95e296dafa/sb-ruby.png" alt="Storyblok Logo">
|
4
|
+
</a>
|
5
|
+
<h1 align="center">Storyblok Ruby Client</h1>
|
6
|
+
<p align="center">This is the official <a href="http://www.storyblok.com?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-ruby" target="_blank">Storyblok</a> ruby client for easy access of the management and content delivery api.</p>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<p align="center">
|
10
|
+
<a href="https://codeclimate.com/github/storyblok/storyblok-ruby/test_coverage">
|
11
|
+
<img src="https://api.codeclimate.com/v1/badges/76e7fcc8524d4fadeeee/test_coverage" alt="Test Coverage" />
|
12
|
+
</a>
|
13
|
+
<a href="https://discord.gg/jKrbAMz">
|
14
|
+
<img src="https://img.shields.io/discord/700316478792138842?label=Join%20Our%20Discord%20Community&style=appveyor&logo=discord&color=09b3af">
|
15
|
+
</a>
|
16
|
+
<a href="https://twitter.com/intent/follow?screen_name=storyblok">
|
17
|
+
<img src="https://img.shields.io/badge/Follow-%40storyblok-09b3af?style=appveyor&logo=twitter" alt="Follow @Storyblok" />
|
18
|
+
</a><br/>
|
19
|
+
<a href="https://app.storyblok.com/#!/signup?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-ruby">
|
20
|
+
<img src="https://img.shields.io/badge/Try%20Storyblok-Free-09b3af?style=appveyor&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAHqADAAQAAAABAAAAHgAAAADpiRU/AAACRElEQVRIDWNgGGmAEd3D3Js3LPrP8D8WXZwSPiMjw6qvPoHhyGYwIXNAbGpbCjbzP0MYuj0YFqMroBV/wCxmIeSju64eDNzMBJUxvP/9i2Hnq5cM1devMnz984eQsQwETeRhYWHgIcJiXqC6VHlFBjUeXgav40cIWkz1oLYXFmGwFBImaDFBHyObcOzdW4aSq5eRhRiE2dgYlpuYoYSKJi8vw3GgWnyAJIs/AuPu4scPGObd/fqVQZ+PHy7+6udPOBsXgySLDfn5GRYYmaKYJcXBgWLpsx8/GPa8foWiBhuHJIsl2DkYQqWksZkDFgP5PObcKYYff//iVAOTIDlx/QPqRMb/YSYBaWlOToZIaVkGZmAZSQiQ5OPtwHwacuo4iplMQEu6tXUZMhSUGDiYmBjylFQYvv/7x9B04xqKOnQOyT5GN+Df//8M59ASXKyMHLoyDD5JPtbj42OYrm+EYgg70JfuYuIoYmLs7AwMjIzA+uY/zjAnyWJpDk6GOFnCvrn86SOwmsNtKciVFAc1ileBHFDC67lzG10Yg0+SjzF0ownsf/OaofvOLYaDQJoQIGix94ljv1gIZI8Pv38zPvj2lQWYf3HGKbpDCFp85v07NnRN1OBTPY6JdRSGxcCw2k6sZuLVMZ5AV4s1TozPnGGFKbz+/PE7IJsHmC//MDMyhXBw8e6FyRFLv3Z0/IKuFqvFyIqAzd1PwBzJw8jAGPfVx38JshwlbIygxmYY43/GQmpais0ODDHuzevLMARHBcgIAQAbOJHZW0/EyQAAAABJRU5ErkJggg==" alt="Follow @Storyblok" />
|
21
|
+
</a>
|
22
|
+
</p>
|
23
|
+
|
24
|
+
## 🚀 Usage
|
25
|
+
|
26
|
+
### Install
|
11
27
|
|
12
28
|
```bash
|
13
29
|
gem 'storyblok'
|
14
30
|
```
|
15
31
|
|
16
|
-
|
32
|
+
### Usage for the content delivery api
|
17
33
|
|
18
34
|
By default the client loads the "draft" version of the Story. Be sure to set the version to "published" to get the published content only.
|
19
35
|
|
@@ -25,7 +41,15 @@ Storyblok::Client.new(version: 'draft')
|
|
25
41
|
Storyblok::Client.new(version: 'published')
|
26
42
|
```
|
27
43
|
|
28
|
-
|
44
|
+
#### Using the APIs on other regions
|
45
|
+
|
46
|
+
You should use the space access token AND `api_region: 'us'` whenever your space was created under `US` Server Location.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
client = Storyblok::Client.new(token: 'YOUR_TOKEN', api_region: 'us')
|
50
|
+
```
|
51
|
+
|
52
|
+
#### Load a story
|
29
53
|
|
30
54
|
```ruby
|
31
55
|
# Without cache
|
@@ -40,7 +64,7 @@ client = Storyblok::Client.new(cache: cache, token: 'YOUR_TOKEN')
|
|
40
64
|
client.story('home')
|
41
65
|
```
|
42
66
|
|
43
|
-
|
67
|
+
#### Load a list of stories
|
44
68
|
|
45
69
|
```ruby
|
46
70
|
# Get all Stories that start with news
|
@@ -49,7 +73,7 @@ client.stories({
|
|
49
73
|
})
|
50
74
|
```
|
51
75
|
|
52
|
-
|
76
|
+
#### Load a list of datasource entries
|
53
77
|
|
54
78
|
```ruby
|
55
79
|
# Get all label datasource entries
|
@@ -59,7 +83,7 @@ client.datasource_entries({
|
|
59
83
|
|
60
84
|
```
|
61
85
|
|
62
|
-
|
86
|
+
#### Load a list of tags
|
63
87
|
|
64
88
|
```ruby
|
65
89
|
# Get all Tags that within the folder news
|
@@ -69,13 +93,13 @@ client.tags({
|
|
69
93
|
|
70
94
|
```
|
71
95
|
|
72
|
-
|
96
|
+
#### Load a list of links
|
73
97
|
|
74
98
|
```ruby
|
75
99
|
client.links
|
76
100
|
```
|
77
101
|
|
78
|
-
|
102
|
+
### Generate a navigation tree
|
79
103
|
|
80
104
|
```ruby
|
81
105
|
tree = client.tree
|
@@ -97,13 +121,13 @@ end
|
|
97
121
|
puts '</ul>'
|
98
122
|
```
|
99
123
|
|
100
|
-
|
124
|
+
#### Get the space info
|
101
125
|
|
102
126
|
```ruby
|
103
127
|
client.space
|
104
128
|
```
|
105
129
|
|
106
|
-
|
130
|
+
### How to flush the cache
|
107
131
|
|
108
132
|
Following an example of how to flush the client cache:
|
109
133
|
|
@@ -118,9 +142,9 @@ client.story('home')
|
|
118
142
|
client.flush
|
119
143
|
```
|
120
144
|
|
121
|
-
|
145
|
+
### Usage for the management api
|
122
146
|
|
123
|
-
|
147
|
+
#### Initialize the client and load spaces
|
124
148
|
|
125
149
|
```ruby
|
126
150
|
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
|
@@ -129,35 +153,35 @@ client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
|
|
129
153
|
client.get('spaces/')
|
130
154
|
```
|
131
155
|
|
132
|
-
|
156
|
+
#### Create a story
|
133
157
|
|
134
158
|
```ruby
|
135
159
|
client.post("spaces/{space_id}/stories", {story: {name: 'new', slug: "new"}})
|
136
160
|
```
|
137
161
|
|
138
|
-
|
162
|
+
#### Update a story
|
139
163
|
|
140
164
|
```ruby
|
141
165
|
client.put("spaces/{space_id}/stories/{story_id}", {story: {name: 'new', slug: "new"}})
|
142
166
|
```
|
143
167
|
|
144
|
-
|
168
|
+
#### Delete a story
|
145
169
|
|
146
170
|
```ruby
|
147
171
|
client.delete("spaces/{space_id}/stories/{story_id}")
|
148
172
|
```
|
149
173
|
|
150
|
-
|
174
|
+
### Rendering of richtext fields
|
151
175
|
|
152
176
|
This SDK comes with a rendering service for richtext fields of Storyblok to get html output.
|
153
177
|
|
154
|
-
|
178
|
+
#### Rendering a richtext field
|
155
179
|
|
156
180
|
```ruby
|
157
181
|
client.render(data.richtext_field)
|
158
182
|
```
|
159
183
|
|
160
|
-
|
184
|
+
#### Define a component renderer
|
161
185
|
|
162
186
|
Storyblok's richtext field also let's you insert content blocks. To render these blocks you can define a Lambda.
|
163
187
|
|
@@ -180,7 +204,7 @@ client.set_component_resolver(->(component, data) {
|
|
180
204
|
})
|
181
205
|
```
|
182
206
|
|
183
|
-
|
207
|
+
#### Contribute
|
184
208
|
|
185
209
|
How to build a gem file.
|
186
210
|
|
@@ -189,10 +213,10 @@ gem build storyblok.gemspec
|
|
189
213
|
gem push storyblok-2.0.X.gem
|
190
214
|
~~~
|
191
215
|
|
192
|
-
|
216
|
+
#### Running Tests
|
193
217
|
We use [RSpec](http://rspec.info/) for testing.
|
194
218
|
|
195
|
-
|
219
|
+
###### To run the whole test suite you will need export the environment variables, ATTENTION when running the test suit with the variable `REDIS_URL` exported, the test suite will remove the keys with this pattern `storyblok:*` from the redis database defined by `REDIS_URL`
|
196
220
|
|
197
221
|
```bash
|
198
222
|
export REDIS_URL="redis://localhost:6379"
|
@@ -216,6 +240,22 @@ To run tests without redis cache tests (for when you don't have redis, or to avo
|
|
216
240
|
rspec --tag ~redis_cache:true
|
217
241
|
```
|
218
242
|
|
219
|
-
|
243
|
+
## 🔗 Related Links
|
244
|
+
|
245
|
+
* **[Storyblok & Ruby on GitHub](https://github.com/search?q=org%3Astoryblok+topic%3Aruby)**: Check all of our Ruby open source repos;
|
246
|
+
* **[Storyblok & Ruby 5 minutes tutorial](https://www.storyblok.com/tp/ruby-on-rails-cms?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-ruby)**: will show you how you can use the API-based CMS Storyblok in combination with the Framework “Ruby on Rails”;
|
247
|
+
* **[Technology Hub](https://www.storyblok.com/technologies?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-ruby)**: We prepared technology hubs so that you can find selected beginner tutorials, videos, boilerplates, and even cheatsheets all in one place;
|
248
|
+
* **[Storyblok CLI](https://github.com/storyblok/storyblok)**: A simple CLI for scaffolding Storyblok projects and fieldtypes.
|
249
|
+
|
250
|
+
## ℹ️ More Resources
|
251
|
+
|
252
|
+
### Support
|
253
|
+
|
254
|
+
* Bugs or Feature Requests? [Submit an issue](../../../issues/new);
|
255
|
+
|
256
|
+
* Do you have questions about Storyblok or you need help? [Join our Discord Community](https://discord.gg/jKrbAMz).
|
257
|
+
|
258
|
+
### Contributing
|
220
259
|
|
221
|
-
|
260
|
+
Please see our [contributing guidelines](https://github.com/storyblok/.github/blob/master/contributing.md) and our [code of conduct](https://www.storyblok.com/trust-center#code-of-conduct?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-ruby).
|
261
|
+
This project use [semantic-release](https://semantic-release.gitbook.io/semantic-release/) for generate new versions by using commit messages and we use the Angular Convention to naming the commits. Check [this question](https://semantic-release.gitbook.io/semantic-release/support/faq#how-can-i-change-the-type-of-commits-that-trigger-a-release) about it in semantic-release FAQ.
|
data/examples/cache.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# bundle exec ruby examples/cache.rb
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "storyblok"
|
4
|
+
require "redis"
|
5
5
|
|
6
6
|
logger = Logger.new(STDOUT)
|
7
7
|
|
8
|
-
redis_url =
|
8
|
+
redis_url = "redis://localhost:6379"
|
9
9
|
Storyblok::Cache.client = Redis.new(:url => redis_url)
|
10
10
|
|
11
11
|
client = Storyblok::Client.new(
|
12
|
-
token:
|
13
|
-
api_url:
|
12
|
+
token: "t618GfLe1YHICBioAHnMrwtt",
|
13
|
+
api_url: "localhost:3001",
|
14
14
|
secure: false,
|
15
15
|
logger: logger
|
16
16
|
)
|
@@ -19,4 +19,3 @@ links = client.links
|
|
19
19
|
links = client.links
|
20
20
|
links = client.flush
|
21
21
|
links = client.links
|
22
|
-
|
data/examples/example_queries.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# bundle exec ruby examples/example_queries.rb
|
2
2
|
|
3
|
-
require
|
3
|
+
require "storyblok"
|
4
4
|
|
5
5
|
logger = Logger.new(STDOUT)
|
6
6
|
|
7
7
|
client = Storyblok::Client.new(
|
8
|
-
token:
|
9
|
-
api_url:
|
8
|
+
token: "t618GfLe1YHICBioAHnMrwtt",
|
9
|
+
api_url: "localhost:3001",
|
10
10
|
secure: false,
|
11
11
|
logger: logger
|
12
12
|
)
|
13
13
|
|
14
|
-
p client.stories(starts_with:
|
15
|
-
p client.story(
|
16
|
-
p client.datasource_entries(datasource:
|
14
|
+
p client.stories(starts_with: "en/news")
|
15
|
+
p client.story("demo1")
|
16
|
+
p client.datasource_entries(datasource: "labels", per_page: 10)
|
17
17
|
p client.links
|
18
18
|
p client.datasources
|