rekognize 0.0.1 → 1.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: e6ec425b35afe0aaddd2428fab06ef8c95f4015a
4
- data.tar.gz: 66d1c9f56c47be34bba975a146f065e075e7719b
3
+ metadata.gz: 0e82c31f2c5970ea2ab78c8cbc9259151f9e89b3
4
+ data.tar.gz: 38bef2bcc97bd4e0b9da4d6f5abed1d57b55444e
5
5
  SHA512:
6
- metadata.gz: 18abc1cd0bb0467d33dc1d51d18dfa9559914ff79cdd6fa9b4308844e642a413eef1ee851be5bd70843290c1c2a253b00f33a61388e20192bc54043173585119
7
- data.tar.gz: 42b0a479d57705ad9f4b69f6008eaf2564911f18a17c2bbc4e27dcdd7ae20329456be07ea7c25728f09fe9c92dde826f5c4b0f9dbdfeedeb6b042388304a2da6
6
+ metadata.gz: 75c0be3f977c60d5217468f916e3ea4bf099605630ec37ca1c0c14d92fdfffce3800f158f998898255a1fc027e3da8911b010870befd738cbc759bff4fc4310b
7
+ data.tar.gz: 61d7c807973b6d715e7ea2efca5d18a1491e10bc526195776f9eb9f97bec59b9ffc52f78c56eefc077e1b47a900cf118c3fcbf0d1c91788f700c94fa9a499d2c
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Rekognize
2
2
 
3
- TODO: Write a gem description
3
+ Sign up for your api credentials at: http://rekognition.com/user/create
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,12 +18,58 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ irb:
22
+ require 'rekognize'
23
+ >> true
22
24
 
23
- ## Contributing
25
+ client = Rekognize::Client::Base.new(api_key: YOUR_API_KEY, api_secret: YOUR_API_SECRET)
26
+ client.face_detect(urls: image_url/base64, jobs: 'face_detect')
24
27
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
28
+ ## Methods
29
+ For the official documentation please refer to: http://rekognition.com/developer/docs
30
+
31
+ face_detect:
32
+ required: [:jobs, :urls]
33
+ optional: []
34
+
35
+ face_add:
36
+ required: [:jobs, :urls]
37
+ optional: [:name_space, :user_id, :tag]
38
+
39
+ face_train:
40
+ required: [:jobs]
41
+ optional: [:name_space, :user_id, :tags]
42
+
43
+ face_cluster:
44
+ required: [:jobs]
45
+ optional: [:name_space, :user_id, :aggressiveness]
46
+
47
+ face_crawl:
48
+ required: [:jobs, :fb_id, :access_token]
49
+ optional: [:name_space, :user_id]
50
+
51
+ face_recognize:
52
+ required: [:jobs, :urls]
53
+ optional: [:name_space, :user_id, :num_return, :tags]
54
+
55
+ face_visualize:
56
+ required: [:jobs]
57
+ optional: [:name_space, :user_id, :tags, :num_tag_return, :num_img_return_pertag]
58
+
59
+ face_search:
60
+ required: [:jobs, :urls]
61
+ optional: [:name_space, :user_id, :num_return]
62
+
63
+ face_delete:
64
+ required: [:jobs, :name_space]
65
+ optional: [:user_id, :tag, :img_index]
66
+
67
+ face_rename:
68
+ required: [:jobs, :tag, :new_tag, :user_id]
69
+ optional: [:img_index]
70
+
71
+ face_stats:
72
+ required: [:jobs]
73
+
74
+ scene_understanding:
75
+ required: [:jobs, :urls]
data/Rakefile CHANGED
@@ -1 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ task :refresh => [:build] do |t|
4
+ sh 'gem install pkg/rekognize-0.0.1.gem'
5
+ end
@@ -0,0 +1,12 @@
1
+ require File.expand_path('../object', __FILE__)
2
+
3
+ class Hash
4
+ def assert_valid_keys(*valid_keys)
5
+ valid_keys.flatten!
6
+ each_key {|k| raise(ArgumentError, "Unknown key #{k}") unless valid_keys.include?(k)}
7
+ end
8
+
9
+ def to_params
10
+ '&'+collect{|k, v| v.to_query(k)}.sort * '&'
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ class Object
2
+
3
+ def to_param
4
+ to_s
5
+ end
6
+
7
+ def to_query(key)
8
+ require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
9
+ "#{CGI.escape(key.to_s).gsub(/%(5B|5D)/n) { [$1].pack('H*') }}=#{CGI.escape(to_param.to_s)}"
10
+ end
11
+ end
@@ -1,5 +1,13 @@
1
1
  require "rekognize/version"
2
+ require 'rest-client'
3
+ require 'json'
4
+
5
+ require File.expand_path('../misc/hash.rb', __FILE__)
6
+ require File.expand_path('../rekognize/client.rb', __FILE__)
2
7
 
3
8
  module Rekognize
4
- # Your code goes here...
9
+ def self.get_client
10
+ Rekognize::Client::Base.new
11
+ end
12
+
5
13
  end
