sanity-ruby 0.6.0 → 0.7.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.
- checksums.yaml +4 -4
- data/Gemfile +6 -0
- data/README.md +6 -0
- data/lib/sanity/http/where.rb +12 -1
- data/lib/sanity/version.rb +1 -1
- data/lib/sanity.rb +1 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eac71da998761b24763c53a7d5751006738582374052c9a306240d3e06c8a90
|
4
|
+
data.tar.gz: 7f00d6937d416db65496fc130219f07e4663809acdf9c98f3de73a53b4ae60cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e1b8494784ef0076d78e0317c9627e4ff9eba2d132a3d8cb263ca48e410d978594b8186133fb2ba4e0f3431ee986d6ec13554ffb0ca15c5811c2e34a04e79ee
|
7
|
+
data.tar.gz: 876b992ee2bb568d79a10588bf8ee443d301b2d9a386a12de9c2373e0f4d5dda211f9b4639a2445d59409c035b86c7ee3cef8dac38056dd0a233cbde768b8b36
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -12,6 +12,12 @@ The library also provides other features, like:
|
|
12
12
|
- Extensibility in overriding the serializer for the API response results
|
13
13
|
- A small DSL around GROQ queries
|
14
14
|
|
15
|
+
> [!NOTE]
|
16
|
+
> This gem was originally developed in early 2021 to facilitate Morning Brew's content migration from Rails to Sanity. It was subsequently used to enable interaction between Morning Brew's Rails-based Advertising CMS and their Sanity-based Editorial CMS for another ~year. The gem is no longer actively used in production as the Rails applications have since been deprecated, but it remains available as an open-source solution for Ruby - Sanity integrations.
|
17
|
+
|
18
|
+
> [!WARNING]
|
19
|
+
> If you're looking for a way to embed Sanity Studio within a Rails application, this gem is not the solution.
|
20
|
+
|
15
21
|
## Contents
|
16
22
|
|
17
23
|
- [Sanity](#sanity)
|
data/lib/sanity/http/where.rb
CHANGED
@@ -41,7 +41,7 @@ module Sanity
|
|
41
41
|
else
|
42
42
|
{}.tap do |hash|
|
43
43
|
variables.each do |key, value|
|
44
|
-
hash["$#{key}"] =
|
44
|
+
hash["$#{key}"] = serialize_variable_value(value)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end.merge(query: groq_query)
|
@@ -56,6 +56,17 @@ module Sanity
|
|
56
56
|
|
57
57
|
query_and_variables.to_json
|
58
58
|
end
|
59
|
+
|
60
|
+
def serialize_variable_value(value)
|
61
|
+
case value
|
62
|
+
when String
|
63
|
+
"\"#{value}\""
|
64
|
+
when Array, Hash
|
65
|
+
value.to_json
|
66
|
+
else
|
67
|
+
value.to_s
|
68
|
+
end
|
69
|
+
end
|
59
70
|
end
|
60
71
|
end
|
61
72
|
end
|
data/lib/sanity/version.rb
CHANGED
data/lib/sanity.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sanity-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Drew Monroe
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -94,7 +94,7 @@ metadata:
|
|
94
94
|
homepage_uri: https://github.com/dvmonroe/sanity-ruby
|
95
95
|
source_code_uri: https://github.com/dvmonroe/sanity-ruby
|
96
96
|
changelog_uri: https://github.com/dvmonroe/sanity-ruby
|
97
|
-
post_install_message:
|
97
|
+
post_install_message:
|
98
98
|
rdoc_options: []
|
99
99
|
require_paths:
|
100
100
|
- lib
|
@@ -109,8 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
113
|
-
signing_key:
|
112
|
+
rubygems_version: 3.4.17
|
113
|
+
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Ruby bindings for the Sanity API
|
116
116
|
test_files: []
|