reso_api 0.1.0 → 0.3.0
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 +81 -0
- data/README.md +16 -7
- data/lib/reso_api/app/models/reso/api/client.rb +18 -13
- data/lib/reso_api/version.rb +1 -1
- data/lib/reso_api.rb +1 -0
- data/reso_api.gemspec +3 -2
- metadata +29 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91f8dc7ead6ed968688dfc9c53c0e5a35ed1c4dffe5801fad27d97fae704bf57
|
4
|
+
data.tar.gz: e5a3d7475620f94bf470fde3e92a4e9dfbd4820c44df7aa1ed056e35bdb04ace
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1e5e3408a40ee54db7dec2d959a16af34a9f6b31e4590d30116da71a7b81b9513f4de5eb14f996cc3b21a1cd9293a8a48c31841cfbebdf1b2edba7e540cc9c5
|
7
|
+
data.tar.gz: e7a10e99a931cd6a7e3eeb122d27fbc8c77a872846c4709264d3054586b63fff6a66c56488e9e41d455a95f9c4047df6db92ea114f22502fb3fc1479d2167f40
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
reso_api (0.2.1)
|
5
|
+
activesupport
|
6
|
+
oauth2
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (6.1.4.1)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
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)
|
28
|
+
multipart-post (>= 1.2, < 3)
|
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)
|
39
|
+
concurrent-ruby (~> 1.0)
|
40
|
+
jwt (2.2.3)
|
41
|
+
minitest (5.14.4)
|
42
|
+
multi_json (1.15.0)
|
43
|
+
multi_xml (0.6.0)
|
44
|
+
multipart-post (2.1.1)
|
45
|
+
oauth2 (1.4.7)
|
46
|
+
faraday (>= 0.8, < 2.0)
|
47
|
+
jwt (>= 1.0, < 3.0)
|
48
|
+
multi_json (~> 1.3)
|
49
|
+
multi_xml (~> 0.5)
|
50
|
+
rack (>= 1.2, < 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)
|
60
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
61
|
+
rspec-support (~> 3.10.0)
|
62
|
+
rspec-mocks (3.10.2)
|
63
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
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)
|
70
|
+
|
71
|
+
PLATFORMS
|
72
|
+
x86_64-linux
|
73
|
+
|
74
|
+
DEPENDENCIES
|
75
|
+
bundler (>= 2.2.10)
|
76
|
+
rake (>= 12.3.3)
|
77
|
+
reso_api!
|
78
|
+
rspec (~> 3.0)
|
79
|
+
|
80
|
+
BUNDLED WITH
|
81
|
+
2.2.27
|
data/README.md
CHANGED
@@ -31,26 +31,26 @@ 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
|
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.
|
42
45
|
|
43
46
|
### Resources
|
44
47
|
|
45
|
-
#### Supported
|
46
|
-
|
47
|
-
- Property
|
48
|
-
|
49
|
-
#### Planned
|
48
|
+
#### Supported Resources
|
50
49
|
|
51
50
|
- Media
|
52
51
|
- Member
|
53
52
|
- Office
|
53
|
+
- Property
|
54
54
|
|
55
55
|
### Retrieving Metadata
|
56
56
|
|
@@ -135,6 +135,14 @@ You can order the results by a field using `$orderby`:
|
|
135
135
|
client.properties(orderby: "City desc")
|
136
136
|
```
|
137
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(еxpand: "Media")
|
144
|
+
```
|
145
|
+
|
138
146
|
#### Pagination, $top, and $skip
|
139
147
|
|
140
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.
|
@@ -195,6 +203,7 @@ client.properties(top: 5, orderby: "ListingKey", skiptoken: "3yd-AAABORMI-320039
|
|
195
203
|
This gem should work with any RESO Web API compliant service, but these are those that have been confirmed to work.
|
196
204
|
|
197
205
|
- [ListHub](https://www.listhub.com)
|
206
|
+
- [CoreLogic Trestle](https://trestle.corelogic.com)
|
198
207
|
|
199
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.
|
200
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: "
|
32
|
-
member: "
|
33
|
-
office: "
|
34
|
-
property: "
|
32
|
+
medium: "/Media",
|
33
|
+
member: "/Member",
|
34
|
+
office: "/Office",
|
35
|
+
property: "/Property"
|
35
36
|
}
|
36
37
|
|
37
38
|
FILTERABLE_ENDPOINTS = {
|
38
|
-
media: "
|
39
|
-
members: "
|
40
|
-
offices: "
|
41
|
-
properties: "
|
39
|
+
media: "/Media",
|
40
|
+
members: "/Member",
|
41
|
+
offices: "/Office",
|
42
|
+
properties: "/Property"
|
42
43
|
}
|
43
44
|
|
44
45
|
PASSTHROUGH_ENDPOINTS = {
|
45
|
-
metadata: "
|
46
|
+
metadata: "/$metadata"
|
46
47
|
}
|
47
48
|
|
48
49
|
FILTERABLE_ENDPOINTS.keys.each do |method_name|
|
@@ -57,7 +58,8 @@ module RESO
|
|
57
58
|
"$orderby": hash[:orderby] ||= RESOURCE_KEYS[method_name],
|
58
59
|
"$skiptoken": hash[:skiptoken],
|
59
60
|
"$expand": hash[:expand],
|
60
|
-
"$count": hash[:count].to_s.presence
|
61
|
+
"$count": hash[:count].to_s.presence,
|
62
|
+
"$debug": hash[:debug]
|
61
63
|
}.compact
|
62
64
|
return perform_call(endpoint, params)
|
63
65
|
end
|
@@ -81,7 +83,9 @@ module RESO
|
|
81
83
|
OAuth2::Client.new(
|
82
84
|
client_id,
|
83
85
|
client_secret,
|
84
|
-
token_url:
|
86
|
+
token_url: auth_url,
|
87
|
+
scope: "api",
|
88
|
+
grant_type: "client_credentials"
|
85
89
|
)
|
86
90
|
end
|
87
91
|
|
@@ -127,6 +131,7 @@ module RESO
|
|
127
131
|
if params.present?
|
128
132
|
query = params.present? ? URI.encode_www_form(params).gsub("+", " ") : ""
|
129
133
|
uri.query && uri.query.length > 0 ? uri.query += '&' + query : uri.query = query
|
134
|
+
return URI::decode(uri.request_uri) if params.dig(:$debug).present?
|
130
135
|
end
|
131
136
|
request = Net::HTTP::Get.new(uri.request_uri)
|
132
137
|
request['Authorization'] = "Bearer #{oauth2_token}"
|
data/lib/reso_api/version.rb
CHANGED
data/lib/reso_api.rb
CHANGED
data/reso_api.gemspec
CHANGED
@@ -20,8 +20,9 @@ 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", "
|
24
|
-
spec.add_development_dependency "rake", "
|
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
|
+
spec.add_dependency 'activesupport'
|
26
27
|
spec.add_dependency "oauth2"
|
27
28
|
end
|
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.
|
4
|
+
version: 0.3.0
|
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:
|
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:
|
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:
|
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:
|
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:
|
40
|
+
version: 12.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: oauth2
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,6 +92,7 @@ files:
|
|
78
92
|
- ".travis.yml"
|
79
93
|
- CODE_OF_CONDUCT.md
|
80
94
|
- Gemfile
|
95
|
+
- Gemfile.lock
|
81
96
|
- README.md
|
82
97
|
- Rakefile
|
83
98
|
- bin/console
|
@@ -92,7 +107,7 @@ files:
|
|
92
107
|
homepage: https://github.com/arcticleo/reso_api
|
93
108
|
licenses: []
|
94
109
|
metadata: {}
|
95
|
-
post_install_message:
|
110
|
+
post_install_message:
|
96
111
|
rdoc_options: []
|
97
112
|
require_paths:
|
98
113
|
- lib
|
@@ -107,9 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
122
|
- !ruby/object:Gem::Version
|
108
123
|
version: '0'
|
109
124
|
requirements: []
|
110
|
-
|
111
|
-
|
112
|
-
signing_key:
|
125
|
+
rubygems_version: 3.3.7
|
126
|
+
signing_key:
|
113
127
|
specification_version: 4
|
114
128
|
summary: RESO Web API Wrapper
|
115
129
|
test_files: []
|