easy_broker 0.1.5 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +14 -2
- data/lib/easy_broker/api_client.rb +6 -7
- data/lib/easy_broker/configuration.rb +2 -1
- data/lib/easy_broker/constants.rb +3 -2
- data/lib/easy_broker/errors.rb +2 -2
- data/lib/easy_broker/integration_partners/agencies.rb +25 -0
- data/lib/easy_broker/integration_partners/agents.rb +20 -0
- data/lib/easy_broker/integration_partners/properties.rb +20 -0
- data/lib/easy_broker/integration_partners/property_integrations.rb +20 -0
- data/lib/easy_broker/integration_partners/public_client.rb +16 -0
- data/lib/easy_broker/query.rb +2 -2
- data/lib/easy_broker/version.rb +1 -1
- data/lib/easy_broker.rb +4 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 417f7f736a72535965e55d9223869e88f6f3f9e14a055668f8dfe7c165ed0d45
|
4
|
+
data.tar.gz: c7196e2f63f4cebe1e9483ce909fdd2be313935d6cca05f5261686e96f4acf58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05d8a95e19cb55312fc15bc5150d126e26540dea895cfb397ffc4fe896d73a9a7b44c8ba3ed9c54c5bc4c16680a7b350b204b2132cd1a4619b69595c74ff8fdc
|
7
|
+
data.tar.gz: a6fee3cde01a6f5381b0aa2e189ff808e88377de181b483b8a37699a15cb8c0de80d38e2b0b63d935466cebfb32141b9b5b5f08623b88218e9e5cc790ac211da
|
data/CHANGELOG.md
CHANGED
@@ -14,3 +14,13 @@
|
|
14
14
|
|
15
15
|
## 0.1.5
|
16
16
|
* Added support for the listing_statuses endpoint for integration partners.
|
17
|
+
|
18
|
+
## 1.0.0
|
19
|
+
* **Breaking change**: `limit`, `page`, and `search` params should be at the root level requests instead of in the `query` hash.
|
20
|
+
* Updated endpoints to use the `api` subdomain; `api.easybroker.com/v1` instead of `www.easybroker.com/api/v1`.
|
21
|
+
|
22
|
+
# 1.0.1
|
23
|
+
* Added support for agencies, agents, properties and property_integrations endpoints for integration partners.
|
24
|
+
|
25
|
+
# 1.0.2
|
26
|
+
* Added support to configure the country code header for integration partners endpoints.
|
data/README.md
CHANGED
@@ -29,6 +29,9 @@ EasyBroker.configure do |config|
|
|
29
29
|
|
30
30
|
# Optionally change the root API URL
|
31
31
|
# config.api_root_url = EasyBroker::STAGING_API_ROOT_URL
|
32
|
+
|
33
|
+
# As an integration partner you must configure the country code
|
34
|
+
# config.country_code = 'MX'
|
32
35
|
end
|
33
36
|
```
|
34
37
|
|
@@ -61,7 +64,10 @@ results.next_page
|
|
61
64
|
|
62
65
|
|
63
66
|
# Search for only published properties
|
64
|
-
client.properties.search(search: { statuses: [:published] } )
|
67
|
+
client.properties.search(search: { statuses: [:published] }, limit: 1, page: 1)
|
68
|
+
|
69
|
+
# As a partner you can update the property integration on EB
|
70
|
+
client.integration_partners.property_integrations.update('EB-123', body: { status: 'successful', listing_url: "https://www.yourwebsite.com/EB-XXXX01" })
|
65
71
|
```
|
66
72
|
|
67
73
|
You can also pass a logger to log any methods that make remote calls. The logger class must implement a `log` method which will be called with the [HTTParty response](https://www.rubydoc.info/github/jnunemaker/httparty/HTTParty/Response) for every remote request sent.
|
@@ -79,7 +85,13 @@ client.contact_requests # List and search contact requests in your account - TDB
|
|
79
85
|
client.properties # List, search and find properties in your account
|
80
86
|
client.mls_properties # List, search and find properties in the MLS - requires MLS API Plan
|
81
87
|
client.listing_statuses # List and search the listing status for properties. Great for syncing large sets of properties. - includes MLS properties if you have the MLS Plan
|
82
|
-
|
88
|
+
|
89
|
+
### The following require a partner api key.
|
90
|
+
client.integration_partners.agencies # List and search connected agencies.
|
91
|
+
client.integration_partners.agents # View detailed agent contact information for those agents assigned to properties.
|
92
|
+
client.integration_partners.listing_statuses # List and search the listing status for partner properties.
|
93
|
+
client.integration_partners.properties # View the full property listing and its details.
|
94
|
+
client.integration_partners.property_integrations # Update the property integration on EB with the listing status on your website.
|
83
95
|
```
|
84
96
|
|
85
97
|
## Development
|
@@ -10,8 +10,9 @@ class EasyBroker::ApiClient
|
|
10
10
|
def initialize(logger: nil)
|
11
11
|
self.class.base_uri EasyBroker.configuration.api_root_url
|
12
12
|
self.class.headers EasyBroker::DEFAULT_HEADERS.merge(
|
13
|
-
EasyBroker::AUTHORIZATION_HEADER => EasyBroker.configuration.api_key
|
14
|
-
|
13
|
+
EasyBroker::AUTHORIZATION_HEADER => EasyBroker.configuration.api_key,
|
14
|
+
EasyBroker::COUNTRY_CODE_HEADER => EasyBroker.configuration.country_code
|
15
|
+
).compact
|
15
16
|
@logger = logger
|
16
17
|
end
|
17
18
|
|
@@ -20,11 +21,11 @@ class EasyBroker::ApiClient
|
|
20
21
|
end
|
21
22
|
|
22
23
|
def post(path, query: {}, body: {})
|
23
|
-
send_request(:post, path, query: query, body: body)
|
24
|
+
send_request(:post, path, query: query, body: body.to_json)
|
24
25
|
end
|
25
26
|
|
26
27
|
def put(path, query: {}, body: {})
|
27
|
-
send_request(:put, path, query: query, body: body)
|
28
|
+
send_request(:put, path, query: query, body: body.to_json)
|
28
29
|
end
|
29
30
|
|
30
31
|
def delete(path, query: {})
|
@@ -34,9 +35,7 @@ class EasyBroker::ApiClient
|
|
34
35
|
private
|
35
36
|
|
36
37
|
def send_request(verb, path = '', params = {})
|
37
|
-
|
38
|
-
|
39
|
-
self.class.send(verb, path, params.merge(query)).tap do |response|
|
38
|
+
self.class.send(verb, path, params).tap do |response|
|
40
39
|
check_errors(response)
|
41
40
|
logger&.log response
|
42
41
|
end
|
@@ -5,7 +5,8 @@ module EasyBroker
|
|
5
5
|
'Accept' => 'application/json',
|
6
6
|
'User-Agent' => USER_AGENT
|
7
7
|
}
|
8
|
-
DEFAULT_API_ROOT_URL = 'https://
|
9
|
-
STAGING_API_ROOT_URL = 'https://
|
8
|
+
DEFAULT_API_ROOT_URL = 'https://api.easybroker.com/v1'
|
9
|
+
STAGING_API_ROOT_URL = 'https://api.stagingeb.com/v1'
|
10
10
|
AUTHORIZATION_HEADER = 'X-Authorization'
|
11
|
+
COUNTRY_CODE_HEADER = 'Country-Code'
|
11
12
|
end
|
data/lib/easy_broker/errors.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EasyBroker
|
4
|
+
module IntegrationPartners
|
5
|
+
class Agencies
|
6
|
+
ENDPOINT = '/integration_partners/agencies'
|
7
|
+
|
8
|
+
attr_reader :api_client
|
9
|
+
|
10
|
+
def initialize(api_client)
|
11
|
+
@api_client = api_client
|
12
|
+
end
|
13
|
+
|
14
|
+
def find(agency_id)
|
15
|
+
response = api_client.get("#{ENDPOINT}/#{agency_id}")
|
16
|
+
JSON.parse(response.body, object_class: OpenStruct)
|
17
|
+
end
|
18
|
+
|
19
|
+
def search(query = {})
|
20
|
+
stored_query = EasyBroker::Query.new(api_client, ENDPOINT, query)
|
21
|
+
EasyBroker::PaginatedResponse.new(stored_query)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EasyBroker
|
4
|
+
module IntegrationPartners
|
5
|
+
class Agents
|
6
|
+
ENDPOINT = '/integration_partners/agents'
|
7
|
+
|
8
|
+
attr_reader :api_client
|
9
|
+
|
10
|
+
def initialize(api_client)
|
11
|
+
@api_client = api_client
|
12
|
+
end
|
13
|
+
|
14
|
+
def find(agent_id)
|
15
|
+
response = api_client.get("#{ENDPOINT}/#{agent_id}")
|
16
|
+
JSON.parse(response.body, object_class: OpenStruct)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EasyBroker
|
4
|
+
module IntegrationPartners
|
5
|
+
class Properties
|
6
|
+
ENDPOINT = '/integration_partners/properties'
|
7
|
+
|
8
|
+
attr_reader :api_client
|
9
|
+
|
10
|
+
def initialize(api_client)
|
11
|
+
@api_client = api_client
|
12
|
+
end
|
13
|
+
|
14
|
+
def find(property_id)
|
15
|
+
response = api_client.get("#{ENDPOINT}/#{property_id}")
|
16
|
+
JSON.parse(response.body, object_class: OpenStruct)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EasyBroker
|
4
|
+
module IntegrationPartners
|
5
|
+
class PropertyIntegrations
|
6
|
+
ENDPOINT = "/integration_partners/properties/%{property_id}/property_integration"
|
7
|
+
|
8
|
+
attr_reader :api_client
|
9
|
+
|
10
|
+
def initialize(api_client)
|
11
|
+
@api_client = api_client
|
12
|
+
end
|
13
|
+
|
14
|
+
def update(property_id, body: {})
|
15
|
+
response = api_client.put(format(ENDPOINT, property_id: property_id), body: body)
|
16
|
+
JSON.parse(response.body, object_class: OpenStruct)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -9,9 +9,25 @@ module EasyBroker
|
|
9
9
|
@api_client = api_client
|
10
10
|
end
|
11
11
|
|
12
|
+
def agencies
|
13
|
+
EasyBroker::IntegrationPartners::Agencies.new(api_client)
|
14
|
+
end
|
15
|
+
|
16
|
+
def agents
|
17
|
+
EasyBroker::IntegrationPartners::Agents.new(api_client)
|
18
|
+
end
|
19
|
+
|
12
20
|
def listing_statuses
|
13
21
|
EasyBroker::IntegrationPartners::ListingStatuses.new(api_client)
|
14
22
|
end
|
23
|
+
|
24
|
+
def properties
|
25
|
+
EasyBroker::IntegrationPartners::Properties.new(api_client)
|
26
|
+
end
|
27
|
+
|
28
|
+
def property_integrations
|
29
|
+
EasyBroker::IntegrationPartners::PropertyIntegrations.new(api_client)
|
30
|
+
end
|
15
31
|
end
|
16
32
|
end
|
17
33
|
end
|
data/lib/easy_broker/query.rb
CHANGED
@@ -9,8 +9,8 @@ class EasyBroker::Query
|
|
9
9
|
@query_params = query_params
|
10
10
|
end
|
11
11
|
|
12
|
-
def get(page =
|
13
|
-
query_params[:page] = page
|
12
|
+
def get(page = nil)
|
13
|
+
query_params[:page] = page if page
|
14
14
|
response = api_client.get(endpoint, query: query_params)
|
15
15
|
JSON.parse(response.body, object_class: OpenStruct)
|
16
16
|
end
|
data/lib/easy_broker/version.rb
CHANGED
data/lib/easy_broker.rb
CHANGED
@@ -14,7 +14,11 @@ require 'easy_broker/contact_requests'
|
|
14
14
|
require 'easy_broker/locations'
|
15
15
|
require 'easy_broker/listing_statuses'
|
16
16
|
require 'easy_broker/integration_partners/public_client'
|
17
|
+
require 'easy_broker/integration_partners/agencies'
|
18
|
+
require 'easy_broker/integration_partners/agents'
|
17
19
|
require 'easy_broker/integration_partners/listing_statuses'
|
20
|
+
require 'easy_broker/integration_partners/properties'
|
21
|
+
require 'easy_broker/integration_partners/property_integrations'
|
18
22
|
|
19
23
|
module EasyBroker
|
20
24
|
def self.configuration
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_broker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Northam
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -130,7 +130,11 @@ files:
|
|
130
130
|
- lib/easy_broker/constants.rb
|
131
131
|
- lib/easy_broker/contact_requests.rb
|
132
132
|
- lib/easy_broker/errors.rb
|
133
|
+
- lib/easy_broker/integration_partners/agencies.rb
|
134
|
+
- lib/easy_broker/integration_partners/agents.rb
|
133
135
|
- lib/easy_broker/integration_partners/listing_statuses.rb
|
136
|
+
- lib/easy_broker/integration_partners/properties.rb
|
137
|
+
- lib/easy_broker/integration_partners/property_integrations.rb
|
134
138
|
- lib/easy_broker/integration_partners/public_client.rb
|
135
139
|
- lib/easy_broker/listing_statuses.rb
|
136
140
|
- lib/easy_broker/locations.rb
|