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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a24486d919c84b2bd716ce37c8b37ee62fca566624f3434acb475dfd2de462b
4
- data.tar.gz: 0e0cdc536424944953720bfe4947b99dc2333c672aab55c6d4cb42908785e7a7
3
+ metadata.gz: d07a8c664cda837a170e4faa1f7e038d50bac47d7f7a8364f46d29255d06c1a8
4
+ data.tar.gz: a5ec6e603fe65f5c66e59032de39a4f44edfef1ea05d0ae4e92036d626e00e6e
5
5
  SHA512:
6
- metadata.gz: 56c4522468e00c7891a244ae8efa9de68ea5b7575d72a61c373bd01e616c17a3cac7de8f84912cbd349e1bcb07e397b08c05db81ae34c6136fd07e3156c60385
7
- data.tar.gz: 32c65364cce709339eaabe46a0e165efdfcbc54d7cca45d2cdd99e858af63df1b69adc5813c63fc4980ceb647821648186fcb41df20f8f0465313fc006a656da
6
+ metadata.gz: f52bcb068fc30aa51687e087a66171f6d52c79a8e5c786650b5dfed17c9b8a28ef8f8dd68ca03a2be503b1fab61db655a02b039bf840c28c1771bfcfa8920ae6
7
+ data.tar.gz: 820f3d1a47c2c9fbc2336d170a50203806a671ac883bd2d4ed3d5968b73e31359e96a339facaf792cd2ffc88fa185cafaa928a8f6ed00b1129246b163c45c352
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reso_api (2.0.0)
4
+ reso_api (2.0.1)
5
5
  activesupport
6
6
  jwt
7
7
  oauth2
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].to_s
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
- return URI(endpoint).host ? URI(endpoint) : URI([base_url, endpoint].join)
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")
@@ -1,3 +1,3 @@
1
1
  module ResoApi
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reso_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Edlund