@@ -0,0 +1,7 @@
1
+ require File.expand_path('../client/base.rb', __FILE__)
2
+
3
+ module Rekognize
4
+ module Client
5
+
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ require File.expand_path('../endpoints.rb', __FILE__)
2
+ require File.expand_path('../jobs.rb', __FILE__)
3
+
4
+ module Rekognize
5
+ module Client
6
+ class Base
7
+
8
+ include Rekognize::Client::Endpoints
9
+ include Rekognize::Client::Jobs
10
+
11
+ attr_accessor :api_key, :api_secret
12
+
13
+ def initialize(opts={})
14
+ opts.assert_valid_keys(:api_key, :api_secret)
15
+ @api_key, @api_secret = [opts[:api_key], opts[:api_secret]]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Rekognize
2
+ module Client
3
+ module Endpoints
4
+
5
+ def configure_payload(opts={})
6
+ base_uri = "http://rekognition.com/func/api/?api_key=#{api_key}&api_secret=#{api_secret}"
7
+ base_uri + opts.to_params
8
+ end
9
+
10
+ def get_request(uri)
11
+ JSON.parse RestClient.get(uri)
12
+ end
13
+
14
+ def post_request(opts)
15
+ JSON.parse RestClient.post(base_uri, opts)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,67 @@
1
+ module Rekognize
2
+ module Client
3
+ module Jobs
4
+
5
+ def face_detect(opts={})
6
+ opts.assert_valid_keys(:jobs, :urls)
7
+ get_request configure_payload(opts)
8
+ end
9
+
10
+ def face_add(opts={})
11
+ opts.assert_valid_keys(:jobs, :urls, :name_space, :user_id, :tag)
12
+ post_request opts
13
+ end
14
+
15
+ def face_delete(opts={})
16
+ opts.assert_valid_keys(:jobs, :name_space, :user_id, :tag, :img_index)
17
+ get_request configure_payload(opts)
18
+ end
19
+
20
+ def face_train(opts={})
21
+ opts.assert_valid_keys(:jobs, :name_space, :user_id, :tags)
22
+ post_request opts
23
+ end
24
+
25
+ def face_cluster(opts={})
26
+ opts.assert_valid_keys(:jobs, :name_space, :user_id, :aggressiveness)
27
+ post_request opts
28
+ end
29
+
30
+ def face_crawl(opts={})
31
+ opts.assert_valid_keys(:jobs, :fb_id, :access_token, :name_space, :user_id)
32
+ post_request opts
33
+ end
34
+
35
+ def face_recognize(opts={})
36
+ opts.assert_valid_keys(:jobs, :urls, :name_space, :user_id, :num_return, :tags)
37
+ post_request opts
38
+ end
39
+
40
+ def face_visualize(opts={})
41
+ opts.assert_valid_keys(:jobs, :name_space, :user_id, :tags, :num_tag_return, :num_img_return_pertag)
42
+ post_request opts
43
+ end
44
+
45
+ def face_search(opts={})
46
+ opts.assert_valid_keys(:jobs, :urls, :name_space, :user_id, :num_return)
47
+ post_request opts
48
+ end
49
+
50
+ def face_rename(opts={})
51
+ opts.assert_valid_keys(:jobs, :tag, :new_tag, :name_space, :user_id, :img_index)
52
+ post_request opts
53
+ end
54
+
55
+ def face_stats(opts={})
56
+ opts.assert_valid_keys(:jobs)
57
+ post_request opts
58
+ end
59
+
60
+ def scene_understanding(opts={})
61
+ opts.assert_valid_keys(:jobs, :urls)
62
+ post_request opts
63
+ end
64
+
65
+ end
66
+ end
67
+ end
@@ -1,3 +1,3 @@
1
1
  module Rekognize
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rekognize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis de Vulder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-15 00:00:00.000000000 Z
11
+ date: 2014-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,22 +38,67 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: description
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rest-client
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: json
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: ''
42
84
  email:
43
85
  - dennisdevulder@gmail.com
44
86
  executables: []
45
87
  extensions: []
46
88
  extra_rdoc_files: []
47
89
  files:
48
- - .gitignore
49
- - Gemfile
50
- - LICENSE.txt
51
90
  - README.md
91
+ - Gemfile
52
92
  - Rakefile
53
- - lib/rekognize.rb
93
+ - lib/misc/hash.rb
94
+ - lib/misc/object.rb
95
+ - lib/rekognize/client/base.rb
96
+ - lib/rekognize/client/endpoints.rb
97
+ - lib/rekognize/client/jobs.rb
98
+ - lib/rekognize/client.rb
54
99
  - lib/rekognize/version.rb
55
- - rekognize.gemspec
56
- homepage: http://youfirst.nl
100
+ - lib/rekognize.rb
101
+ homepage: http://rubygems.org/gems/rekognize
57
102
  licenses:
58
103
  - MIT
59
104
  metadata: {}
@@ -76,5 +121,5 @@ rubyforge_project:
76
121
  rubygems_version: 2.1.11
77
122
  signing_key:
78
123
  specification_version: 4
79
- summary: summary
124
+ summary: Ruby wrapper of Rekognition Face and Scenery Detection and Recognition API
80
125
  test_files: []
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 TODO: Write your name
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,23 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'rekognize/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "rekognize"
8
- spec.version = Rekognize::VERSION
9
- spec.authors = ["Dennis de Vulder"]
10
- spec.email = ["dennisdevulder@gmail.com"]
11
- spec.description = %q{description}
12
- spec.summary = %q{summary}
13
- spec.homepage = "http://youfirst.nl"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
23
- end