Class: Asdawqw::LOSPricingController

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

Overview

LOSPricingController

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/los_pricing_controller.rb', line 12

def instance
  @instance
end

Instance Method Details

#create_and_update_los_length_of_stay_pricing(content_type, body) ⇒ Object

Introduction: You can use this function if you would like to send BookingPal different prices for various Length of Stays with the same starting date. LOS Pricing will be a different method in sending rates to BookingPal and is defined as pricing sent for a specific “Stay ranges”, In the LOS method you are setting specific rates based on the Length of Stay. (This is a different way to push rates to BookingPal. ) For date periods of 1 to 30 days a specific rate need to enter check-in date and a rate for every possible reservation starting at that date (i.e. 1 day, 2 days, up to 30 days, 30 days is the maximum value allowed for this field) you will need to send BookingPal total rate value for that period. Maximum LOS number of days is 30. All other LOS values after 30 will not be saved. If you do not support reservation for some specific number of dates - send value 0.00 for this LOS number of days. Keep in mind that all values not sent for any specific check-in date will be considered as 0, and reservation for this number of days will not be possible. Field maxGuests allows you to set different rates per different number of guests. If you do not have different rate values per number of guests - you can send the value for maximum number of guests, and all others will have the same rate. For MLT properties which supported LOS price for update number of count you can use it rates and availability API. It is suggested to manage availability over “rates and availability” API call, and to close/open dates over this call. Note: this API call can be used only if you set supportedLosRates = true on the product. Otherwise using this API for specific product is not possible.

Parameters:

Returns:

  • LOSRatesResponse response from the API call



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/asdawqw/controllers/los_pricing_controller.rb', line 50

def create_and_update_los_length_of_stay_pricing(content_type,
                                                 body)
  # Prepare query url.
  _path_url = '/losrates'
  _query_builder = Configuration.get_base_uri
  _query_builder << _path_url
  _query_url = APIHelper.clean_url _query_builder
  # Prepare headers.
  _headers = {
    'accept' => 'application/json',
    'x-api-key' => Configuration.x_api_key,
    'Content-Type' => content_type
  }
  # Prepare and execute HttpRequest.
  _request = @http_client.post(
    _query_url,
    headers: _headers,
    parameters: body.to_json
  )
  CustomQueryAuth.apply(_request)
  _context = execute_request(_request)
  validate_response(_context)
  # Return appropriate response type.
  decoded = APIHelper.json_deserialize(_context.response.raw_body)
  LOSRatesResponse.from_hash(decoded)
end

#get_los_prices_list_by_product_id(product_id) ⇒ Object

This function allows the logged in user to get a LOS rate for property.

Parameters:

  • product_id (String)

    Required parameter: Property ID in BookingPal

Returns:

  • LOSRatesResponse response from the API call



80
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
# File 'lib/asdawqw/controllers/los_pricing_controller.rb', line 80

def get_los_prices_list_by_product_id(product_id)
  # Prepare query url.
  _path_url = '/losrates/{productId}'
  _path_url = APIHelper.append_url_with_template_parameters(
    _path_url,
    'productId' => product_id
  )
  _query_builder = Configuration.get_base_uri
  _query_builder << _path_url
  _query_url = APIHelper.clean_url _query_builder
  # Prepare headers.
  _headers = {
    'accept' => 'application/json',
    'x-api-key' => Configuration.x_api_key
  }
  # Prepare and execute HttpRequest.
  _request = @http_client.get(
    _query_url,
    headers: _headers
  )
  CustomQueryAuth.apply(_request)
  _context = execute_request(_request)
  validate_response(_context)
  # Return appropriate response type.
  decoded = APIHelper.json_deserialize(_context.response.raw_body)
  LOSRatesResponse.from_hash(decoded)
end

#instanceObject



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

def instance
  self.class.instance
end