kairos 0.0.6 → 0.0.7

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: a6e1c1bc804295ff56e78bb380de870f4d2cc3ef
4
- data.tar.gz: 7a2a142abdf523200013c66e5ad0c8e8f391402a
3
+ metadata.gz: 023d156b553d7f0f02b81f8c56d5beae3e8e3b7f
4
+ data.tar.gz: 20bc8dbbe0436129bc7a8eb98c4094bd56754069
5
5
  SHA512:
6
- metadata.gz: 53093911e74f8743a076aab54732c72737ab733d9b05c1dffd381a97b9f7520b7bffcd1ea9ab57323b2759b1fac63e2bc58173424b22b52d503e7caf854c8036
7
- data.tar.gz: 29c881ba915ae7c51c1c9eb2d9735d76dda09c3666d07d5f348e68fb774458c288f9324c4deb12ab864fcec0b29429a9911f15f124d2c3a7fba5e1e9e8c3a0b6
6
+ metadata.gz: cb8050493fa76f40accf0ad91a1168f268f8ba7e95fda4487c948512f011ac7b6a473a34adb101b88e7145a47f7442e9249279f278a5332971bcba740cf85611
7
+ data.tar.gz: 08db1b452e66ba98b15d2ac5699daaa1bfb796d5f8fa4a13866e9b0bfa1e86c21f640bbf8580e40c3c2e78a645c01f04c9e45762d0ee5e2e7164930ef95dd398
@@ -1,11 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kairos (0.0.2)
4
+ kairos (0.0.7)
5
+ json (>= 1.4.6)
6
+ rest-client (>= 1.6.1)
5
7
 
6
8
  GEM
7
9
  remote: https://rubygems.org/
8
10
  specs:
11
+ json (1.8.1)
12
+ mime-types (2.3)
13
+ netrc (0.7.7)
14
+ rest-client (1.7.1)
15
+ mime-types (>= 1.16, < 3.0)
16
+ netrc (~> 0.7)
9
17
 
10
18
  PLATFORMS
11
19
  ruby
@@ -9,32 +9,11 @@ module Kairos
9
9
 
10
10
  attr_accessor :app_id, :app_key
11
11
 
12
- # #{
13
- # # twitter_username => [twitter screen name]
14
- # # twitter_password => [twitter password]
15
- # #}
16
- # attr_accessor :twitter_credentials
17
-
18
- # #{
19
- # # twitter_oauth_user => [twitter OAuth user]
20
- # # twitter_oauth_secret => [twitter OAuth secret]
21
- # # twitter_oauth_token => [twitter OAuth token]
22
- # #}
23
- # attr_accessor :twitter_oauth_credentials
24
-
25
- # #{
26
- # # fb_user => [facebook user id]
27
- # # fb_session => [facebook session id]
28
- # # fb_oauth_token => [facebook oauth 2.0 access token]
29
- # #}
30
- # attr_accessor :facebook_credentials
31
-
32
12
  include Kairos::Client::Utils
33
13
  include Kairos::Client::Recognition
34
14
  # include Kairos::Client::Tags
35
15
  # include Kairos::Client::Accounts
36
16
 
37
-
38
17
  def initialize(opts={})
39
18
  opts.assert_valid_keys(:app_id, :app_key)
40
19
  @app_id, @app_key = opts[:app_id], opts[:app_key]
@@ -1,12 +1,36 @@
1
1
  module Kairos
2
2
  module Client
3
3
  module Recognition
4
-
4
+
5
+ def enroll(opts={})
6
+ opts.assert_valid_keys(:url, :subject_id, :gallery_name)
7
+ make_request(:enroll, opts)
8
+ end
9
+
10
+ def recognize(opts={})
11
+ opts.assert_valid_keys(:url, :gallery_name, :threshold, :max_num_results)
12
+ make_request(:recognize, opts)
13
+ end
14
+
5
15
  def detect(opts={})
6
16
  opts.assert_valid_keys(:url)
7
17
  make_request(:detect, opts)
8
18
  end
9
19
 
20
+ def gallery_list_all()
21
+ make_request(:gallery_list_all)
22
+ end
23
+
24
+ def gallery_view(opts={})
25
+ opts.assert_valid_keys(:gallery_name)
26
+ make_request(:gallery_view, opts)
27
+ end
28
+
29
+ def gallery_remove_subject(opts={})
30
+ opts.assert_valid_keys(:gallery_name, :subject_id)
31
+ make_request(:gallery_remove_subject, opts)
32
+ end
33
+
10
34
  end
11
35
  end
12
36
  end
@@ -6,30 +6,18 @@ module Kairos
6
6
 
7
7
  API_METHODS = {
8
8
  :detect => 'http://api.kairos.io/detect',
9
+ :enroll => 'http://api.kairos.io/entroll',
10
+ :recognize => 'http://api.kairos.io/recognize',
11
+ :gallery_list_all => 'http://api.kairos.io/gallery/list_all',
12
+ :gallery_view => 'http://api.kairos.io/gallery/view',
13
+ :gallery_remove_subject => 'http://api.kairos.io/gallery/remove_subject',
9
14
  }
10
15
 
11
16
  def api_crendential
12
17
  { :app_id => app_id, :app_key => app_key }
13
18
  end
14
19
 
15
- def make_request(api_method, opts={})
16
- # if opts[:url].is_a? Array
17
- # opts[:url] = opts[:url].join(',')
18
- # end
19
-
20
- # if opts[:uids].is_a? Array
21
- # opts[:uids] = opts[:uids].join(',')
22
- # end
23
-
24
- # if opts[:tids].is_a? Array
25
- # opts[:tids] = opts[:tids].join(',')
26
- # end
27
-
28
- # if opts[:pids].is_a? Array
29
- # opts[:pids] = opts[:pids].join(',')
30
- # end
31
-
32
- # response = JSON.parse( RestClient.post(API_METHODS[ api_method ], opts.merge(api_crendential)).body )
20
+ def make_request(api_method, opts={})
33
21
  response = JSON.parse( RestClient::Request.execute(
34
22
  :method => :post,
35
23
  :url => API_METHODS[ api_method ],
@@ -49,20 +37,6 @@ module Kairos
49
37
 
50
38
  def user_auth_param
51
39
  user_auth_value = []
52
- # if twitter_credentials
53
- # twitter_credentials.each do |k, v|
54
- # user_auth_value << "#{k}:#{v}"
55
- # end
56
- # elsif twitter_oauth_credentials
57
- # twitter_oauth_credentials.each do |k,v|
58
- # user_auth_value << "#{k}:#{v}"
59
- # end
60
- # end
61
- # if facebook_credentials
62
- # facebook_credentials.each do |k, v|
63
- # user_auth_value << "#{k}:#{v}"
64
- # end
65
- # end
66
40
  user_auth_value.size > 0 ? { :user_auth => user_auth_value.join(',') } : {}
67
41
  end
68
42
 
@@ -1,3 +1,3 @@
1
1
  module Kairos
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kairos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Allick