Class: Asdawqw::FeeAndTaxMandatoryAtThePropertyLevelController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/asdawqw/controllers/fee_and_tax_mandatory_at_the_property_level_controller.rb

Overview

FeeAndTaxMandatoryAtThePropertyLevelController

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

def instance
  @instance
end

Instance Method Details

#create_import_or_update_fee_and_tax_mandatory(content_type, body) ⇒ Object

This function allows the logged in user to import or update a fee and tax mandatory. Example:

Parameters:

Returns:

  • APIResponseWithoutData response from the API call



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

def create_import_or_update_fee_and_tax_mandatory(content_type,
                                                  body)
  # Prepare query url.
  _path_url = '/validation-settings/import-update'
  _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)
  APIResponseWithoutData.from_hash(decoded)
end

#create_remove_validation_settings(content_type, body) ⇒ Object

This function allows the logged in user to remove any setup on property level and to return on default (which is that fee/taxes are mandatory). This API call will accept a list of properties.

Parameters:

Returns:

  • APIResponseWithoutData response from the API call



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

def create_remove_validation_settings(content_type,
                                      body)
  # Prepare query url.
  _path_url = '/validation-settings/removed'
  _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)
  APIResponseWithoutData.from_hash(decoded)
end

#get_fee_and_tax_mandatoryObject

This function allows the logged in user to get info about current set for all PM properties are fees/taxes set to be mandatory or not.

Returns:

  • FeeTaxValidationSettingResponse response from the API call



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/asdawqw/controllers/fee_and_tax_mandatory_at_the_property_level_controller.rb', line 22

def get_fee_and_tax_mandatory
  # Prepare query url.
  _path_url = '/validation-settings/get-validation'
  _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)
  FeeTaxValidationSettingResponse.from_hash(decoded)
end

#instanceObject



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

def instance
  self.class.instance
end