Module: Isporn

Defined in:
lib/isporn.rb,
lib/isporn/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.exadeep_api_rest_post(images) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/isporn.rb', line 6

def self.exadeep_api_rest_post images
  debug = false

  if images.class == String
    images=[images]
  elsif images.class == Array
  else
    return nil
  end
  host = "https://exadeep.com"
  RestClient.log = 'stdout' if debug
  image_array = images.collect{|image| File.new(image, 'rb') }
  request = RestClient::Request.new(
    :method => :post,
    :url =>  "#{host}/api/v1",
    :payload => {
      :api_key => 'exadeep_ruby_demo_key',
      :multipart => true,
      "images" => image_array
    })
  request.execute
end