reso_api 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/reso_api/app/models/reso/api/client.rb +15 -12
- data/lib/reso_api/version.rb +1 -1
- metadata +6 -6
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/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
|
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.
|
@@ -200,6 +203,7 @@ client.properties(top: 5, orderby: "ListingKey", skiptoken: "3yd-AAABORMI-320039
|
|
200
203
|
This gem should work with any RESO Web API compliant service, but these are those that have been confirmed to work.
|
201
204
|
|
202
205
|
- [ListHub](https://www.listhub.com)
|
206
|
+
- [CoreLogic Trestle](https://trestle.corelogic.com)
|
203
207
|
|
204
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.
|
205
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|
|
@@ -82,7 +83,9 @@ module RESO
|
|
82
83
|
OAuth2::Client.new(
|
83
84
|
client_id,
|
84
85
|
client_secret,
|
85
|
-
token_url:
|
86
|
+
token_url: auth_url,
|
87
|
+
scope: "api",
|
88
|
+
grant_type: "client_credentials"
|
86
89
|
)
|
87
90
|
end
|
88
91
|
|
data/lib/reso_api/version.rb
CHANGED
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
|
+
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
|
@@ -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,8 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
|
-
rubygems_version: 3.
|
126
|
-
signing_key:
|
125
|
+
rubygems_version: 3.3.7
|
126
|
+
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: RESO Web API Wrapper
|
129
129
|
test_files: []
|