reso_api 0.2.0 → 0.3.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: e51657547bb2a45e16490860b4aded5a31d850ba2a3d7a15b224e36ea25fd402
4
- data.tar.gz: 6948ea2f8c1144cf48969a384ee692ce2a43470b17efa9e87779b0263067d192
3
+ metadata.gz: d4a950c58781ec5c74884efd37ceb091855cdc061e491c83a206d47e8121a4a7
4
+ data.tar.gz: a05ad1c1835d3d097e828462028132cd1b508bc1eee4a475bee94c112dfbe38c
5
5
  SHA512:
6
- metadata.gz: 42bec1b92b962854d32eedb70b938418c8bd403542508e6339ebf1282f4dcfc8ed085de96c46aebc1fc7684f55408d82466ff3a146b40d97e7a3634892545b7a
7
- data.tar.gz: a174d7fab55595c742da77961e81b5520d6ba48c2aba2c5ba18fd9a89ebff657f42c0d180e68b104ae8b8fffc963bddebb469b09fff648c87e655be23de0e21e
6
+ metadata.gz: 8076aca2231e877bd54c27a64595dfa6f58ee8e5078ba6d5f4d289b7e642387ad28407485e7203ffb4e1416f8ebc813be3906393a60ba726494ca9ca4af4789a
7
+ data.tar.gz: 54b68fdbcdde0c9332db35b862c83497ffd0df1f19e676fe390a3bd6bf1246f3cf15723214bbb75f9867df0a0ab7ad6252ec6f7123071041d500bb87b76cd4d0
data/Gemfile.lock CHANGED
@@ -1,62 +1,81 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reso_api (0.2.0)
4
+ reso_api (0.2.1)
5
5
  activesupport
6
6
  oauth2
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (5.2.3)
11
+ activesupport (6.1.4.1)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
- i18n (>= 0.7, < 2)
14
- minitest (~> 5.1)
15
- tzinfo (~> 1.1)
16
- concurrent-ruby (1.1.5)
17
- diff-lcs (1.3)
18
- faraday (0.15.4)
13
+ i18n (>= 1.6, < 2)
14
+ minitest (>= 5.1)
15
+ tzinfo (~> 2.0)
16
+ zeitwerk (~> 2.3)
17
+ concurrent-ruby (1.1.9)
18
+ diff-lcs (1.4.4)
19
+ faraday (1.8.0)
20
+ faraday-em_http (~> 1.0)
21
+ faraday-em_synchrony (~> 1.0)
22
+ faraday-excon (~> 1.1)
23
+ faraday-httpclient (~> 1.0.1)
24
+ faraday-net_http (~> 1.0)
25
+ faraday-net_http_persistent (~> 1.1)
26
+ faraday-patron (~> 1.0)
27
+ faraday-rack (~> 1.0)
19
28
  multipart-post (>= 1.2, < 3)
20
- i18n (1.6.0)
29
+ ruby2_keywords (>= 0.0.4)
30
+ faraday-em_http (1.0.0)
31
+ faraday-em_synchrony (1.0.0)
32
+ faraday-excon (1.1.0)
33
+ faraday-httpclient (1.0.1)
34
+ faraday-net_http (1.0.1)
35
+ faraday-net_http_persistent (1.2.0)
36
+ faraday-patron (1.0.0)
37
+ faraday-rack (1.0.0)
38
+ i18n (1.8.10)
21
39
  concurrent-ruby (~> 1.0)
22
- jwt (2.1.0)
23
- minitest (5.11.3)
24
- multi_json (1.13.1)
40
+ jwt (2.2.3)
41
+ minitest (5.14.4)
42
+ multi_json (1.15.0)
25
43
  multi_xml (0.6.0)
26
- multipart-post (2.0.0)
27
- oauth2 (1.4.1)
28
- faraday (>= 0.8, < 0.16.0)
44
+ multipart-post (2.1.1)
45
+ oauth2 (1.4.7)
46
+ faraday (>= 0.8, < 2.0)
29
47
  jwt (>= 1.0, < 3.0)
30
48
  multi_json (~> 1.3)
31
49
  multi_xml (~> 0.5)
32
50
  rack (>= 1.2, < 3)
33
- rack (2.0.7)
34
- rake (10.5.0)
35
- rspec (3.8.0)
36
- rspec-core (~> 3.8.0)
37
- rspec-expectations (~> 3.8.0)
38
- rspec-mocks (~> 3.8.0)
39
- rspec-core (3.8.0)
40
- rspec-support (~> 3.8.0)
41
- rspec-expectations (3.8.3)
51
+ rack (2.2.3)
52
+ rake (13.0.6)
53
+ rspec (3.10.0)
54
+ rspec-core (~> 3.10.0)
55
+ rspec-expectations (~> 3.10.0)
56
+ rspec-mocks (~> 3.10.0)
57
+ rspec-core (3.10.1)
58
+ rspec-support (~> 3.10.0)
59
+ rspec-expectations (3.10.1)
42
60
  diff-lcs (>= 1.2.0, < 2.0)
43
- rspec-support (~> 3.8.0)
44
- rspec-mocks (3.8.0)
61
+ rspec-support (~> 3.10.0)
62
+ rspec-mocks (3.10.2)
45
63
  diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.8.0)
47
- rspec-support (3.8.0)
48
- thread_safe (0.3.6)
49
- tzinfo (1.2.5)
50
- thread_safe (~> 0.1)
64
+ rspec-support (~> 3.10.0)
65
+ rspec-support (3.10.2)
66
+ ruby2_keywords (0.0.5)
67
+ tzinfo (2.0.4)
68
+ concurrent-ruby (~> 1.0)
69
+ zeitwerk (2.4.2)
51
70
 
52
71
  PLATFORMS
53
- ruby
72
+ x86_64-linux
54
73
 
55
74
  DEPENDENCIES
56
- bundler (~> 1.16)
57
- rake (~> 10.0)
75
+ bundler (>= 2.2.10)
76
+ rake (>= 12.3.3)
58
77
  reso_api!
59
78
  rspec (~> 3.0)
60
79
 
61
80
  BUNDLED WITH
62
- 1.16.1
81
+ 2.2.27
data/README.md CHANGED
@@ -31,11 +31,14 @@ To set up an API client and access a service, you need three pieces of informati
31
31
  - Client ID
32
32
  - Client Secret
33
33
  - Base API endpoint
34
+ - Authentication URL
34
35
 
35
- You pass these three pieces of information when creating an instance of an API client:
36
+ You'll recognize the base API endpoint by it ending with /odata, and the authentication URL by it likely ending with /token.
37
+
38
+ You pass these four pieces of information to create an instance of an API client:
36
39
 
37
40
  ```ruby
38
- client = RESO::API::Client.new(client_id: client_id, client_secret: client_secret, base_url: base_url)
41
+ client = RESO::API::Client.new(client_id: client_id, client_secret: client_secret, auth_url: auth_url, base_url: base_url)
39
42
  ```
40
43
 
41
44
  When calling API endpoints using the initialized client, it will automatically fetch and manage access and authentication tokens transparently in the background.
@@ -132,6 +135,14 @@ You can order the results by a field using `$orderby`:
132
135
  client.properties(orderby: "City desc")
