Class: DigifiApi::MLRulesEngine
- Defined in:
- lib/digifi_api/ml_rules_engine.rb
Class Method Summary collapse
-
.submit(strategy_name, strategy_status, variables_hash, options = {}) ⇒ Object
strategy_name:string required strategy_status:string required variables:object required client_transaction_id opt return_input_variables:bool opt return_processing_detail:bool opt return_data_sources:bool opt.
Methods inherited from Base
Class Method Details
.submit(strategy_name, strategy_status, variables_hash, options = {}) ⇒ Object
strategy_name:string required strategy_status:string required variables:object required client_transaction_id opt return_input_variables:bool opt return_processing_detail:bool opt return_data_sources:bool opt
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/digifi_api/ml_rules_engine.rb', line 16 def self.submit(strategy_name, strategy_status, variables_hash, ={}) return { error: "strategy_name is required" } if strategy_name.nil? return { error: "strategy_status is required" } if strategy_status.nil? elements = Hash.new # Required Elements elements['strategy_name'] = strategy_name elements['strategy_status'] = strategy_status elements['variables'] = variables_hash # Optional Elements if [:client_transaction_id] elements['client_transaction_id'] = [:client_transaction_id] end if [:return_input_variables] if [:return_input_variables] == true || [:return_input_variables] == 'true' elements['return_input_variables'] = true end end if [:return_processing_detail] if [:return_processing_detail] == true || [:return_processing_detail] == 'true' elements['return_processing_detail'] = true end end if [:return_data_sources] if [:return_data_sources] == true || [:return_data_sources] == 'true' elements['return_data_sources'] = true end end response = self.post(@resource_uri, elements) end |