Class: DigifiApi::MLModel

Inherits:
Base
  • Object
show all
Defined in:
lib/digifi_api/ml_model.rb

Class Method Summary collapse

Methods inherited from Base

headers, payload, post

Class Method Details

.submit(model_name, inputs_hash, options = {}) ⇒ Object

model_name:string required inputs:object required client_transaction_id opt



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/digifi_api/ml_model.rb', line 12

def self.submit(model_name, inputs_hash, options={})

  return { error: "model_name is required" } if model_name.nil?
  return { error: "inputs_hash is required" } if inputs_hash.nil?

  elements = Hash.new
  # Required Elements
  elements['model_name'] = model_name
  elements['inputs_hash'] = inputs_hash

  # Optional Elements
  if options['client_transaction_id']
    elements['client_transaction_id'] = options['client_transaction_id']
  end

  response = self.post(@resource_uri, elements)
end