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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ditto/client.rb +8 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d53ba478122a7215914b4b6e5ca21b53917f67e2
4
- data.tar.gz: 970e89b2f0a3e90247462e0303bff097b56603d8
3
+ metadata.gz: d075e50bf5c89c202272e18f25feb48910fb2e29
4
+ data.tar.gz: bb0649c48501522b1423cca969f7e1ca3a150d68
5
5
  SHA512:
6
- metadata.gz: 8b74a4f829bdd0a7239a56f278d5a9ee9e36bfcf1a11873751a0e1d1b0356472518fe39a5e4c0846c2247a9da77f15446b09e63ef1f7587b3f29118409c799eb
7
- data.tar.gz: 99afd7e520212d277fedcaf20885d7da5e7b5a88817d4bf1171fd711dfc9ee00fb83b0ae98ddeaab0be8bbbf152a23b502052296027699b64512f59dcabc150e
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
- response = Net::HTTP.get_response(find_uri(url, id))
10
+ code, body = find_raw(url, id)
11
11
 
12
- case response.code
12
+ case code
13
13
  when "200"
14
- Image.new(JSON.parse(response.body, symbolize_names: true))
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.1
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 00:00:00.000000000 Z
11
+ date: 2015-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake