Class: Repull::AtlasApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AtlasApi

Returns a new instance of AtlasApi.



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

def api_client
  @api_client
end

Instance Method Details

#get_listing_segments(id, opts = {}) ⇒ ListingSegmentsResponse

Atlas DNA segment intelligence for a listing Aggregates Atlas DNA segment signal (quality tier, design style, bedrooms) across the listing’s geographic neighborhood (default: 5km radius) or the whole city, so consumers can answer: - What segments dominate my market? - Which segment does my listing match best? - What’s the ADR uplift for moving up a tier? DNA coverage is still ramping — segments are scored asynchronously. Cities and radii without scored comps return ‘totalCompsAnalyzed: 0` plus a `low_dna_coverage` recommendation rather than fabricated data.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :level (String)

    `comp_set` (default) restricts to a `radius_km` bbox. `market` aggregates across the whole city. (default to ‘comp_set’)

  • :radius_km (Float)

    Only used when `level=comp_set`. (default to 5)

Returns:



29
30
31
32
# File 'lib/repull/api/atlas_api.rb', line 29

def get_listing_segments(id, opts = {})
  data, _status_code, _headers = get_listing_segments_with_http_info(id, opts)
  data
end

#get_listing_segments_with_http_info(id, opts = {}) ⇒ Array<(ListingSegmentsResponse, Integer, Hash)>

Atlas DNA segment intelligence for a listing Aggregates Atlas DNA segment signal (quality tier, design style, bedrooms) across the listing&#39;s geographic neighborhood (default: 5km radius) or the whole city, so consumers can answer: - What segments dominate my market? - Which segment does my listing match best? - What&#39;s the ADR uplift for moving up a tier? DNA coverage is still ramping — segments are scored asynchronously. Cities and radii without scored comps return &#x60;totalCompsAnalyzed: 0&#x60; plus a &#x60;low_dna_coverage&#x60; recommendation rather than fabricated data.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :level (String)

    &#x60;comp_set&#x60; (default) restricts to a &#x60;radius_km&#x60; bbox. &#x60;market&#x60; aggregates across the whole city. (default to ‘comp_set’)

  • :radius_km (Float)

    Only used when &#x60;level&#x3D;comp_set&#x60;. (default to 5)

Returns:

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

    ListingSegmentsResponse data, response status code and response headers



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
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/repull/api/atlas_api.rb', line 41

def get_listing_segments_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AtlasApi.get_listing_segments ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AtlasApi.get_listing_segments"
  end
  allowable_values = ["comp_set", "market"]
  if @api_client.config.client_side_validation && opts[:'level'] && !allowable_values.include?(opts[:'level'])
    fail ArgumentError, "invalid value for \"level\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'radius_km'].nil? && opts[:'radius_km'] > 50
    fail ArgumentError, 'invalid value for "opts[:"radius_km"]" when calling AtlasApi.get_listing_segments, must be smaller than or equal to 50.'
  end

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

  # resource path
  local_var_path = '/v1/listings/{id}/segments'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'level'] = opts[:'level'] if !opts[:'level'].nil?
  query_params[:'radius_km'] = opts[:'radius_km'] if !opts[:'radius_km'].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] || 'ListingSegmentsResponse'

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

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

#list_listing_comps(id, opts = {}) ⇒ ListingCompsResponse

Comp set for a listing (with daily nightly pricing) Returns the actual comp set for a listing — the underlying competitor listings (with daily nightly pricing), not just the aggregated ‘compSummary` from `/pricing`. Each comp comes back with distance, bedrooms, ratings, lat/lng, platform link, and a per-day rate/availability series for the requested window. Powered by Atlas. Comps with no coordinates are excluded — there’s no way to rank them by distance. Listings without coordinates return ‘data: []` and a `warning` field.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :radius_km (Float)

    Bbox + haversine on lat/lng. Default 5, max 50. (default to 5)

  • :limit (Integer)

    Closest-first. Max 100. (default to 20)

  • :start_date (Date)

    Defaults to today.

  • :end_date (Date)

    Defaults to today + 30 days.

Returns:



112
113
114
115
# File 'lib/repull/api/atlas_api.rb', line 112

def list_listing_comps(id, opts = {})
  data, _status_code, _headers = list_listing_comps_with_http_info(id, opts)
  data
end

#list_listing_comps_with_http_info(id, opts = {}) ⇒ Array<(ListingCompsResponse, Integer, Hash)>

Comp set for a listing (with daily nightly pricing) Returns the actual comp set for a listing — the underlying competitor listings (with daily nightly pricing), not just the aggregated &#x60;compSummary&#x60; from &#x60;/pricing&#x60;. Each comp comes back with distance, bedrooms, ratings, lat/lng, platform link, and a per-day rate/availability series for the requested window. Powered by Atlas. Comps with no coordinates are excluded — there&#39;s no way to rank them by distance. Listings without coordinates return &#x60;data: []&#x60; and a &#x60;warning&#x60; field.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :radius_km (Float)

    Bbox + haversine on lat/lng. Default 5, max 50. (default to 5)

  • :limit (Integer)

    Closest-first. Max 100. (default to 20)

  • :start_date (Date)

    Defaults to today.

  • :end_date (Date)

    Defaults to today + 30 days.

Returns:

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

    ListingCompsResponse data, response status code and response headers



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
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
# File 'lib/repull/api/atlas_api.rb', line 126

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

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

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AtlasApi.list_listing_comps, 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 AtlasApi.list_listing_comps, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/listings/{id}/comps'.sub('{id}', CGI.escape(id.to_s))

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

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

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