resterl 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -0
- data/lib/resterl/generic_request.rb +2 -5
- data/lib/resterl/version.rb +1 -1
- data/spec/lib/resterl/client_spec.rb +10 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 34e6d5fb43fdcc446afac5ab06419e2632dac2bc2806a1528725d6165b492ab2
|
4
|
+
data.tar.gz: b6038c9b94e3db6134ec0de6cbc1763573c429f5c412186e59e6dd6af8de1dc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4371977339943f3a99831519bc1927724fa4b068902ccd86c2130e5566be7917d9693f0ac2fefd24ea70481f2854daaa1514d59bff59fd8464ece2fee0ea78e
|
7
|
+
data.tar.gz: 64f8c76852a4cd99e033910229f26fbb3be74e4c9162440cd5c47ccd11d7294247f19f15c414a52ff0f6289309827cf10048ade5557df08a58e67d29f450a098
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7.4
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'active_support/core_ext/object/blank'
|
2
|
+
require 'active_support/core_ext/hash'
|
2
3
|
|
3
4
|
module Resterl
|
4
5
|
class GenericRequest
|
@@ -29,11 +30,7 @@ module Resterl
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def query_param_string
|
32
|
-
@query_param_string ||=
|
33
|
-
@query_params.collect do |key, value|
|
34
|
-
"#{URI.escape(key.to_s)}=#{URI.escape(value.to_s)}"
|
35
|
-
end.join('&')
|
36
|
-
end
|
33
|
+
@query_param_string ||= @query_params.to_query
|
37
34
|
end
|
38
35
|
|
39
36
|
def apply_basic_auth request
|
data/lib/resterl/version.rb
CHANGED
@@ -4,6 +4,8 @@ require 'webmock/rspec'
|
|
4
4
|
require 'timecop'
|
5
5
|
|
6
6
|
describe Resterl::Client do
|
7
|
+
subject(:client) { Resterl::Client.new }
|
8
|
+
|
7
9
|
describe 'minimum cache lifetime' do
|
8
10
|
before do
|
9
11
|
Timecop.freeze(Time.parse('2015-01-01 01:00'))
|
@@ -14,7 +16,6 @@ describe Resterl::Client do
|
|
14
16
|
headers: { cache_control: 'max-age=0, private, must-revalidate' }
|
15
17
|
).then.to_raise('2 requests')
|
16
18
|
end
|
17
|
-
let(:client) { Resterl::Client.new }
|
18
19
|
|
19
20
|
it 'is used in "max-age=0" case' do
|
20
21
|
response = client.get 'http://www.example.com/', {}, {}
|
@@ -31,4 +32,12 @@ describe Resterl::Client do
|
|
31
32
|
end.not_to raise_error
|
32
33
|
end
|
33
34
|
end
|
35
|
+
|
36
|
+
it 'encodes url params' do
|
37
|
+
stub_request(
|
38
|
+
:get, "http://www.example.com/?text=Ein%20gro%C3%9Fer%20Spa%C3%9F!"
|
39
|
+
).to_return(status: 200, body: '', headers: {})
|
40
|
+
|
41
|
+
client.get 'http://www.example.com/', { text: 'Ein großer Spaß!' }, {}
|
42
|
+
end
|
34
43
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resterl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Dütsch
|
8
8
|
- Stefan Hoffmann
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-11-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
|
-
description:
|
126
|
+
description:
|
127
127
|
email:
|
128
128
|
- florian.duetsch@nix-wie-weg.de
|
129
129
|
- stefan.hoffmann@nix-wie-weg.de
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- ".document"
|
135
135
|
- ".gitignore"
|
136
136
|
- ".rubocop.yml"
|
137
|
+
- ".ruby-version"
|
137
138
|
- Gemfile
|
138
139
|
- LICENSE
|
139
140
|
- README.rdoc
|
@@ -162,7 +163,7 @@ files:
|
|
162
163
|
homepage: https://github.com/Nix-wie-weg/resterl
|
163
164
|
licenses: []
|
164
165
|
metadata: {}
|
165
|
-
post_install_message:
|
166
|
+
post_install_message:
|
166
167
|
rdoc_options: []
|
167
168
|
require_paths:
|
168
169
|
- lib
|
@@ -177,9 +178,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
178
|
- !ruby/object:Gem::Version
|
178
179
|
version: '0'
|
179
180
|
requirements: []
|
180
|
-
|
181
|
-
|
182
|
-
signing_key:
|
181
|
+
rubygems_version: 3.1.6
|
182
|
+
signing_key:
|
183
183
|
specification_version: 4
|
184
184
|
summary: Rudimentary HTTP client with focus on caching
|
185
185
|
test_files:
|