Class: Repull::MarketsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/repull/api/markets_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MarketsApi

Returns a new instance of MarketsApi.



19
20
21
# File 'lib/repull/api/markets_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/repull/api/markets_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_market(city, opts = {}) ⇒ MarketDetailResponse

Deep-dive on a single market Detailed market view for one city — price distribution, bedroom mix, property types, upcoming events, Wheelhouse demand, monthly benchmarks, customer health rollup, top comps (proximity-sorted, paginated), customer’s percentile position, capacity-mix gap, and a 6-month supply trend.

Parameters:

  • city (String)

    URL-encoded city name (e.g. `Radium%20Hot%20Springs`).

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

    the optional parameters

Options Hash (opts):

  • :comps_page (Integer)

    1-indexed page number for the `topComps` slice. (default to 1)

Returns:



28
29
30
31
# File 'lib/repull/api/markets_api.rb', line 28

def get_market(city, opts = {})
  data, _status_code, _headers = get_market_with_http_info(city, opts)
  data
end

#get_market_calendar(city, opts = {}) ⇒ MarketCalendarResponse

Calendar-level market view Date-by-date market view for a city — market avg / min / max nightly rate, occupancy %, Wheelhouse demand, events touching the date, and (when ‘listingId` is supplied) an overlay of the customer’s own pricing + availability.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :start_date (Date)

    Defaults to today.

  • :end_date (Date)

    Defaults to today + 365 days.

  • :listing_id (Integer)

    Optional — overlays the customer's own pricing/availability for direct comparison. Bypasses the upstream cache.

Returns:



100
101
102
103
# File 'lib/repull/api/markets_api.rb', line 100

def get_market_calendar(city, opts = {})
  data, _status_code, _headers = get_market_calendar_with_http_info(city, opts)
  data
end

#get_market_calendar_with_http_info(city, opts = {}) ⇒ Array<(MarketCalendarResponse, Integer, Hash)>

Calendar-level market view Date-by-date market view for a city — market avg / min / max nightly rate, occupancy %, Wheelhouse demand, events touching the date, and (when &#x60;listingId&#x60; is supplied) an overlay of the customer&#39;s own pricing + availability.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :start_date (Date)

    Defaults to today.

  • :end_date (Date)

    Defaults to today + 365 days.

  • :listing_id (Integer)

    Optional — overlays the customer&#39;s own pricing/availability for direct comparison. Bypasses the upstream cache.

Returns:

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

    MarketCalendarResponse data, response status code and response headers



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/repull/api/markets_api.rb', line 113

def get_market_calendar_with_http_info(city, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketsApi.get_market_calendar ...'
  end
  # verify the required parameter 'city' is set
  if @api_client.config.client_side_validation && city.nil?
    fail ArgumentError, "Missing the required parameter 'city' when calling MarketsApi.get_market_calendar"
  end
  # resource path
  local_var_path = '/v1/markets/{city}/calendar'.sub('{city}', CGI.escape(city.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'listingId'] = opts[:'listing_id'] if !opts[:'listing_id'].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] || 'MarketCalendarResponse'

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

  new_options = opts.merge(
    :operation => :"MarketsApi.get_market_calendar",
    :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: MarketsApi#get_market_calendar\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_market_with_http_info(city, opts = {}) ⇒ Array<(MarketDetailResponse, Integer, Hash)>

Deep-dive on a single market Detailed market view for one city — price distribution, bedroom mix, property types, upcoming events, Wheelhouse demand, monthly benchmarks, customer health rollup, top comps (proximity-sorted, paginated), customer&#39;s percentile position, capacity-mix gap, and a 6-month supply trend.

Parameters:

  • city (String)

    URL-encoded city name (e.g. &#x60;Radium%20Hot%20Springs&#x60;).

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

    the optional parameters

Options Hash (opts):

  • :comps_page (Integer)

    1-indexed page number for the &#x60;topComps&#x60; slice. (default to 1)

Returns:

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

    MarketDetailResponse data, response status code and response headers



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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/repull/api/markets_api.rb', line 39

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

  # resource path
  local_var_path = '/v1/markets/{city}'.sub('{city}', CGI.escape(city.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'compsPage'] = opts[:'comps_page'] if !opts[:'comps_page'].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] || 'MarketDetailResponse'

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

  new_options = opts.merge(
    :operation => :"MarketsApi.get_market",
    :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: MarketsApi#get_market\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_market_browse(opts = {}) ⇒ MarketBrowseResponse

Paginated discovery catalog Cursor-paginated, search-filterable catalog of every Atlas-tracked market the customer could expand into. Backed by the precomputed ‘market_summaries` table (>=5 active comps per city). Supports fuzzy `q` substring search (trigram-indexed), `country` (ISO 3166-1 alpha-2) filter, and `sort` (`listings_desc` | `name_asc`). Use the `nextCursor` from `pagination` to walk pages — the cursor is an opaque base64 token; do not parse it. `pagination.total` is the count of markets matching the current `q`/`country`/`min_listings` filter (across all pages). Renamed from the upstream’s legacy ‘total_in_filter` so SDK consumers see the same `pagination.total` field as on every other list endpoint.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :q (String)

    Substring match on city name (case-insensitive).

  • :country (String)

    ISO 3166-1 alpha-2 (e.g. &#x60;US&#x60;, &#x60;ES&#x60;).

  • :min_listings (Integer)

    Minimum comp-set size — cities with fewer active comps are excluded. (default to 5)

  • :cursor (String)

    Opaque cursor returned by the previous page&#39;s &#x60;pagination.nextCursor&#x60;.

  • :limit (Integer) — default: default to 30
  • :sort (String) — default: default to 'listings_desc'

Returns:



174
175
176
177
# File 'lib/repull/api/markets_api.rb', line 174

def list_market_browse(opts = {})
  data, _status_code, _headers = list_market_browse_with_http_info(opts)
  data
end

#list_market_browse_with_http_info(opts = {}) ⇒ Array<(MarketBrowseResponse, Integer, Hash)>

Paginated discovery catalog Cursor-paginated, search-filterable catalog of every Atlas-tracked market the customer could expand into. Backed by the precomputed &#x60;market_summaries&#x60; table (&gt;&#x3D;5 active comps per city). Supports fuzzy &#x60;q&#x60; substring search (trigram-indexed), &#x60;country&#x60; (ISO 3166-1 alpha-2) filter, and &#x60;sort&#x60; (&#x60;listings_desc&#x60; | &#x60;name_asc&#x60;). Use the &#x60;nextCursor&#x60; from &#x60;pagination&#x60; to walk pages — the cursor is an opaque base64 token; do not parse it. &#x60;pagination.total&#x60; is the count of markets matching the current &#x60;q&#x60;/&#x60;country&#x60;/&#x60;min_listings&#x60; filter (across all pages). Renamed from the upstream&#39;s legacy &#x60;total_in_filter&#x60; so SDK consumers see the same &#x60;pagination.total&#x60; field as on every other list endpoint.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :q (String)

    Substring match on city name (case-insensitive).

  • :country (String)

    ISO 3166-1 alpha-2 (e.g. &#x60;US&#x60;, &#x60;ES&#x60;).

  • :min_listings (Integer)

    Minimum comp-set size — cities with fewer active comps are excluded. (default to 5)

  • :cursor (String)

    Opaque cursor returned by the previous page&#39;s &#x60;pagination.nextCursor&#x60;.

  • :limit (Integer) — default: default to 30
  • :sort (String) — default: default to 'listings_desc'

Returns:

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

    MarketBrowseResponse data, response status code and response headers



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
222
223
224
225
226
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
# File 'lib/repull/api/markets_api.rb', line 189

def list_market_browse_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketsApi.list_market_browse ...'
  end
  if @api_client.config.client_side_validation && !opts[:'country'].nil? && opts[:'country'].to_s.length > 2
    fail ArgumentError, 'invalid value for "opts[:"country"]" when calling MarketsApi.list_market_browse, the character length must be smaller than or equal to 2.'
  end

  if @api_client.config.client_side_validation && !opts[:'country'].nil? && opts[:'country'].to_s.length < 2
    fail ArgumentError, 'invalid value for "opts[:"country"]" when calling MarketsApi.list_market_browse, the character length must be greater than or equal to 2.'
  end

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

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

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

  allowable_values = ["listings_desc", "name_asc"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/markets/browse'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'country'] = opts[:'country'] if !opts[:'country'].nil?
  query_params[:'min_listings'] = opts[:'min_listings'] if !opts[:'min_listings'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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] || 'MarketBrowseResponse'

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

  new_options = opts.merge(
    :operation => :"MarketsApi.list_market_browse",
    :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: MarketsApi#list_market_browse\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_markets(opts = {}) ⇒ MarketsOverviewResponse

List markets the customer operates in Returns per-city KPIs across every market the authenticated customer has listings in (market share, ADR vs market, occupancy, ratings) plus a lightweight ‘browse` discovery summary (top-50 featured markets, country categories, total catalog size). For the full paginated discovery catalog with search, call `GET /v1/markets/browse`. Each `markets[]` entry is enriched with `subscribed` + `source` from the customer’s market subscriptions.

Parameters:

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

    the optional parameters

Returns:



267
268
269
270
# File 'lib/repull/api/markets_api.rb', line 267

def list_markets(opts = {})
  data, _status_code, _headers = list_markets_with_http_info(opts)
  data
end

#list_markets_with_http_info(opts = {}) ⇒ Array<(MarketsOverviewResponse, Integer, Hash)>

List markets the customer operates in Returns per-city KPIs across every market the authenticated customer has listings in (market share, ADR vs market, occupancy, ratings) plus a lightweight &#x60;browse&#x60; discovery summary (top-50 featured markets, country categories, total catalog size). For the full paginated discovery catalog with search, call &#x60;GET /v1/markets/browse&#x60;. Each &#x60;markets[]&#x60; entry is enriched with &#x60;subscribed&#x60; + &#x60;source&#x60; from the customer&#39;s market subscriptions.

Parameters:

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

    the optional parameters

Returns:

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

    MarketsOverviewResponse data, response status code and response headers



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/repull/api/markets_api.rb', line 276

def list_markets_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketsApi.list_markets ...'
  end
  # resource path
  local_var_path = '/v1/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] || 'MarketsOverviewResponse'

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

  new_options = opts.merge(
    :operation => :"MarketsApi.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: MarketsApi#list_markets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end