Class: ApioticsFactory::Portal

Inherits:
Object
  • Object
show all
Defined in:
lib/apiotics_factory/portal.rb

Class Method Summary collapse

Class Method Details

.driver(driver) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/apiotics_factory/portal.rb', line 9

def self.driver(driver)
  puts "portal: #{ApioticsFactory.configuration.portal}"
  puts "public_key: #{ApioticsFactory.configuration.public_key}"
  puts "private_key: #{ApioticsFactory.configuration.private_key}"
  puts "id: #{driver}"
  json = HTTParty.post("#{ApioticsFactory.configuration.portal}api/driver", :query => {:public_key => ApioticsFactory.configuration.public_key, :private_key => ApioticsFactory.configuration.private_key, driver: driver}).body
end

.driver_version(driver) ⇒ Object



17
18
19
# File 'lib/apiotics_factory/portal.rb', line 17

def self.driver_version(driver)
  json = HTTParty.post("#{ApioticsFactory.configuration.portal}api/driver_version", :query => {:public_key => ApioticsFactory.configuration.public_key, :private_key => ApioticsFactory.configuration.private_key, driver: driver}).body
end

.publish_driver(driver, path) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/apiotics_factory/portal.rb', line 21

def self.publish_driver(driver, path)
  payload = {
    :multipart => true,
    :file => File.open(path, 'rb'),
    :public_key => ApioticsFactory.configuration.public_key,
    :private_key => ApioticsFactory.configuration.private_key,
    :driver => driver
  }
  r = RestClient.post("#{ApioticsFactory.configuration.portal}api/upload_driver", payload)
end