ditto_api 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ditto/client.rb +8 -3
- 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: d075e50bf5c89c202272e18f25feb48910fb2e29
|
4
|
+
data.tar.gz: bb0649c48501522b1423cca969f7e1ca3a150d68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7149312edc2c0ccf96bc5bf3b3ae5c645f6158b42d1f01647b8b09f7e50eccffb95587fdbd82d1be88f42e50a6e64c37b9eeaca2c80e436e7c648f24970543f6
|
7
|
+
data.tar.gz: 99a6b88fff6527150c959d44eb184a863c6a032658a49c4466a56a3646591fa24fc927b86f9cfa23f9b4f160ec83619caf531709c57e6a8c99dbe04a937ca1a8
|
data/lib/ditto/client.rb
CHANGED
@@ -7,11 +7,11 @@ module Ditto
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def find(url, id)
|
10
|
-
|
10
|
+
code, body = find_raw(url, id)
|
11
11
|
|
12
|
-
case
|
12
|
+
case code
|
13
13
|
when "200"
|
14
|
-
Image.new(JSON.parse(
|
14
|
+
Image.new(JSON.parse(body, symbolize_names: true))
|
15
15
|
when "408"
|
16
16
|
raise ImageTimeoutError
|
17
17
|
when "415"
|
@@ -19,6 +19,11 @@ module Ditto
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def find_raw(url, id)
|
23
|
+
response = Net::HTTP.get_response(find_uri(url, id))
|
24
|
+
[response.code, response.body]
|
25
|
+
end
|
26
|
+
|
22
27
|
def find_uri(url, id)
|
23
28
|
URI::HTTP.build(
|
24
29
|
host: "ondemand-p02-api.ditto.us.com",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ditto_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Sheehan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|