maremma 2.1 → 2.1.1
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 +8 -8
- data/Gemfile.lock +3 -3
- data/lib/maremma/version.rb +1 -1
- data/lib/maremma.rb +3 -3
- data/spec/maremma_spec.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmViMTFhMmVkNTczYTJmNmJkN2VkZWIzMTJhNTM3M2Q0NjlhM2QxYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGFkMDVkNWEzODdhNDExOWY5ZTE0ZjA1OGM0ZjJkYjY4MjI4ZTg2Nw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWNkZjkyNjUzOWRmOTQ2NjcwZTk4MTRmNTQzZjQ0NTA4ZGNjZDAxMDNmMGI3
|
10
|
+
MzcwMDAxMDEyYTc1ZWRhOGYxNDY4Nzg4NTQzOWYzNWY0YmYyMDdiNjVkMmQ5
|
11
|
+
NzRjMWViZTQ2MDc3ZWIxMTgyYTg1NTVmMTkxMTk4YzIzYzIzMmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTQ0NDhhMzc3ODIzOTI5YjRmZjliNzRlNDZjMTc1OWRlOWQxMjViMTBlNDhj
|
14
|
+
ODQzNGY5OGY1ZDYwOGU5MWQxNGRhYTUzZWZjMTU4ZmRmYzViODcyNGExZTM1
|
15
|
+
NWNlYjEzNzJmNTE4NjYyOGI4Yzg1MDQwNDVmNDAyOTA1ODA2ZTI=
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
maremma (2.1)
|
4
|
+
maremma (2.1.1)
|
5
5
|
activesupport (~> 4.2, >= 4.2.5)
|
6
6
|
builder (~> 3.2, >= 3.2.2)
|
7
7
|
excon (~> 0.45.0)
|
@@ -15,7 +15,7 @@ PATH
|
|
15
15
|
GEM
|
16
16
|
remote: https://rubygems.org/
|
17
17
|
specs:
|
18
|
-
activesupport (4.2.5.
|
18
|
+
activesupport (4.2.5.1)
|
19
19
|
i18n (~> 0.7)
|
20
20
|
json (~> 1.7, >= 1.7.7)
|
21
21
|
minitest (~> 5.1)
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
excon (0.45.4)
|
30
30
|
faraday (0.9.2)
|
31
31
|
multipart-post (>= 1.2, < 3)
|
32
|
-
faraday-encoding (0.0.
|
32
|
+
faraday-encoding (0.0.1)
|
33
33
|
faraday
|
34
34
|
faraday_middleware (0.10.0)
|
35
35
|
faraday (>= 0.7.4, < 0.10)
|
data/lib/maremma/version.rb
CHANGED
data/lib/maremma.rb
CHANGED
@@ -22,7 +22,7 @@ module Maremma
|
|
22
22
|
def self.post(url, options={})
|
23
23
|
options[:content_type] ||= 'json'
|
24
24
|
options[:data] ||= {}
|
25
|
-
options[:headers] =
|
25
|
+
options[:headers] = set_request_headers(url, options)
|
26
26
|
|
27
27
|
conn = faraday_conn(options[:content_type], options)
|
28
28
|
|
@@ -38,7 +38,7 @@ module Maremma
|
|
38
38
|
|
39
39
|
def self.get(url, options={})
|
40
40
|
options[:content_type] ||= 'json'
|
41
|
-
options[:headers] =
|
41
|
+
options[:headers] = set_request_headers(url, options)
|
42
42
|
|
43
43
|
conn = faraday_conn(options[:content_type], options)
|
44
44
|
|
@@ -80,7 +80,7 @@ module Maremma
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
def self.
|
83
|
+
def self.set_request_headers(url, options)
|
84
84
|
options[:headers] ||= {}
|
85
85
|
options[:headers]['Host'] = URI.parse(url).host
|
86
86
|
|
data/spec/maremma_spec.rb
CHANGED
@@ -283,23 +283,23 @@ describe Maremma do
|
|
283
283
|
context 'authentication' do
|
284
284
|
it 'no auth' do
|
285
285
|
options = {}
|
286
|
-
expect(subject.
|
286
|
+
expect(subject.set_request_headers(url, options)).to eq("Host"=>"example.org")
|
287
287
|
end
|
288
288
|
|
289
289
|
it 'bearer' do
|
290
290
|
options = { bearer: 'mF_9.B5f-4.1JqM' }
|
291
|
-
expect(subject.
|
291
|
+
expect(subject.set_request_headers(url, options)).to eq("Host"=>"example.org", "Authorization"=>"Bearer mF_9.B5f-4.1JqM")
|
292
292
|
end
|
293
293
|
|
294
294
|
it 'token' do
|
295
295
|
options = { token: '12345' }
|
296
|
-
expect(subject.
|
296
|
+
expect(subject.set_request_headers(url, options)).to eq("Host"=>"example.org", "Authorization"=>"Token token=12345")
|
297
297
|
end
|
298
298
|
|
299
299
|
it 'basic' do
|
300
300
|
options = { username: 'foo', password: '12345' }
|
301
301
|
basic = Base64.encode64("foo:12345")
|
302
|
-
expect(subject.
|
302
|
+
expect(subject.set_request_headers(url, options)).to eq("Host"=>"example.org", "Authorization"=>"Basic #{basic}")
|
303
303
|
end
|
304
304
|
end
|
305
305
|
end
|