Class: GetAroundOwner::UnavailabilitiesApi
- Inherits:
-
Object
- Object
- GetAroundOwner::UnavailabilitiesApi
- Defined in:
- lib/get_around_owner/api/unavailabilities_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_unavailabilities(car_id, opts = {}) ⇒ nil
Create Unavailability related to a car between dates Set a car as unavailable between 2 dates.
-
#create_unavailabilities_with_http_info(car_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create Unavailability related to a car between dates Set a car as unavailable between 2 dates.
-
#destroy_unavailability(car_id, opts = {}) ⇒ nil
Destroy Unavailability related to a car between dates Set a car as available between 2 dates.
-
#destroy_unavailability_with_http_info(car_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Destroy Unavailability related to a car between dates Set a car as available between 2 dates.
- #get_unavailabilities(opts = {}) ⇒ Object
-
#get_unavailabilities_for_car(start_date, end_date, car_id, opts = {}) ⇒ UnavailabilitiesIndex
Find Unavailabilities related to a car between dates Find between 2 dates when you’ve set a car as unavailable.
-
#get_unavailabilities_for_car_with_http_info(start_date, end_date, car_id, opts = {}) ⇒ Array<(UnavailabilitiesIndex, Integer, Hash)>
Find Unavailabilities related to a car between dates Find between 2 dates when you’ve set a car as unavailable.
-
#initialize(api_client = ApiClient.default) ⇒ UnavailabilitiesApi
constructor
A new instance of UnavailabilitiesApi.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ UnavailabilitiesApi
Returns a new instance of UnavailabilitiesApi.
16 17 18 |
# File 'lib/get_around_owner/api/unavailabilities_api.rb', line 16 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
14 15 16 |
# File 'lib/get_around_owner/api/unavailabilities_api.rb', line 14 def api_client @api_client end |
Instance Method Details
#create_unavailabilities(car_id, opts = {}) ⇒ nil
Create Unavailability related to a car between dates Set a car as unavailable between 2 dates
25 26 27 28 |
# File 'lib/get_around_owner/api/unavailabilities_api.rb', line 25 def create_unavailabilities(car_id, opts = {}) create_unavailabilities_with_http_info(car_id, opts) nil end |
#create_unavailabilities_with_http_info(car_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create Unavailability related to a car between dates Set a car as unavailable between 2 dates
36 37 38 39 40 41 42 43 44 45 46 47 48 49 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 76 |
# File 'lib/get_around_owner/api/unavailabilities_api.rb', line 36 def create_unavailabilities_with_http_info(car_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UnavailabilitiesApi.create_unavailabilities ...' end # verify the required parameter 'car_id' is set if @api_client.config.client_side_validation && car_id.nil? fail ArgumentError, "Missing the required parameter 'car_id' when calling UnavailabilitiesApi.create_unavailabilities" end # resource path local_var_path = '/cars/{car_id}/unavailabilities.json'.sub('{' + 'car_id' + '}', car_id.to_s) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) return_type = opts[:return_type] auth_names = opts[:auth_names] || ['bearerAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @api_client.config.debugging @api_client.config.logger.debug "API called: UnavailabilitiesApi#create_unavailabilities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#destroy_unavailability(car_id, opts = {}) ⇒ nil
Destroy Unavailability related to a car between dates Set a car as available between 2 dates
82 83 84 85 |
# File 'lib/get_around_owner/api/unavailabilities_api.rb', line 82 def destroy_unavailability(car_id, opts = {}) destroy_unavailability_with_http_info(car_id, opts) nil end |
#destroy_unavailability_with_http_info(car_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Destroy Unavailability related to a car between dates Set a car as available between 2 dates
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 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/get_around_owner/api/unavailabilities_api.rb', line 92 def destroy_unavailability_with_http_info(car_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UnavailabilitiesApi.destroy_unavailability ...' end # verify the required parameter 'car_id' is set if @api_client.config.client_side_validation && car_id.nil? fail ArgumentError, "Missing the required parameter 'car_id' when calling UnavailabilitiesApi.destroy_unavailability" end # resource path local_var_path = '/cars/{car_id}/unavailabilities.json'.sub('{' + 'car_id' + '}', car_id.to_s) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] return_type = opts[:return_type] auth_names = opts[:auth_names] || ['bearerAuth'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @api_client.config.debugging @api_client.config.logger.debug "API called: UnavailabilitiesApi#destroy_unavailability\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_unavailabilities(opts = {}) ⇒ Object
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/get_around_owner/api/unavailabilities_api.rb', line 223 def get_unavailabilities(opts = {}) # Don't specify a return type to get raw response opts[:return_type] = nil data, status_code, headers = get_unavailabilities_with_http_info(opts) if status_code == 200 && data begin # Parse JSON directly from response body JSON.parse(data) rescue JSON::ParserError => e if @api_client.config.debugging @api_client.config.logger.debug "Failed to parse JSON response: #{e.}" end nil end else nil end end |
#get_unavailabilities_for_car(start_date, end_date, car_id, opts = {}) ⇒ UnavailabilitiesIndex
Find Unavailabilities related to a car between dates Find between 2 dates when you’ve set a car as unavailable
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/get_around_owner/api/unavailabilities_api.rb', line 140 def get_unavailabilities_for_car(start_date, end_date, car_id, opts = {}) # Don't specify a return type to get raw response opts[:return_type] = nil data, status_code, headers = get_unavailabilities_for_car_with_http_info(start_date, end_date, car_id, opts) if status_code == 200 && data begin # Parse JSON directly from response body JSON.parse(data) rescue JSON::ParserError => e if @api_client.config.debugging @api_client.config.logger.debug "Failed to parse JSON response: #{e.}" end nil end else nil end end |
#get_unavailabilities_for_car_with_http_info(start_date, end_date, car_id, opts = {}) ⇒ Array<(UnavailabilitiesIndex, Integer, Hash)>
Find Unavailabilities related to a car between dates Find between 2 dates when you’ve set a car as unavailable
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/get_around_owner/api/unavailabilities_api.rb', line 169 def get_unavailabilities_for_car_with_http_info(start_date, end_date, car_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UnavailabilitiesApi.get_unavailabilities_for_car ...' end # verify the required parameter 'start_date' is set if @api_client.config.client_side_validation && start_date.nil? fail ArgumentError, "Missing the required parameter 'start_date' when calling UnavailabilitiesApi.get_unavailabilities_for_car" end # verify the required parameter 'end_date' is set if @api_client.config.client_side_validation && end_date.nil? fail ArgumentError, "Missing the required parameter 'end_date' when calling UnavailabilitiesApi.get_unavailabilities_for_car" end # verify the required parameter 'car_id' is set if @api_client.config.client_side_validation && car_id.nil? fail ArgumentError, "Missing the required parameter 'car_id' when calling UnavailabilitiesApi.get_unavailabilities_for_car" end # resource path local_var_path = '/cars/{car_id}/unavailabilities.json'.sub('{' + 'car_id' + '}', car_id.to_s) # query parameters query_params = opts[:query_params] || {} query_params[:'start_date'] = start_date query_params[:'end_date'] = end_date query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] return_type = opts[:return_type] || 'UnavailabilitiesIndex' auth_names = opts[:auth_names] || ['bearerAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @api_client.config.debugging @api_client.config.logger.debug "API called: UnavailabilitiesApi#get_unavailabilities_for_car\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |