panko_serializer 0.7.2 → 0.7.6

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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/docs.yml +39 -0
  3. data/.github/workflows/ruby.yml +48 -0
  4. data/.gitignore +2 -1
  5. data/Gemfile +5 -14
  6. data/README.md +7 -7
  7. data/benchmarks/bm_panko_json.rb +5 -1
  8. data/benchmarks/setup.rb +3 -1
  9. data/benchmarks/type_casts/bm_panko.rb +2 -2
  10. data/docs/.DS_Store +0 -0
  11. data/docs/README.md +195 -8
  12. data/docs/core/Footer.js +81 -0
  13. data/docs/{associations.md → docs/associations.md} +7 -3
  14. data/docs/{attributes.md → docs/attributes.md} +8 -4
  15. data/docs/{design-choices.md → docs/design-choices.md} +6 -2
  16. data/docs/{getting-started.md → docs/getting-started.md} +5 -1
  17. data/docs/docs/introduction.md +13 -0
  18. data/docs/{performance.md → docs/performance.md} +11 -7
  19. data/docs/{response-bag.md → docs/response-bag.md} +24 -1
  20. data/docs/i18n/en.json +50 -0
  21. data/docs/package-lock.json +9673 -0
  22. data/docs/package.json +14 -0
  23. data/docs/sidebars.json +15 -0
  24. data/docs/siteConfig.js +80 -0
  25. data/docs/static/.DS_Store +0 -0
  26. data/docs/static/css/custom.css +51 -0
  27. data/docs/static/img/favicon.ico +0 -0
  28. data/docs/static/img/oss_logo.png +0 -0
  29. data/docs/static/img/undraw_code_review.svg +1 -0
  30. data/docs/static/img/undraw_monitor.svg +1 -0
  31. data/docs/static/img/undraw_note_list.svg +1 -0
  32. data/docs/static/img/undraw_online.svg +1 -0
  33. data/docs/static/img/undraw_open_source.svg +1 -0
  34. data/docs/static/img/undraw_operating_system.svg +1 -0
  35. data/docs/static/img/undraw_react.svg +1 -0
  36. data/docs/static/img/undraw_tweetstorm.svg +1 -0
  37. data/docs/static/img/undraw_youtube_tutorial.svg +1 -0
  38. data/docs/static/index.html +14 -0
  39. data/ext/panko_serializer/attributes_writer/active_record.c +58 -16
  40. data/ext/panko_serializer/attributes_writer/attributes_writer.c +8 -7
  41. data/ext/panko_serializer/attributes_writer/common.h +1 -1
  42. data/ext/panko_serializer/attributes_writer/hash.c +2 -4
  43. data/ext/panko_serializer/attributes_writer/plain.c +2 -3
  44. data/ext/panko_serializer/attributes_writer/type_cast/type_cast.c +70 -21
  45. data/ext/panko_serializer/attributes_writer/type_cast/type_cast.h +1 -2
  46. data/ext/panko_serializer/panko_serializer.c +23 -8
  47. data/ext/panko_serializer/serialization_descriptor/association.c +1 -0
  48. data/ext/panko_serializer/serialization_descriptor/attribute.c +1 -0
  49. data/ext/panko_serializer/serialization_descriptor/serialization_descriptor.c +7 -10
  50. data/lib/panko/association.rb +1 -1
  51. data/lib/panko/object_writer.rb +8 -0
  52. data/lib/panko/response.rb +5 -4
  53. data/lib/panko/serializer.rb +4 -2
  54. data/lib/panko/serializer_resolver.rb +28 -15
  55. data/lib/panko/version.rb +1 -1
  56. data/panko_serializer.gemspec +8 -7
  57. metadata +67 -25
  58. data/.travis.yml +0 -37
  59. data/docs/docpress.json +0 -4
@@ -1,4 +1,8 @@
1
- # Response
1
+ ---
2
+ id: response-bag
3
+ title: Response
4
+ sidebar_label: Response
5
+ ---
2
6
 
3
7
  Let's say you have some JSON payload which can is constructed using Panko serialization result,
4
8
  like this:
@@ -33,6 +37,25 @@ end
33
37
 
34
38
  And everything will work as expected!
35
39
 
40
+ For a single object serialization, we need to use a different API (since `Panko::Serializer` don't accept an object in it's constructor):
41
+
42
+ ```ruby
43
+ class PostsController < ApplicationController
44
+ def show
45
+ post = Post.find(params[:id])
46
+
47
+ render(
48
+ json: Panko::Response.create do |r|
49
+ {
50
+ success: true,
51
+ post: r.serializer(post, PostSerializer)
52
+ }
53
+ end
54
+ )
55
+ end
56
+ end
57
+ ```
58
+
36
59
  ## JsonValue
37
60
 
38
61
  Let's take the above example further, we serialized the posts and cached it as JSON string in our Cache.
data/docs/i18n/en.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "_comment": "This file is auto-generated by write-translations.js",
3
+ "localized-strings": {
4
+ "next": "Next",
5
+ "previous": "Previous",
6
+ "tagline": "High Performance JSON Serialization for ActiveRecord & Ruby Objects",
7
+ "docs": {
8
+ "associations": {
9
+ "title": "Associations",
10
+ "sidebar_label": "Associations"
11
+ },
12
+ "attributes": {
13
+ "title": "Attributes",
14
+ "sidebar_label": "Attributes"
15
+ },
16
+ "design-choices": {
17
+ "title": "Design Choices",
18
+ "sidebar_label": "Design Choices"
19
+ },
20
+ "getting-started": {
21
+ "title": "Getting Started",
22
+ "sidebar_label": "Getting Started"
23
+ },
24
+ "index": {
25
+ "title": "Introduction",
26
+ "sidebar_label": "Introduction"
27
+ },
28
+ "performance": {
29
+ "title": "Performance",
30
+ "sidebar_label": "Performance"
31
+ },
32
+ "response-bag": {
33
+ "title": "Response",
34
+ "sidebar_label": "Response"
35
+ }
36
+ },
37
+ "links": {
38
+ "Docs": "Docs"
39
+ },
40
+ "categories": {
41
+ "Panko": "Panko",
42
+ "Reference": "Reference"
43
+ }
44
+ },
45
+ "pages-strings": {
46
+ "Help Translate|recruit community translators for your project": "Help Translate",
47
+ "Edit this Doc|recruitment message asking to edit the doc source": "Edit",
48
+ "Translate this Doc|recruitment message asking to translate the docs": "Translate"
49
+ }
50
+ }