133
136
  ```
134
137
 
138
+ #### $expand
139
+
140
+ $expand in oData is meant to join two resources together. For the Syndication API this means you can bring in photos to any property query.
141
+
142
+ ```ruby
143
+ client.properties(expand: "Media")
144
+ ```
145
+
135
146
  #### Pagination, $top, and $skip
136
147
 
137
148
  The default number of results returned is 100. You can override the default limit using the `$top` parameter. The higher the number specific for `$top`, the longer the API response will take, and pay attention to that different services does enforce a cap for number of records returned.
@@ -192,6 +203,7 @@ client.properties(top: 5, orderby: "ListingKey", skiptoken: "3yd-AAABORMI-320039
192
203
  This gem should work with any RESO Web API compliant service, but these are those that have been confirmed to work.
193
204
 
194
205
  - [ListHub](https://www.listhub.com)
206
+ - [CoreLogic Trestle](https://trestle.corelogic.com)
195
207
 
196
208
  If you use this gem to connect to another service or MLS, please submit a pull request with that service added in alphabetical order in this list.
197
209
 
@@ -7,16 +7,17 @@ module RESO
7
7
  require 'json'
8
8
  require 'tmpdir'
9
9
 
10
- attr_accessor :client_id, :client_secret, :base_url
10
+ attr_accessor :client_id, :client_secret, :auth_url, :base_url
11
11
 
12
12
  def initialize(**opts)
13
- @client_id, @client_secret, @base_url = opts.values_at(:client_id, :client_secret, :base_url)
13
+ @client_id, @client_secret, @auth_url, @base_url = opts.values_at(:client_id, :client_secret, :auth_url, :base_url)
14
14
  validate!
15
15
  end
16
16
 
17
17
  def validate!
18
18
  raise 'Missing Client ID `client_id`' if client_id.nil?
19
19
  raise 'Missing Client Secret `client_secret`' if client_secret.nil?
20
+ raise 'Missing Authentication URL `auth_url`' if auth_url.nil?
20
21
  raise 'Missing API Base URL `base_url`' if base_url.nil?
21
22
  end
22
23
 
@@ -28,21 +29,21 @@ module RESO
28
29
  }
29
30
 
30
31
  DETAIL_ENDPOINTS = {
31
- medium: "odata/Media",
32
- member: "odata/Member",
33
- office: "odata/Office",
34
- property: "odata/Property"
32
+ medium: "/Media",
33
+ member: "/Member",
34
+ office: "/Office",
35
+ property: "/Property"
35
36
  }
36
37
 
37
38
  FILTERABLE_ENDPOINTS = {
38
- media: "odata/Media",
39
- members: "odata/Member",
40
- offices: "odata/Office",
41
- properties: "odata/Property"
39
+ media: "/Media",
40
+ members: "/Member",
41
+ offices: "/Office",
42
+ properties: "/Property"
42
43
  }
43
44
 
44
45
  PASSTHROUGH_ENDPOINTS = {
45
- metadata: "odata/$metadata"
46
+ metadata: "/$metadata"
46
47
  }
47
48
 
48
49
  FILTERABLE_ENDPOINTS.keys.each do |method_name|
@@ -82,7 +83,9 @@ module RESO
82
83
  OAuth2::Client.new(
83
84
  client_id,
84
85
  client_secret,
85
- token_url: [base_url, "oauth2/token"].join
86
+ token_url: auth_url,
87
+ scope: "api",
88
+ grant_type: "client_credentials"
86
89
  )
87
90
  end
88
91
 
@@ -1,3 +1,3 @@
1
1
  module ResoApi
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/reso_api.gemspec CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.16"
24
- spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "bundler", ">= 2.2.10"
24
+ spec.add_development_dependency "rake", ">= 12.3.3"
25
25
  spec.add_development_dependency "rspec", "~> 3.0"
26
26
  spec.add_dependency 'activesupport'
27
27
  spec.add_dependency "oauth2"
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reso_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Edlund
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-08 00:00:00.000000000 Z
11
+ date: 2022-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: 2.2.10
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: 2.2.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -107,7 +107,7 @@ files:
107
107
  homepage: https://github.com/arcticleo/reso_api
108
108
  licenses: []
109
109
  metadata: {}
110
- post_install_message:
110
+ post_install_message:
111
111
  rdoc_options: []
112
112
  require_paths:
113
113
  - lib
@@ -122,9 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
- rubyforge_project:
126
- rubygems_version: 2.7.6
127
- signing_key:
125
+ rubygems_version: 3.3.7
126
+ signing_key:
128
127
  specification_version: 4
129
128
  summary: RESO Web API Wrapper
130
129
  test_files: []