Class: Asdawqw::AsynchronousPushMessagesController

Inherits:
BaseController show all
Defined in:
lib/asdawqw/controllers/asynchronous_push_messages_controller.rb

Overview

AsynchronousPushMessagesController

Class Attribute Summary collapse

Attributes inherited from BaseController

#http_call_back, #http_client

Instance Method Summary collapse

Methods inherited from BaseController

#execute_request, #initialize, #validate_parameters, #validate_response

Constructor Details

This class inherits a constructor from Asdawqw::BaseController

Class Attribute Details

.instanceObject

Returns the value of attribute instance.



12
13
14
# File 'lib/asdawqw/controllers/asynchronous_push_messages_controller.rb', line 12

def instance
  @instance
end

Instance Method Details

#create_validation_push_asynchronous_message(body) ⇒ Object

This is POST request - push notifications (webhooks) which BookingPal will send on PMS endpoint (which is set in push notification API, field - asyncPush) after something is executed in BP. This is necessary since some API calls like validation, onboarding, etc are done over queue in our system, so you will get an asynchronous response. In these requests, we do not have expected responses from the PMS system. Since these are just notifications. Important note: In this doc to be able to test this - you need to set a full URL on the Configure button in the right section. Example:

Parameters:

Returns:

  • void response from the API call



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/asdawqw/controllers/asynchronous_push_messages_controller.rb', line 31

def create_validation_push_asynchronous_message(body)
  # Prepare query url.
  _path_url = '/'
  _query_builder = Configuration.get_base_uri(
    Configuration::Server::PUSH_MESSAGES_URL
  )
  _query_builder << _path_url
  _query_url = APIHelper.clean_url _query_builder
  # Prepare headers.
  _headers = {
    'content-type' => 'application/json; charset=utf-8',
    'x-api-key' => Configuration.x_api_key
  }
  # Prepare and execute HttpRequest.
  _request = @http_client.post(
    _query_url,
    headers: _headers,
    parameters: body.to_json
  )
  _context = execute_request(_request)
  validate_response(_context)
end

#instanceObject



15
16
17
# File 'lib/asdawqw/controllers/asynchronous_push_messages_controller.rb', line 15

def instance
  self.class.instance
end