cloudsight 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -5
- data/Gemfile.lock +27 -9
- data/cloudsight.gemspec +17 -13
- data/lib/cloudsight.rb +20 -3
- metadata +36 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88263f76dbd9b938a6196193e5f9d2695ad28c29
|
4
|
+
data.tar.gz: 195421c20284a46e5e8967026958f8a779a4e377
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0526368cef6a2cd9c8cfdb4b4c3f9ae99f1e7628198b051bce03dcbe1db6dbedc0570c606861bc7886983760310f362152fe77a07e77595c09c31e160b238f5
|
7
|
+
data.tar.gz: 5f841aa7c29d5da09d398119a1af5402d780b3362b348dd6433ea5e2a47849812ec6c1ae1ee83f5e29e849ef9c23274abf8121510fbc985fb0baa9b88de462ad
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,18 +1,36 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cloudsight (0.0.2)
|
5
|
+
json
|
6
|
+
rest-client (~> 1.6)
|
7
|
+
|
1
8
|
GEM
|
2
9
|
remote: https://rubygems.org/
|
3
10
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
11
|
+
domain_name (0.5.20170404)
|
12
|
+
unf (>= 0.0.5, < 1.0.0)
|
13
|
+
http-cookie (1.0.3)
|
14
|
+
domain_name (~> 0.5)
|
15
|
+
json (2.1.0)
|
16
|
+
mime-types (2.99.3)
|
17
|
+
netrc (0.11.0)
|
18
|
+
rake (12.0.0)
|
19
|
+
rest-client (1.8.0)
|
20
|
+
http-cookie (>= 1.0.2, < 2.0)
|
21
|
+
mime-types (>= 1.16, < 3.0)
|
22
|
+
netrc (~> 0.7)
|
23
|
+
unf (0.1.4)
|
24
|
+
unf_ext
|
25
|
+
unf_ext (0.0.7.4)
|
10
26
|
|
11
27
|
PLATFORMS
|
12
28
|
ruby
|
13
29
|
|
14
30
|
DEPENDENCIES
|
15
|
-
|
31
|
+
bundler (~> 1.6)
|
32
|
+
cloudsight!
|
16
33
|
rake
|
17
|
-
|
18
|
-
|
34
|
+
|
35
|
+
BUNDLED WITH
|
36
|
+
1.13.7
|
data/cloudsight.gemspec
CHANGED
@@ -12,20 +12,24 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.authors = ['Brad Folkens']
|
13
13
|
s.email = 'brad@cloudsightapi.com'
|
14
14
|
s.homepage = 'http://github.com/cloudsight/cloudsight-ruby'
|
15
|
-
|
16
|
-
|
15
|
+
s.license = 'MIT'
|
16
|
+
s.platform = Gem::Platform::RUBY
|
17
17
|
|
18
18
|
s.files = [
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
'lib/cloudsight.rb',
|
20
|
+
'Gemfile',
|
21
|
+
'Gemfile.lock',
|
22
|
+
'MIT-LICENSE',
|
23
|
+
'README.md',
|
24
|
+
'cloudsight.gemspec'
|
25
|
+
]
|
26
|
+
s.require_paths = [%q{lib}]
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
s.required_ruby_version = Gem::Requirement.new('>= 1.9.1')
|
29
|
+
|
30
|
+
s.add_dependency 'json'
|
31
|
+
s.add_dependency 'rest-client', '~>1.6'
|
32
|
+
|
33
|
+
s.add_development_dependency 'bundler', '~> 1.6'
|
34
|
+
s.add_development_dependency 'rake'
|
31
35
|
end
|
data/lib/cloudsight.rb
CHANGED
@@ -8,7 +8,7 @@ end
|
|
8
8
|
require 'json'
|
9
9
|
|
10
10
|
module Cloudsight
|
11
|
-
BASE_URL = 'https://api.
|
11
|
+
BASE_URL = 'https://api.cloudsight.ai'
|
12
12
|
|
13
13
|
class << self
|
14
14
|
def oauth_options=(val)
|
@@ -51,11 +51,15 @@ module Cloudsight
|
|
51
51
|
filtered_payload.delete('image_request[image]')
|
52
52
|
end
|
53
53
|
|
54
|
-
oauth = SimpleOAuth::Header.new(params[:method], params[:url], filtered_payload, Cloudsight.oauth_options)
|
54
|
+
oauth = SimpleOAuth::Header.new(params[:method], params[:url], filtered_payload, Cloudsight.oauth_options || {})
|
55
55
|
req.add_field 'Authorization', oauth.to_s
|
56
56
|
end
|
57
57
|
|
58
|
-
|
58
|
+
begin
|
59
|
+
retval = yield
|
60
|
+
rescue RestClient::Exception => e
|
61
|
+
retval = e.response
|
62
|
+
end
|
59
63
|
|
60
64
|
RestClient.reset_before_execution_procs
|
61
65
|
|
@@ -88,6 +92,19 @@ module Cloudsight
|
|
88
92
|
|
89
93
|
data
|
90
94
|
end
|
95
|
+
|
96
|
+
def self.repost(token, options = {})
|
97
|
+
url = "#{Cloudsight::base_url}/image_requests/#{token}/repost"
|
98
|
+
|
99
|
+
response = Util.wrap_request { RestClient.post(url, options) }
|
100
|
+
return true if response.code == 200 and response.body.to_s.strip.empty?
|
101
|
+
|
102
|
+
data = JSON.parse(response.body)
|
103
|
+
raise ResponseException.new(data['error']) if data['error']
|
104
|
+
raise UnexpectedResponseException.new(response.body) unless data['token']
|
105
|
+
|
106
|
+
data
|
107
|
+
end
|
91
108
|
end
|
92
109
|
|
93
110
|
class Response
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudsight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Folkens
|
@@ -10,32 +10,60 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2015-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: bundler
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
16
44
|
requirements:
|
17
|
-
- - ~>
|
45
|
+
- - "~>"
|
18
46
|
- !ruby/object:Gem::Version
|
19
47
|
version: '1.6'
|
20
48
|
type: :development
|
21
49
|
prerelease: false
|
22
50
|
version_requirements: !ruby/object:Gem::Requirement
|
23
51
|
requirements:
|
24
|
-
- - ~>
|
52
|
+
- - "~>"
|
25
53
|
- !ruby/object:Gem::Version
|
26
54
|
version: '1.6'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: rake
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
30
58
|
requirements:
|
31
|
-
- -
|
59
|
+
- - ">="
|
32
60
|
- !ruby/object:Gem::Version
|
33
61
|
version: '0'
|
34
62
|
type: :development
|
35
63
|
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
|
-
- -
|
66
|
+
- - ">="
|
39
67
|
- !ruby/object:Gem::Version
|
40
68
|
version: '0'
|
41
69
|
description: A simple CloudSight API Client for Image Recognition
|
@@ -60,19 +88,18 @@ require_paths:
|
|
60
88
|
- lib
|
61
89
|
required_ruby_version: !ruby/object:Gem::Requirement
|
62
90
|
requirements:
|
63
|
-
- -
|
91
|
+
- - ">="
|
64
92
|
- !ruby/object:Gem::Version
|
65
93
|
version: 1.9.1
|
66
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
95
|
requirements:
|
68
|
-
- -
|
96
|
+
- - ">="
|
69
97
|
- !ruby/object:Gem::Version
|
70
98
|
version: '0'
|
71
99
|
requirements: []
|
72
100
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.4.
|
101
|
+
rubygems_version: 2.4.8
|
74
102
|
signing_key:
|
75
103
|
specification_version: 4
|
76
104
|
summary: CloudSight API Client
|
77
105
|
test_files: []
|
78
|
-
has_rdoc:
|