Class: MultiInfo::API::Executor
- Inherits:
-
Object
- Object
- MultiInfo::API::Executor
- Defined in:
- lib/multiinfo/api/executor.rb
Instance Method Summary collapse
- #execute(command_name, parameters = {}) ⇒ Object
- #in_test_mode? ⇒ Boolean
-
#initialize(authentication_hash, certificate_hash, debug = false, test_mode = false) ⇒ Executor
constructor
A new instance of Executor.
Constructor Details
#initialize(authentication_hash, certificate_hash, debug = false, test_mode = false) ⇒ Executor
Returns a new instance of Executor.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/multiinfo/api/executor.rb', line 15 def initialize(authentication_hash, certificate_hash, debug=false, test_mode=false) @authentication_hash = authentication_hash @client_cert_file = { :cert => certificate_hash[:client_cert] || File.join(DEFAULT_CONFIG_PATH, DEFAULT_CERT_FILE), :rsa_key => certificate_hash[:client_key] || File.join(DEFAULT_CONFIG_PATH, DEFAULT_KEY_FILE) } @debug = debug @test_mode = test_mode allow_request_recording if @test_mode end |
Instance Method Details
#execute(command_name, parameters = {}) ⇒ Object
27 28 29 30 31 |
# File 'lib/multiinfo/api/executor.rb', line 27 def execute(command_name, parameters={}) request_uri = command(command_name, parameters) puts "[debug] Executing command '#{command_name}': #{request_uri}" if @debug [command_name, get_response(request_uri)] end |
#in_test_mode? ⇒ Boolean
33 34 35 |
# File 'lib/multiinfo/api/executor.rb', line 33 def in_test_mode? @test_mode end |