tinplate 1.1.0 → 2.0.0
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/README.md +9 -4
- data/lib/tinplate/request_authenticator.rb +1 -1
- data/lib/tinplate/search_results.rb +2 -3
- data/lib/tinplate/tineye.rb +9 -4
- data/lib/tinplate/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: 1a74f2e93dd8ade88b665a77758c7e5b2d95bfb6
|
4
|
+
data.tar.gz: afb9a34fa0b1ee059d232c52dc3e2ab66818412c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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,
|
@@ -1,9 +1,8 @@
|
|
1
1
|
module Tinplate
|
2
2
|
class SearchResults < OpenStruct
|
3
3
|
def initialize(data)
|
4
|
-
super
|
5
|
-
|
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
|
data/lib/tinplate/tineye.rb
CHANGED
@@ -18,14 +18,19 @@ module Tinplate
|
|
18
18
|
|
19
19
|
response = request("search", options.merge(img))
|
20
20
|
|
21
|
-
Tinplate::SearchResults.new(response
|
21
|
+
Tinplate::SearchResults.new(response)
|
22
22
|
end
|
23
23
|
|
24
24
|
def remaining_searches
|
25
25
|
results = request("remaining_searches")["results"]
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
data/lib/tinplate/version.rb
CHANGED
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:
|
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-
|
11
|
+
date: 2017-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|