tinplate 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba23118a45b0d10c153fc40b6b3e65c600a4854e
4
- data.tar.gz: 5be87df8bd610dc667f30d81bbe2248ec881aec9
3
+ metadata.gz: 1a74f2e93dd8ade88b665a77758c7e5b2d95bfb6
4
+ data.tar.gz: afb9a34fa0b1ee059d232c52dc3e2ab66818412c
5
5
  SHA512:
6
- metadata.gz: e4e3cf73996b52331ff949cd81527dc6b337c4d0ab2a2efc5848201ad681adf34803680ef12b822fcb48e23a8bc5589ebfda4137e5406bae45fb9819b34fb31f
7
- data.tar.gz: 0cec435914711cb5fba98aa01fd42682e794700faaa425970e0d104a0eb5ae531e7631199bf26563847e20e1f5d470519daed3f6f617dc6c3290d6cfa93db789
6
+ metadata.gz: ec377ce0cee4b860c942e69728accaa88c3b99493415a1181a4611e86e5a5c3e6548e771c52f5e8494ff00954839d4cacffcefa8f4a018926b2238cfebfa08a6
7
+ data.tar.gz: 8b48f5e54f0172271f1b24e8dfd8a2c9a647efc5e0b84102bca5929c721de1c7b33f11a0201eaafabd996a836968296f1075edc6c1479b93f97912841e6f9087
data/README.md CHANGED
@@ -49,9 +49,9 @@ There are only three API actions available: `search`, `remaining_searches` (to c
49
49
  tineye = Tinplate::TinEye.new
50
50
  results = tineye.search(image_url: "http://example.com/photo.jpg")
51
51
 
52
- results.total_results # => 2
53
- results.total_backlinks # => 3
54
- results.matches # => an Array of matched images (see below)
52
+ results.stats.total_results # => 2
53
+ results.stats.total_backlinks # => 3
54
+ results.matches # => an Array of matched images (see below)
55
55
 
56
56
  results.matches.each do |match|
57
57
  # Do what you like with this matched image. The world is your oyster.
@@ -77,9 +77,14 @@ results = tineye.search(image_path: "/home/alice/example.jpg")
77
77
  An `OpenStruct` object with the following attributes (/w example values):
78
78
 
79
79
  ```ruby
80
+ domain: "ucsb.edu",
81
+ top_level_domain: "ucsb.edu",
80
82
  width: 400
81
83
  height: 300
82
- size: 50734
84
+ size: 50734,
85
+ filesize: 195840,
86
+ score: 88.9,
87
+ tags: ["collection"],
83
88
  image_url: "http://images.tineye.com/result/0f1e84b7b7538e8e7de048f4d45eb8f579e3e999941b3341ed9a754eb447ebb1",
84
89
  format: "JPEG",
85
90
  contributor: true,
@@ -45,7 +45,7 @@ module Tinplate
45
45
  end
46
46
 
47
47
  def signature
48
- OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha1"),
48
+ OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha256"),
49
49
  Tinplate.configuration.private_key,
50
50
  signature_components.join)
51
51
  end
@@ -1,9 +1,8 @@
1
1
  module Tinplate
2
2
  class SearchResults < OpenStruct
3
3
  def initialize(data)
4
- super total_backlinks: data["total_backlinks"],
5
- total_results: data["total_results"],
6
- matches: parsed_matches(data["matches"])
4
+ super stats: OpenStruct.new(data["stats"]),
5
+ matches: parsed_matches(data["results"]["matches"])
7
6
  end
8
7
 
9
8
  private
@@ -18,14 +18,19 @@ module Tinplate
18
18
 
19
19
  response = request("search", options.merge(img))
20
20
 
21
- Tinplate::SearchResults.new(response["results"])
21
+ Tinplate::SearchResults.new(response)
22
22
  end
23
23
 
24
24
  def remaining_searches
25
25
  results = request("remaining_searches")["results"]
26
- OpenStruct.new(remaining_searches: results["remaining_searches"],
27
- start_date: DateTime.parse(results["start_date"]),
28
- expire_date: DateTime.parse(results["expire_date"]))
26
+
27
+ bundles = results["bundles"].map do |bundle|
28
+ OpenStruct.new(remaining_searches: bundle["remaining_searches"],
29
+ start_date: DateTime.parse(bundle["start_date"]),
30
+ expire_date: DateTime.parse(bundle["expire_date"]))
31
+ end
32
+
33
+ OpenStruct.new(total_remaining_searches: results["total_remaining_searches"], bundles: bundles)
29
34
  end
30
35
 
31
36
  def image_count
@@ -1,3 +1,3 @@
1
1
  module Tinplate
2
- VERSION = "1.1.0"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinplate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Klaassen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-03 00:00:00.000000000 Z
11
+ date: 2017-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday