embulk-filter-google_vision_api 0.2.2 → 0.2.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23c3e4b24c89b8e8193d50ad3f7964d0873ae8c5
|
4
|
+
data.tar.gz: 9a205df2b26eb834c3072db6b7ab4a095fa4211b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49a62de860eff8e03dd743ee8883a2bf21b12bbd4d97693a873cfd802dd490c295f1f57ad4f6a7677b548550f5bacc6abab11c8d40c2d238847f68b98207bf87
|
7
|
+
data.tar.gz: 5178380156538e49d74d73b2533202d955e5fc779203d49fbcf08763cb83c9910e06a85fa6cb3dcaa436b59dac5ede6bda4630d275f3c40f36d20b326f979a49
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
spec.name = "embulk-filter-google_vision_api"
|
4
|
-
spec.version = "0.2.
|
4
|
+
spec.version = "0.2.3"
|
5
5
|
spec.authors = ["toyama0919"]
|
6
6
|
spec.summary = "Google Vision Api filter plugin for Embulk"
|
7
7
|
spec.description = "Google Vision Api filter plugin for Embulk. Very easy image recognition."
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.test_files = spec.files.grep(%r{^(test|spec)/})
|
14
14
|
spec.require_paths = ["lib"]
|
15
15
|
|
16
|
-
spec.add_dependency '
|
16
|
+
spec.add_dependency 'addressable'
|
17
17
|
spec.add_development_dependency 'embulk', ['>= 0.8.16']
|
18
18
|
spec.add_development_dependency 'bundler', ['>= 1.10.6']
|
19
19
|
spec.add_development_dependency 'rake', ['>= 10.0']
|
@@ -1,8 +1,7 @@
|
|
1
1
|
require "json"
|
2
2
|
require "net/http"
|
3
|
-
require "uri"
|
4
|
-
require "openssl"
|
5
3
|
require "base64"
|
4
|
+
require 'addressable/uri'
|
6
5
|
|
7
6
|
module Embulk
|
8
7
|
module Filter
|
@@ -13,7 +12,6 @@ module Embulk
|
|
13
12
|
uri = URI.parse("#{ENDPOINT}?key=#{google_api_key}")
|
14
13
|
@http = Net::HTTP.new(uri.host, uri.port)
|
15
14
|
@http.use_ssl = true
|
16
|
-
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
17
15
|
@post = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' =>'application/json'})
|
18
16
|
@features = features
|
19
17
|
end
|
@@ -58,10 +56,13 @@ module Embulk
|
|
58
56
|
|
59
57
|
def get_image_body(image_path)
|
60
58
|
if image_path =~ /https?\:\/\//
|
61
|
-
Net::HTTP.get_response(URI.parse(image_path))
|
59
|
+
response = Net::HTTP.get_response(Addressable::URI.parse(image_path))
|
60
|
+
response.body
|
62
61
|
else
|
63
|
-
File.read(image_path)
|
62
|
+
File.read(image_path)
|
64
63
|
end
|
64
|
+
rescue => e
|
65
|
+
""
|
65
66
|
end
|
66
67
|
end
|
67
68
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-filter-google_vision_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- toyama0919
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
18
|
version: '0'
|
19
|
-
name:
|
19
|
+
name: addressable
|
20
20
|
prerelease: false
|
21
21
|
type: :runtime
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|