reso_api 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +9 -1
- data/lib/reso_api/app/models/reso/api/client.rb +9 -4
- data/lib/reso_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d07a8c664cda837a170e4faa1f7e038d50bac47d7f7a8364f46d29255d06c1a8
|
|
4
|
+
data.tar.gz: a5ec6e603fe65f5c66e59032de39a4f44edfef1ea05d0ae4e92036d626e00e6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f52bcb068fc30aa51687e087a66171f6d52c79a8e5c786650b5dfed17c9b8a28ef8f8dd68ca03a2be503b1fab61db655a02b039bf840c28c1771bfcfa8920ae6
|
|
7
|
+
data.tar.gz: 820f3d1a47c2c9fbc2336d170a50203806a671ac883bd2d4ed3d5968b73e31359e96a339facaf792cd2ffc88fa185cafaa928a8f6ed00b1129246b163c45c352
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -72,6 +72,14 @@ You pass these two pieces of information to create an instance of an API client:
|
|
|
72
72
|
client = RESO::API::Client.new(access_token: access_token, base_url: base_url)
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
+
#### Base URL for Replication
|
|
76
|
+
|
|
77
|
+
Some systems, like Bridge Interactive, provide replication endpoints that differ from the ones for normal search requests by including an additional path segment *following* the resource segment. For example:
|
|
78
|
+
|
|
79
|
+
https://api.bridgedataoutput.com/api/v2/OData/{dataset_id}/Property/replication
|
|
80
|
+
|
|
81
|
+
To accommodate this, the `base_url` parameter may contain a `/$resource$` segment which will be replaced for each API call with the appropriate resource segment.
|
|
82
|
+
|
|
75
83
|
|
|
76
84
|
### Resources
|
|
77
85
|
|
|
@@ -367,7 +375,7 @@ client.properties(ignorenulls: true)
|
|
|
367
375
|
|
|
368
376
|
#### Automatically iterate over all results
|
|
369
377
|
|
|
370
|
-
By passing a block to Media, Member, Office, and Property resource calls, subsequent paginated calls will automatically be made until the whole result set has been traversed. The block provided is executed for each returned object hash. The `batch` option can be used to return the full array of results.
|
|
378
|
+
By passing a block to Media, Member, Office, and Property resource calls, subsequent paginated calls will automatically be made until the whole result set has been traversed. The block provided is executed for each returned object hash. The `batch` option can be used to return the full array of results.
|
|
371
379
|
|
|
372
380
|
Here are a couple of examples of how that can be used:
|
|
373
381
|
|
|
@@ -64,8 +64,8 @@ module RESO
|
|
|
64
64
|
|
|
65
65
|
hash = args.first.is_a?(Hash) ? args.first : {}
|
|
66
66
|
|
|
67
|
-
filter = hash[:filter]
|
|
68
|
-
if !filter.include?('OriginatingSystemName') && osn.present?
|
|
67
|
+
filter = hash[:filter]
|
|
68
|
+
if !filter.to_s.include?('OriginatingSystemName') && osn.present?
|
|
69
69
|
osn_filter = format("OriginatingSystemName eq '%s'", osn.to_s)
|
|
70
70
|
filter = [filter.presence, osn_filter].compact.join(' and ')
|
|
71
71
|
end
|
|
@@ -232,7 +232,12 @@ module RESO
|
|
|
232
232
|
end
|
|
233
233
|
|
|
234
234
|
def uri_for_endpoint endpoint
|
|
235
|
-
|
|
235
|
+
uri = URI(endpoint)
|
|
236
|
+
return uri if uri.host
|
|
237
|
+
uri = URI(base_url)
|
|
238
|
+
path = uri.path
|
|
239
|
+
uri.path = path.include?("/$resource$") ? path.sub("/$resource$", endpoint) : [path, endpoint].join
|
|
240
|
+
return uri
|
|
236
241
|
end
|
|
237
242
|
|
|
238
243
|
def perform_call(endpoint, params, max_retries = 5, debug = false)
|
|
@@ -275,7 +280,7 @@ module RESO
|
|
|
275
280
|
fresh_oauth2_payload
|
|
276
281
|
raise StandardError
|
|
277
282
|
elsif response.is_a?(Hash) && response.has_key?("error")
|
|
278
|
-
error_msg = response.inspect
|
|
283
|
+
error_msg = "#{@last_request_url} => #{response.inspect}"
|
|
279
284
|
puts "Error: #{error_msg}" if debug
|
|
280
285
|
raise StandardError, error_msg
|
|
281
286
|
elsif response.is_a?(Hash) && response.has_key?("retry-after")
|
data/lib/reso_api/version.rb
CHANGED