class KairosRB::Client
Public Class Methods
new(app_id:, app_key:)
click to toggle source
# File lib/kairos_rb/client.rb, line 7 def initialize(app_id:, app_key:) @connection = KairosRB::Connection.new( app_id: app_id, app_key: app_key ) end
Public Instance Methods
add_media(media:, landmarks: 1, timeout: 10)
click to toggle source
# File lib/kairos_rb/client.rb, line 117 def add_media(media:, landmarks: 1, timeout: 10) @connection.call( method: 'post', url: "/v2/media?source=#{media}&landmarks=#{landmarks}&timeout=#{timeout}", headers: { 'Content-Type' => 'application/x-www-form-urlencoded' } ) end
all_galeries()
click to toggle source
# File lib/kairos_rb/client.rb, line 65 def all_galeries @connection.call( method: 'post', url: '/gallery/list_all', headers: { 'Content-Type' => 'application/json' } ) end
detect(image:, selector: nil, min_head_scale: nil)
click to toggle source
# File lib/kairos_rb/client.rb, line 54 def detect(image:, selector: nil, min_head_scale: nil) body = { 'image' => image, 'selector' => selector, 'MinHeadScale' => min_head_scale } @connection.call( method: 'post', url: '/detect', body: body.to_json, headers: { 'Content-Type' => 'application/json' } ) end
enroll(image:, gallery_name:, subject_id:, selector: nil)
click to toggle source
# File lib/kairos_rb/client.rb, line 14 def enroll(image:, gallery_name:, subject_id:, selector: nil) body = { gallery_name: gallery_name, image: image, subject_id: subject_id, selector: selector } @connection.call( method: 'post', url: '/enroll', body: body.to_json, headers: { 'Content-Type' => 'application/json' } ) end
gallery_details(gallery_name:)
click to toggle source
# File lib/kairos_rb/client.rb, line 73 def gallery_details(gallery_name:) body = { gallery_name: gallery_name } @connection.call( method: 'post', url: '/gallery/view', body: body.to_json, headers: { 'Content-Type' => 'application/json' } ) end
gallery_subject(gallery_name:, subject_id:)
click to toggle source
# File lib/kairos_rb/client.rb, line 84 def gallery_subject(gallery_name:, subject_id:) body = { gallery_name: gallery_name, subject_id: subject_id } @connection.call( method: 'post', url: '/gallery/view_subject', body: body.to_json, headers: { 'Content-Type' => 'application/json' } ) end
get_media(media_id:)
click to toggle source
# File lib/kairos_rb/client.rb, line 125 def get_media(media_id:) @connection.call( method: 'get', url: "/v2/media/#{media_id}", headers: { 'Content-Type' => 'application/x-www-form-urlencoded' } ) end
media_analytics(media_id:)
click to toggle source
# File lib/kairos_rb/client.rb, line 133 def media_analytics(media_id:) @connection.call( method: 'get', url: "/v2/analytics/#{media_id}", headers: { 'Content-Type' => 'application/x-www-form-urlencoded' } ) end
recognize(image:, gallery_name:, selector: nil, min_head_scale: nil, threshold: nil, max_num_results: nil)
click to toggle source
# File lib/kairos_rb/client.rb, line 36 def recognize(image:, gallery_name:, selector: nil, min_head_scale: nil, threshold: nil, max_num_results: nil) body = { 'image' => image, 'gallery_name' => gallery_name, 'selector' => selector, 'MinHeadScale' => min_head_scale, 'threshold' => threshold, 'max_num_results' => max_num_results } @connection.call( method: 'post', url: '/recognize', body: body.to_json, headers: { 'Content-Type' => 'application/json' } ) end
remove_gallery(gallery_name:)
click to toggle source
# File lib/kairos_rb/client.rb, line 106 def remove_gallery(gallery_name:) body = { gallery_name: gallery_name } @connection.call( method: 'post', url: '/gallery/remove', body: body.to_json, headers: { 'Content-Type' => 'application/json' } ) end
remove_media(media_id:)
click to toggle source
# File lib/kairos_rb/client.rb, line 141 def remove_media(media_id:) @connection.call( method: 'delete', url: "/v2/media/#{media_id}", headers: { 'Content-Type' => 'application/json' } ) end
remove_subject_from_gallery(gallery_name:, subject_id:)
click to toggle source
# File lib/kairos_rb/client.rb, line 95 def remove_subject_from_gallery(gallery_name:, subject_id:) body = { gallery_name: gallery_name, subject_id: subject_id } @connection.call( method: 'post', url: '/gallery/remove_subject', body: body.to_json, headers: { 'Content-Type' => 'application/json' } ) end
verify(image:, gallery_name:, subject_id:, selector: nil)
click to toggle source
# File lib/kairos_rb/client.rb, line 25 def verify(image:, gallery_name:, subject_id:, selector: nil) body = { gallery_name: gallery_name, image: image, subject_id: subject_id, selector: selector } @connection.call( method: 'post', url: '/verify', body: body.to_json, headers: { 'Content-Type' => 'application/json' } ) end