reso_api 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d52973c086bdbeff331fc267832e7ece9c7002d5f10e9273c619e9ff985a2ffa
4
- data.tar.gz: ac5cfd9c1416bb0a43d38d514ca7b3213f133749630869bc55fb2855c797e99c
3
+ metadata.gz: 429940488232e917ca2fec8f1c5bbdd8d3bff37fb50f5b2d47d9ff817067abac
4
+ data.tar.gz: 7f0736cd242987fc19c0b6a0286b2ceef11f0dc363b31d8a161e02756d5456b1
5
5
  SHA512:
6
- metadata.gz: 13689a885600bd73802304c034c9b48bfa1f635fc2016e2be3780575a6a142f6e80809e6af010d65dd4d63be1567c5bf08f33cd89925343932d4dcb1ab3bc455
7
- data.tar.gz: c770fb9aba3551dd8ee037a37a8ddb6853af78d6530b78856ad45a5d045caeeba0c32ca70f75889a8182a95f8283ac93e273945894284924210365c32b3d7bb5
6
+ metadata.gz: 3e5a50322a425cbde496039eaaa36bfdf255d08a49df1f148871fd01d3b809ff55e60bd070d74dc5c47bae5e80d45005ea7e0453c17fb981d665317d2804b23c
7
+ data.tar.gz: 89871becd21ea774f8763fb5e2e25e8b0c922a28bfe747709ad29c39b4e2d7e353fbfcc85dc85cf6d0474ff408ef380fab64caada98fa68613f01738e5d43cd4
data/README.md CHANGED
@@ -145,7 +145,7 @@ client.properties(expand: "Media")
145
145
 
146
146
  #### Automatically iterate over all results
147
147
 
148
- 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.
148
+ 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.
149
149
 
150
150
  Here are a couple of examples of how that can be used:
151
151
 
@@ -157,6 +157,10 @@ end
157
157
  client.properties(filter: "StandardStatus eq 'Active'") do |hash|
158
158
  Listing.create(listing_key: hash['ListingKey'], data: hash)
159
159
  end
160
+
161
+ client.properties(filter: "StandardStatus eq 'Active'", batch: true) do |results|
162
+ Listing.insert_all(results) # Perform some batch operation
163
+ end
160
164
  ```
161
165
 
162
166
 
@@ -64,10 +64,17 @@ module RESO
64
64
  }.compact
65
65
  if !block.nil?
66
66
  response = perform_call(endpoint, params)
67
- response["value"].each{|hash| block.call(hash)} if response["value"].class.eql?(Array)
67
+
68
+ if response["value"].class.eql?(Array)
69
+ hash[:batch] ? block.call(response["value"]) : response["value"].each{|hash| block.call(hash)}
70
+ end
71
+
68
72
  while (next_link = response["@odata.nextLink"]).present?
69
73
  response = perform_call(next_link, nil)
70
- response["value"].each{|hash| block.call(hash)} if response["value"].class.eql?(Array)
74
+
75
+ if response["value"].class.eql?(Array)
76
+ hash[:batch] ? block.call(response["value"]) : response["value"].each{|hash| block.call(hash)}
77
+ end
71
78
  end
72
79
  else
73
80
  return perform_call(endpoint, params)
@@ -1,3 +1,3 @@
1
1
  module ResoApi
2
- VERSION = "0.4.8"
2
+ VERSION = "0.4.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reso_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Edlund
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-10 00:00:00.000000000 Z
11
+ date: 2022-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler