Class: ScrapeBadger::IdealistaApi

Inherits:
Object
  • Object
show all
Defined in:
lib/scrapebadger/api/idealista_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ IdealistaApi

Returns a new instance of IdealistaApi.



19
20
21
# File 'lib/scrapebadger/api/idealista_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/scrapebadger/api/idealista_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#idealista_agency_by_phone(phone, opts = {}) ⇒ Object

Agency by phone Reverse-lookup the agency behind a contact phone (national number), with its listings.

Parameters:

  • phone (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :market (String)

    es|it|pt (default to 'es')

  • :operation (String)

    sale|rent

  • :property_type (String)

    homes|offices|premises|garages|newDevelopments|lands|storageRooms|buildings|bedrooms

  • :page (Integer) — default: default to 1
  • :max_items (Integer) — default: default to 30
  • :include_listings (Boolean) — default: default to true

Returns:

  • (Object)


33
34
35
36
# File 'lib/scrapebadger/api/idealista_api.rb', line 33

def idealista_agency_by_phone(phone, opts = {})
  data, _status_code, _headers = idealista_agency_by_phone_with_http_info(phone, opts)
  data
end

#idealista_agency_by_phone_with_http_info(phone, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Agency by phone Reverse-lookup the agency behind a contact phone (national number), with its listings.

Parameters:

  • phone (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :market (String)

    es|it|pt (default to 'es')

  • :operation (String)

    sale|rent

  • :property_type (String)

    homes|offices|premises|garages|newDevelopments|lands|storageRooms|buildings|bedrooms

  • :page (Integer) — default: default to 1
  • :max_items (Integer) — default: default to 30
  • :include_listings (Boolean) — default: default to true

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



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
77
78
79
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
107
108
109
110
111
112
113
# File 'lib/scrapebadger/api/idealista_api.rb', line 49

def idealista_agency_by_phone_with_http_info(phone, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IdealistaApi.idealista_agency_by_phone ...'
  end
  # verify the required parameter 'phone' is set
  if @api_client.config.client_side_validation && phone.nil?
    fail ArgumentError, "Missing the required parameter 'phone' when calling IdealistaApi.idealista_agency_by_phone"
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling IdealistaApi.idealista_agency_by_phone, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_items'].nil? && opts[:'max_items'] > 50
    fail ArgumentError, 'invalid value for "opts[:"max_items"]" when calling IdealistaApi.idealista_agency_by_phone, must be smaller than or equal to 50.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_items'].nil? && opts[:'max_items'] < 1
    fail ArgumentError, 'invalid value for "opts[:"max_items"]" when calling IdealistaApi.idealista_agency_by_phone, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/idealista/agency/by-phone/{phone}'.sub('{' + 'phone' + '}', CGI.escape(phone.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'market'] = opts[:'market'] if !opts[:'market'].nil?
  query_params[:'operation'] = opts[:'operation'] if !opts[:'operation'].nil?
  query_params[:'property_type'] = opts[:'property_type'] if !opts[:'property_type'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'max_items'] = opts[:'max_items'] if !opts[:'max_items'].nil?
  query_params[:'include_listings'] = opts[:'include_listings'] if !opts[:'include_listings'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"IdealistaApi.idealista_agency_by_phone",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IdealistaApi#idealista_agency_by_phone\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#idealista_agency_profile_listings(short_name, opts = {}) ⇒ Object

Agency profile + listings An agency's microsite profile plus a page of its listings (by URL-slug shortName).

Parameters:

  • short_name (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :market (String)

    es|it|pt (default to 'es')

  • :operation (String)

    sale|rent

  • :property_type (String)

    homes|offices|premises|garages|newDevelopments|lands|storageRooms|buildings|bedrooms

  • :page (Integer) — default: default to 1
  • :max_items (Integer) — default: default to 30
  • :include_listings (Boolean) — default: default to true

Returns:

  • (Object)


126
127
128
129
# File 'lib/scrapebadger/api/idealista_api.rb', line 126

def idealista_agency_profile_listings(short_name, opts = {})
  data, _status_code, _headers = idealista_agency_profile_listings_with_http_info(short_name, opts)
  data
end

#idealista_agency_profile_listings_with_http_info(short_name, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Agency profile + listings An agency's microsite profile plus a page of its listings (by URL-slug shortName).

Parameters:

  • short_name (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :market (String)

    es|it|pt (default to 'es')

  • :operation (String)

    sale|rent

  • :property_type (String)

    homes|offices|premises|garages|newDevelopments|lands|storageRooms|buildings|bedrooms

  • :page (Integer) — default: default to 1
  • :max_items (Integer) — default: default to 30
  • :include_listings (Boolean) — default: default to true

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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
# File 'lib/scrapebadger/api/idealista_api.rb', line 142

def idealista_agency_profile_listings_with_http_info(short_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IdealistaApi.idealista_agency_profile_listings ...'
  end
  # verify the required parameter 'short_name' is set
  if @api_client.config.client_side_validation && short_name.nil?
    fail ArgumentError, "Missing the required parameter 'short_name' when calling IdealistaApi.idealista_agency_profile_listings"
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling IdealistaApi.idealista_agency_profile_listings, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_items'].nil? && opts[:'max_items'] > 50
    fail ArgumentError, 'invalid value for "opts[:"max_items"]" when calling IdealistaApi.idealista_agency_profile_listings, must be smaller than or equal to 50.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_items'].nil? && opts[:'max_items'] < 1
    fail ArgumentError, 'invalid value for "opts[:"max_items"]" when calling IdealistaApi.idealista_agency_profile_listings, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/idealista/agency/{short_name}'.sub('{' + 'short_name' + '}', CGI.escape(short_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'market'] = opts[:'market'] if !opts[:'market'].nil?
  query_params[:'operation'] = opts[:'operation'] if !opts[:'operation'].nil?
  query_params[:'property_type'] = opts[:'property_type'] if !opts[:'property_type'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'max_items'] = opts[:'max_items'] if !opts[:'max_items'].nil?
  query_params[:'include_listings'] = opts[:'include_listings'] if !opts[:'include_listings'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"IdealistaApi.idealista_agency_profile_listings",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IdealistaApi#idealista_agency_profile_listings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#idealista_get_listing_engagement_stats(property_code, opts = {}) ⇒ Object

Get listing engagement stats Engagement counters for a listing: views, email contacts, sent-to-friend, favourites.

Parameters:

  • property_code (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :market (String)

    es|it|pt (default to 'es')

  • :locale (String)

    Language for stat labels (default to 'en')

Returns:

  • (Object)


215
216
217
218
# File 'lib/scrapebadger/api/idealista_api.rb', line 215

def idealista_get_listing_engagement_stats(property_code, opts = {})
  data, _status_code, _headers = idealista_get_listing_engagement_stats_with_http_info(property_code, opts)
  data
end

#idealista_get_listing_engagement_stats_with_http_info(property_code, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Get listing engagement stats Engagement counters for a listing: views, email contacts, sent-to-friend, favourites.

Parameters:

  • property_code (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :market (String)

    es|it|pt (default to 'es')

  • :locale (String)

    Language for stat labels (default to 'en')

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/scrapebadger/api/idealista_api.rb', line 227

def idealista_get_listing_engagement_stats_with_http_info(property_code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IdealistaApi.idealista_get_listing_engagement_stats ...'
  end
  # verify the required parameter 'property_code' is set
  if @api_client.config.client_side_validation && property_code.nil?
    fail ArgumentError, "Missing the required parameter 'property_code' when calling IdealistaApi.idealista_get_listing_engagement_stats"
  end
  # resource path
  local_var_path = '/v1/idealista/properties/{property_code}/stats'.sub('{' + 'property_code' + '}', CGI.escape(property_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'market'] = opts[:'market'] if !opts[:'market'].nil?
  query_params[:'locale'] = opts[:'locale'] if !opts[:'locale'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"IdealistaApi.idealista_get_listing_engagement_stats",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IdealistaApi#idealista_get_listing_engagement_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#idealista_get_property_detail(property_code, opts = {}) ⇒ Object

Get property detail Get a single Idealista listing's full detail (energy cert, characteristics, media).

Parameters:

  • property_code (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :market (String)

    es|it|pt (default to 'es')

  • :locale (String)

    Response language (en, es, it, pt) (default to 'en')

Returns:

  • (Object)


284
285
286
287
# File 'lib/scrapebadger/api/idealista_api.rb', line 284

def idealista_get_property_detail(property_code, opts = {})
  data, _status_code, _headers = idealista_get_property_detail_with_http_info(property_code, opts)
  data
end

#idealista_get_property_detail_with_http_info(property_code, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Get property detail Get a single Idealista listing's full detail (energy cert, characteristics, media).

Parameters:

  • property_code (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :market (String)

    es|it|pt (default to 'es')

  • :locale (String)

    Response language (en, es, it, pt) (default to 'en')

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/scrapebadger/api/idealista_api.rb', line 296

def idealista_get_property_detail_with_http_info(property_code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IdealistaApi.idealista_get_property_detail ...'
  end
  # verify the required parameter 'property_code' is set
  if @api_client.config.client_side_validation && property_code.nil?
    fail ArgumentError, "Missing the required parameter 'property_code' when calling IdealistaApi.idealista_get_property_detail"
  end
  # resource path
  local_var_path = '/v1/idealista/properties/{property_code}'.sub('{' + 'property_code' + '}', CGI.escape(property_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'market'] = opts[:'market'] if !opts[:'market'].nil?
  query_params[:'locale'] = opts[:'locale'] if !opts[:'locale'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"IdealistaApi.idealista_get_property_detail",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IdealistaApi#idealista_get_property_detail\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#idealista_idealista_scraper_health_check(opts = {}) ⇒ Object

Idealista scraper health check Check health of the Idealista scraper service (accepts HEAD for UptimeRobot).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


350
351
352
353
# File 'lib/scrapebadger/api/idealista_api.rb', line 350

def idealista_idealista_scraper_health_check(opts = {})
  data, _status_code, _headers = idealista_idealista_scraper_health_check_with_http_info(opts)
  data
end

#idealista_idealista_scraper_health_check_head(opts = {}) ⇒ Object

Idealista scraper health check Check health of the Idealista scraper service (accepts HEAD for UptimeRobot).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


407
408
409
410
# File 'lib/scrapebadger/api/idealista_api.rb', line 407

def idealista_idealista_scraper_health_check_head(opts = {})
  data, _status_code, _headers = idealista_idealista_scraper_health_check_head_with_http_info(opts)
  data
end

#idealista_idealista_scraper_health_check_head_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>

Idealista scraper health check Check health of the Idealista scraper service (accepts HEAD for UptimeRobot).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/scrapebadger/api/idealista_api.rb', line 416

def idealista_idealista_scraper_health_check_head_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IdealistaApi.idealista_idealista_scraper_health_check_head ...'
  end
  # resource path
  local_var_path = '/v1/idealista/health'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"IdealistaApi.idealista_idealista_scraper_health_check_head",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:HEAD, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IdealistaApi#idealista_idealista_scraper_health_check_head\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#idealista_idealista_scraper_health_check_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>

Idealista scraper health check Check health of the Idealista scraper service (accepts HEAD for UptimeRobot).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/scrapebadger/api/idealista_api.rb', line 359

def idealista_idealista_scraper_health_check_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IdealistaApi.idealista_idealista_scraper_health_check ...'
  end
  # resource path
  local_var_path = '/v1/idealista/health'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"IdealistaApi.idealista_idealista_scraper_health_check",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IdealistaApi#idealista_idealista_scraper_health_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#idealista_list_markets(opts = {}) ⇒ Object

List markets List supported Idealista markets (ES, IT, PT).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


464
465
466
467
# File 'lib/scrapebadger/api/idealista_api.rb', line 464

def idealista_list_markets(opts = {})
  data, _status_code, _headers = idealista_list_markets_with_http_info(opts)
  data
end

#idealista_list_markets_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>

List markets List supported Idealista markets (ES, IT, PT).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/scrapebadger/api/idealista_api.rb', line 473

def idealista_list_markets_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IdealistaApi.idealista_list_markets ...'
  end
  # resource path
  local_var_path = '/v1/idealista/markets'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"IdealistaApi.idealista_list_markets",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IdealistaApi#idealista_list_markets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#idealista_resolve_locations(query, opts = {}) ⇒ Object

Resolve locations Resolve a free-text query into Idealista location codes for a search.

Parameters:

  • query (String)

    Free-text location, e.g. 'sagrada familia'

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :operation (String)

    sale|rent (default to 'sale')

  • :property_type (String)

    homes|offices|premises|garages|newDevelopments|lands|storageRooms|buildings|bedrooms (default to 'homes')

  • :market (String)

    es|it|pt (default to 'es')

  • :locale (String)

    Response language (en, es, it, pt)

Returns:

  • (Object)


526
527
528
529
# File 'lib/scrapebadger/api/idealista_api.rb', line 526

def idealista_resolve_locations(query, opts = {})
  data, _status_code, _headers = idealista_resolve_locations_with_http_info(query, opts)
  data
end

#idealista_resolve_locations_with_http_info(query, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Resolve locations Resolve a free-text query into Idealista location codes for a search.

Parameters:

  • query (String)

    Free-text location, e.g. 'sagrada familia'

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :operation (String)

    sale|rent (default to 'sale')

  • :property_type (String)

    homes|offices|premises|garages|newDevelopments|lands|storageRooms|buildings|bedrooms (default to 'homes')

  • :market (String)

    es|it|pt (default to 'es')

  • :locale (String)

    Response language (en, es, it, pt)

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/scrapebadger/api/idealista_api.rb', line 540

def idealista_resolve_locations_with_http_info(query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IdealistaApi.idealista_resolve_locations ...'
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling IdealistaApi.idealista_resolve_locations"
  end
  # resource path
  local_var_path = '/v1/idealista/suggest'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'query'] = query
  query_params[:'operation'] = opts[:'operation'] if !opts[:'operation'].nil?
  query_params[:'property_type'] = opts[:'property_type'] if !opts[:'property_type'].nil?
  query_params[:'market'] = opts[:'market'] if !opts[:'market'].nil?
  query_params[:'locale'] = opts[:'locale'] if !opts[:'locale'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"IdealistaApi.idealista_resolve_locations",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IdealistaApi#idealista_resolve_locations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#idealista_search_all_beats_result_cap(location, opts = {}) ⇒ Object

Search all (beats result cap) Full inventory for a location, beating Idealista's ~1800 per-search cap via price-range tiling (deduped). Billed per page fetched.

Parameters:

  • location (String)

    Idealista location code (from /suggest)

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :operation (String)

    sale|rent (default to 'sale')

  • :property_type (String)

    homes|offices|premises|garages|newDevelopments|lands|storageRooms|buildings|bedrooms (default to 'homes')

  • :market (String)

    es|it|pt (default to 'es')

  • :max_results (Integer) — default: default to 500
  • :min_price (Float)
  • :max_price (Float)
  • :min_size (Float)
  • :max_size (Float)
  • :min_rooms (Integer)
  • :max_rooms (Integer)
  • :locale (String)

    Response language (en, es, it, pt)

Returns:

  • (Object)


609
610
611
612
# File 'lib/scrapebadger/api/idealista_api.rb', line 609

def idealista_search_all_beats_result_cap(location, opts = {})
  data, _status_code, _headers = idealista_search_all_beats_result_cap_with_http_info(location, opts)
  data
end

#idealista_search_all_beats_result_cap_with_http_info(location, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Search all (beats result cap) Full inventory for a location, beating Idealista's ~1800 per-search cap via price-range tiling (deduped). Billed per page fetched.

Parameters:

  • location (String)

    Idealista location code (from /suggest)

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :operation (String)

    sale|rent (default to 'sale')

  • :property_type (String)

    homes|offices|premises|garages|newDevelopments|lands|storageRooms|buildings|bedrooms (default to 'homes')

  • :market (String)

    es|it|pt (default to 'es')

  • :max_results (Integer) — default: default to 500
  • :min_price (Float)
  • :max_price (Float)
  • :min_size (Float)
  • :max_size (Float)
  • :min_rooms (Integer)
  • :max_rooms (Integer)
  • :locale (String)

    Response language (en, es, it, pt)

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'lib/scrapebadger/api/idealista_api.rb', line 630

def idealista_search_all_beats_result_cap_with_http_info(location, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IdealistaApi.idealista_search_all_beats_result_cap ...'
  end
  # verify the required parameter 'location' is set
  if @api_client.config.client_side_validation && location.nil?
    fail ArgumentError, "Missing the required parameter 'location' when calling IdealistaApi.idealista_search_all_beats_result_cap"
  end
  if @api_client.config.client_side_validation && !opts[:'max_results'].nil? && opts[:'max_results'] > 3000
    fail ArgumentError, 'invalid value for "opts[:"max_results"]" when calling IdealistaApi.idealista_search_all_beats_result_cap, must be smaller than or equal to 3000.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_results'].nil? && opts[:'max_results'] < 1
    fail ArgumentError, 'invalid value for "opts[:"max_results"]" when calling IdealistaApi.idealista_search_all_beats_result_cap, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'min_price'].nil? && opts[:'min_price'] < 0
    fail ArgumentError, 'invalid value for "opts[:"min_price"]" when calling IdealistaApi.idealista_search_all_beats_result_cap, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_price'].nil? && opts[:'max_price'] < 0
    fail ArgumentError, 'invalid value for "opts[:"max_price"]" when calling IdealistaApi.idealista_search_all_beats_result_cap, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'min_size'].nil? && opts[:'min_size'] < 0
    fail ArgumentError, 'invalid value for "opts[:"min_size"]" when calling IdealistaApi.idealista_search_all_beats_result_cap, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_size'].nil? && opts[:'max_size'] < 0
    fail ArgumentError, 'invalid value for "opts[:"max_size"]" when calling IdealistaApi.idealista_search_all_beats_result_cap, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'min_rooms'].nil? && opts[:'min_rooms'] < 0
    fail ArgumentError, 'invalid value for "opts[:"min_rooms"]" when calling IdealistaApi.idealista_search_all_beats_result_cap, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_rooms'].nil? && opts[:'max_rooms'] < 0
    fail ArgumentError, 'invalid value for "opts[:"max_rooms"]" when calling IdealistaApi.idealista_search_all_beats_result_cap, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = '/v1/idealista/search/all'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'location'] = location
  query_params[:'operation'] = opts[:'operation'] if !opts[:'operation'].nil?
  query_params[:'property_type'] = opts[:'property_type'] if !opts[:'property_type'].nil?
  query_params[:'market'] = opts[:'market'] if !opts[:'market'].nil?
  query_params[:'max_results'] = opts[:'max_results'] if !opts[:'max_results'].nil?
  query_params[:'min_price'] = opts[:'min_price'] if !opts[:'min_price'].nil?
  query_params[:'max_price'] = opts[:'max_price'] if !opts[:'max_price'].nil?
  query_params[:'min_size'] = opts[:'min_size'] if !opts[:'min_size'].nil?
  query_params[:'max_size'] = opts[:'max_size'] if !opts[:'max_size'].nil?
  query_params[:'min_rooms'] = opts[:'min_rooms'] if !opts[:'min_rooms'].nil?
  query_params[:'max_rooms'] = opts[:'max_rooms'] if !opts[:'max_rooms'].nil?
  query_params[:'locale'] = opts[:'locale'] if !opts[:'locale'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"IdealistaApi.idealista_search_all_beats_result_cap",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IdealistaApi#idealista_search_all_beats_result_cap\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#idealista_search_listings(location, opts = {}) ⇒ Object

Search listings Search Idealista real-estate listings by location code.

Parameters:

  • location (String)

    Idealista location code (from /suggest)

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :operation (String)

    sale|rent (default to 'sale')

  • :property_type (String)

    homes|offices|premises|garages|newDevelopments|lands|storageRooms|buildings|bedrooms (default to 'homes')

  • :market (String)

    es|it|pt (default to 'es')

  • :page (Integer) — default: default to 1
  • :max_items (Integer) — default: default to 30
  • :sort_by (String)

    distance|size|rooms|floor|ratioeurm2|price|street|photos|modificationDate|publicationDate|weigh|priceDown|preservationTypeAndPrice|privateAds

  • :sort_order (String)

    asc|desc (default to 'desc')

  • :min_price (Float)
  • :max_price (Float)
  • :min_size (Float)
  • :max_size (Float)
  • :min_rooms (Integer)
  • :max_rooms (Integer)
  • :locale (String)

    Response language (en, es, it, pt)

Returns:

  • (Object)


741
742
743
744
# File 'lib/scrapebadger/api/idealista_api.rb', line 741

def idealista_search_listings(location, opts = {})
  data, _status_code, _headers = idealista_search_listings_with_http_info(location, opts)
  data
end

#idealista_search_listings_with_http_info(location, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Search listings Search Idealista real-estate listings by location code.

Parameters:

  • location (String)

    Idealista location code (from /suggest)

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :operation (String)

    sale|rent (default to 'sale')

  • :property_type (String)

    homes|offices|premises|garages|newDevelopments|lands|storageRooms|buildings|bedrooms (default to 'homes')

  • :market (String)

    es|it|pt (default to 'es')

  • :page (Integer) — default: default to 1
  • :max_items (Integer) — default: default to 30
  • :sort_by (String)

    distance|size|rooms|floor|ratioeurm2|price|street|photos|modificationDate|publicationDate|weigh|priceDown|preservationTypeAndPrice|privateAds

  • :sort_order (String)

    asc|desc (default to 'desc')

  • :min_price (Float)
  • :max_price (Float)
  • :min_size (Float)
  • :max_size (Float)
  • :min_rooms (Integer)
  • :max_rooms (Integer)
  • :locale (String)

    Response language (en, es, it, pt)

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
# File 'lib/scrapebadger/api/idealista_api.rb', line 765

def idealista_search_listings_with_http_info(location, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IdealistaApi.idealista_search_listings ...'
  end
  # verify the required parameter 'location' is set
  if @api_client.config.client_side_validation && location.nil?
    fail ArgumentError, "Missing the required parameter 'location' when calling IdealistaApi.idealista_search_listings"
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling IdealistaApi.idealista_search_listings, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_items'].nil? && opts[:'max_items'] > 50
    fail ArgumentError, 'invalid value for "opts[:"max_items"]" when calling IdealistaApi.idealista_search_listings, must be smaller than or equal to 50.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_items'].nil? && opts[:'max_items'] < 1
    fail ArgumentError, 'invalid value for "opts[:"max_items"]" when calling IdealistaApi.idealista_search_listings, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'min_price'].nil? && opts[:'min_price'] < 0
    fail ArgumentError, 'invalid value for "opts[:"min_price"]" when calling IdealistaApi.idealista_search_listings, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_price'].nil? && opts[:'max_price'] < 0
    fail ArgumentError, 'invalid value for "opts[:"max_price"]" when calling IdealistaApi.idealista_search_listings, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'min_size'].nil? && opts[:'min_size'] < 0
    fail ArgumentError, 'invalid value for "opts[:"min_size"]" when calling IdealistaApi.idealista_search_listings, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_size'].nil? && opts[:'max_size'] < 0
    fail ArgumentError, 'invalid value for "opts[:"max_size"]" when calling IdealistaApi.idealista_search_listings, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'min_rooms'].nil? && opts[:'min_rooms'] < 0
    fail ArgumentError, 'invalid value for "opts[:"min_rooms"]" when calling IdealistaApi.idealista_search_listings, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_rooms'].nil? && opts[:'max_rooms'] < 0
    fail ArgumentError, 'invalid value for "opts[:"max_rooms"]" when calling IdealistaApi.idealista_search_listings, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = '/v1/idealista/search'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'location'] = location
  query_params[:'operation'] = opts[:'operation'] if !opts[:'operation'].nil?
  query_params[:'property_type'] = opts[:'property_type'] if !opts[:'property_type'].nil?
  query_params[:'market'] = opts[:'market'] if !opts[:'market'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'max_items'] = opts[:'max_items'] if !opts[:'max_items'].nil?
  query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
  query_params[:'sort_order'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?
  query_params[:'min_price'] = opts[:'min_price'] if !opts[:'min_price'].nil?
  query_params[:'max_price'] = opts[:'max_price'] if !opts[:'max_price'].nil?
  query_params[:'min_size'] = opts[:'min_size'] if !opts[:'min_size'].nil?
  query_params[:'max_size'] = opts[:'max_size'] if !opts[:'max_size'].nil?
  query_params[:'min_rooms'] = opts[:'min_rooms'] if !opts[:'min_rooms'].nil?
  query_params[:'max_rooms'] = opts[:'max_rooms'] if !opts[:'max_rooms'].nil?
  query_params[:'locale'] = opts[:'locale'] if !opts[:'locale'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"IdealistaApi.idealista_search_listings",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IdealistaApi#idealista_search_listings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end