buttercms-ruby 1.9 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/buttercms-ruby.rb +7 -1
- data/lib/buttercms/version.rb +1 -1
- data/spec/lib/butter-ruby_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69371855dc4fc9883ba72a8eabd2ede8e8b5118a79b0435457da54609bde25f4
|
4
|
+
data.tar.gz: 72c527a3185fc8ed00eb56735bc4e2f3abe343058214cef23ce6debba066c169
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c7f9c52c35df85a8ed5f38a3531deddee771529bbb2717c5d5b2cca2a788503a0aecea2672be6bb5f22837a1b453ecbcef7d4f4856dea4b7060e7fc98b74ebf
|
7
|
+
data.tar.gz: 70f72d7bf27b9532904b37aff8c40d1060d33511f34d4bcc2d6c0c24aa24ab19f3a9d587b1d132390a672ecfa5c99172ea2c1880cff33263666ce5bf3330d42b
|
data/lib/buttercms-ruby.rb
CHANGED
@@ -71,7 +71,13 @@ module ButterCMS
|
|
71
71
|
query[:test] = 1
|
72
72
|
end
|
73
73
|
|
74
|
-
|
74
|
+
# If the user has passed in a "/" leading path, don't interpret that
|
75
|
+
# as wanting to get rid of the API prefix
|
76
|
+
if path.start_with?("/")
|
77
|
+
path = path[1..-1]
|
78
|
+
end
|
79
|
+
|
80
|
+
path = Pathname.new(@api_url.path).join(path).to_s + "?#{URI.encode_www_form(query)}"
|
75
81
|
|
76
82
|
response =
|
77
83
|
Net::HTTP.start(@api_url.host, @api_url.port, http_options) do |http|
|
data/lib/buttercms/version.rb
CHANGED
@@ -14,6 +14,22 @@ describe ButterCMS do
|
|
14
14
|
ButterCMS.request('')
|
15
15
|
expect(request).to have_been_made
|
16
16
|
end
|
17
|
+
|
18
|
+
it "should properly escape paths" do
|
19
|
+
request = stub_request(
|
20
|
+
:get,
|
21
|
+
"https://api.buttercms.com/v2/pages/*/homepage%20en?auth_token=test123"
|
22
|
+
).to_return(body: JSON.generate({data: {test: 'test'}}))
|
23
|
+
|
24
|
+
# support leading slashes
|
25
|
+
ButterCMS.request('/pages/*/homepage en')
|
26
|
+
|
27
|
+
# and no leading slashes
|
28
|
+
ButterCMS.request('pages/*/homepage en')
|
29
|
+
|
30
|
+
|
31
|
+
expect(request).to have_been_made.twice
|
32
|
+
end
|
17
33
|
end
|
18
34
|
|
19
35
|
context 'without an api token' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buttercms-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '2.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ButterCMS
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|