Module: Kairos::Client::Utils
- Included in:
- Base
- Defined in:
- lib/kairos/client/utils.rb
Defined Under Namespace
Classes: FaceError
Constant Summary collapse
- API_METHODS =
{ :detect => 'http://api.kairos.io/detect', :enroll => 'http://api.kairos.io/entroll', :recognize => 'http://api.kairos.io/recognize', :gallery_list_all => 'http://api.kairos.io/gallery/list_all', :gallery_view => 'http://api.kairos.io/gallery/view', :gallery_remove_subject => 'http://api.kairos.io/gallery/remove_subject', }
Instance Method Summary collapse
Instance Method Details
#api_crendential ⇒ Object
16 17 18 |
# File 'lib/kairos/client/utils.rb', line 16 def api_crendential { :app_id => app_id, :app_key => app_key } end |
#make_request(api_method, opts = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/kairos/client/utils.rb', line 20 def make_request(api_method, opts={}) response = JSON.parse( RestClient::Request.execute( :method => :post, :url => API_METHODS[ api_method ], :headers => { "app_id" => app_id, "app_key" => app_key }, :payload => opts.to_json )) # if %w/success partial/.include?(response['status']) return response # elsif response['status'] == 'failure' # raise FaceError.new("Error: #{response['error_code']}, #{response['error_message']}") # end end |
#user_auth_param ⇒ Object
38 39 40 41 |
# File 'lib/kairos/client/utils.rb', line 38 def user_auth_param user_auth_value = [] user_auth_value.size > 0 ? { :user_auth => user_auth_value.join(',') } : {} end |