Method: SocketLabs::InjectionApi::SocketLabsClient#send_basic_message
- Defined in:
- lib/socketlabs/injectionapi/socketlabsclient.rb
#send_basic_message(message) ⇒ SendResponse
Sends a BasicMessage message and returns the response from the Injection API.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/socketlabs/injectionapi/socketlabsclient.rb', line 81 def () resp = () if resp.result != SendResult.enum["Success"] resp end req_factory = InjectionRequestFactory.new(@server_id, @api_key) request = req_factory.generate_request() # debug request_hash = request.to_hash debug_json = request_hash.to_json @request_json = debug_json apiKeyParser = ApiKeyParser.new() parseResult = apiKeyParser.parse(@api_key); httpArguments = { :http_endpoint => @endpoint, :proxy => @proxy, :timeout => @request_timeout, :authorization => '' } if parseResult == ApiKeyParseResult.enum["Success"] httpArguments[:authorization] = @api_key request.api_key = '' end http_request = HttpRequest.new(http_method, httpArguments) retry_handler = RetryHandler.new(http_request, @endpoint, RetrySettings.new(@number_of_retries)) response = retry_handler.send(request) parser = InjectionResponseParser.new result = parser.parse(response) @response_json = result.to_json end |