teapi 0.0.3 → 0.0.4
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/lib/teapi.rb +3 -3
- data/lib/teapi/sender.rb +0 -12
- data/lib/teapi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9efba70f47e061c23daf22609ca3de99ca12d04
|
4
|
+
data.tar.gz: d2d16fa7c2e0cbb040450a502ac292a476d528f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 593ea60d31c235c808969579b78b7629a27dc294e719e263950481c5caa78be98bc1bc9d8eb95d96cd238cb9b0beb1322b03c88f0d66d4615eec5563dab664ef
|
7
|
+
data.tar.gz: aeb8df18626a7df99e5aaf0c94b1d0a46acb6c788c5dea40178678e8d7cdb9c4236cfc1a06b8bae0344edde729488d9f2cd35b095ecd4e48eb64b647b02a0277
|
data/lib/teapi.rb
CHANGED
@@ -26,7 +26,7 @@ module Teapi #:nodoc
|
|
26
26
|
|
27
27
|
# Issues a POST request to the teapi.io service
|
28
28
|
# @param resource [Symbol] name of resource
|
29
|
-
# @param body [
|
29
|
+
# @param body [String] to send to the service
|
30
30
|
def post(resource, body)
|
31
31
|
assert_configured()
|
32
32
|
sender.request(:post, resource, {body: body})
|
@@ -34,7 +34,7 @@ module Teapi #:nodoc
|
|
34
34
|
|
35
35
|
# Issues a PUT request to the teapi.io service
|
36
36
|
# @param resource [Symbol] name of resource
|
37
|
-
# @param body [
|
37
|
+
# @param body [String] to send to the service
|
38
38
|
def put(resource, body)
|
39
39
|
assert_configured()
|
40
40
|
sender.request(:put, resource, {body: body})
|
@@ -42,7 +42,7 @@ module Teapi #:nodoc
|
|
42
42
|
|
43
43
|
# Issues a DELETE request to the teapi.io service
|
44
44
|
# @param resource [Symbol] name of resource
|
45
|
-
# @param body [
|
45
|
+
# @param body [String] to send to the service
|
46
46
|
def delete(resource, body)
|
47
47
|
assert_configured()
|
48
48
|
sender.request(:delete, resource, {body: body})
|
data/lib/teapi/sender.rb
CHANGED
@@ -22,10 +22,6 @@ module Teapi
|
|
22
22
|
'Date' => d,
|
23
23
|
'Authorization' => sign(url, d, args),
|
24
24
|
})
|
25
|
-
if args[:body] != nil && args[:body].length > 1024 then
|
26
|
-
args[:body] = gzip(args[:body])
|
27
|
-
args[:headers]['Content-Encoding'] = 'gzip'
|
28
|
-
end
|
29
25
|
scheme = @configuration.secure ? "https" : "http"
|
30
26
|
res = HTTParty.send(method, "#{scheme}://#{@configuration.host}#{url}", args)
|
31
27
|
if res.code == 401 && res.parsed_response.include?('date') && date.nil?
|
@@ -40,13 +36,5 @@ module Teapi
|
|
40
36
|
signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), @configuration.sync_secret, data)
|
41
37
|
"HMAC-SHA256 Credential=#{@configuration.sync_key},Signature=#{signature}"
|
42
38
|
end
|
43
|
-
|
44
|
-
def gzip(body)
|
45
|
-
io = StringIO.new("w")
|
46
|
-
gz = Zlib::GzipWriter.new(io)
|
47
|
-
gz.write(body)
|
48
|
-
gz.close
|
49
|
-
io.string
|
50
|
-
end
|
51
39
|
end
|
52
40
|
end
|
data/lib/teapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Seguin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|