easy_broker 0.1.4 → 1.0.1

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: ee218a0504e6003f7e3016af14294e825984af1059e24e99742175e012d74867
4
- data.tar.gz: c4ed7d8a4b5abd8805eae7c3476e253900f5729d5e4189dc4a7db18ecb91d8f4
3
+ metadata.gz: 45d36d59dcaf0b6a07c5fb9d065711747dca59b66349850fa13f592a04bb9b25
4
+ data.tar.gz: 634332b115e07adc6710cd84a1a8919a330def6bdcae57348cf54dc8e1308250
5
5
  SHA512:
6
- metadata.gz: 6daa0c152e04a78f23685e78046ab4a2456776f84c8a2da4caf5b53329ef8d76c7e64dbc727f3bea82674a59bec19307f4621182ce9430e37f62fead07baeb31
7
- data.tar.gz: f6b9dc60d9cee16b53f7b61360534a68190591cffc7641d4009334917fe2af42a8d9f382fb1ab0e7089c1b0e69c45120acbe847f74c4b7356008643cf3fc4fa9
6
+ metadata.gz: c49e16d780adbf8ed5976c6fa0693569f629cb5424e9e84c50f94ee29c8ea373333613eebc4aaa3f2b34e080a8aaf6fd6bc6e025bb2da07eb32882547c6c532e
7
+ data.tar.gz: c6f04a4c3af67649bd51fb423e11a0059d46e58dba92aee0062c4467a47c55e44ef56aa60a7beeca1581095e1b63e17dd1e8274510ee3b2acb7eadf49611a117
data/.gitignore CHANGED
@@ -9,4 +9,5 @@
9
9
  Gemfile.lock
10
10
  /vendor
11
11
  .DS_Store
12
- *.gem
12
+ *.gem
13
+ .idea
data/CHANGELOG.md CHANGED
@@ -11,3 +11,13 @@
11
11
 
12
12
  ## 0.1.4
13
13
  * Added support for the listing_statuses endpoint.
14
+
15
+ ## 0.1.5
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.
data/README.md CHANGED
@@ -61,7 +61,10 @@ results.next_page
61
61
 
62
62
 
63
63
  # Search for only published properties
64
- client.properties.search(search: { statuses: [:published] } )
64
+ client.properties.search(search: { statuses: [:published] }, limit: 1, page: 1)
65
+
66
+ # As a partner you can update the property integration on EB
67
+ client.integration_partners.property_integrations.update('EB-123', body: { status: 'successful', listing_url: "https://www.yourwebsite.com/EB-XXXX01" })
65
68
  ```
66
69
 
67
70
  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,6 +82,13 @@ client.contact_requests # List and search contact requests in your account - TDB
79
82
  client.properties # List, search and find properties in your account
80
83
  client.mls_properties # List, search and find properties in the MLS - requires MLS API Plan
81
84
  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
85
+
86
+ ### The following require a partner api key.
87
+ client.integration_partners.agencies # List and search connected agencies.
88
+ client.integration_partners.agents # View detailed agent contact information for those agents assigned to properties.
89
+ client.integration_partners.listing_statuses # List and search the listing status for partner properties.
90
+ client.integration_partners.properties # View the full property listing and its details.
91
+ client.integration_partners.property_integrations # Update the property integration on EB with the listing status on your website.
82
92
  ```
83
93
 
84
94
  ## Development
@@ -20,11 +20,11 @@ class EasyBroker::ApiClient
20
20
  end
21
21
 
22
22
  def post(path, query: {}, body: {})
23
- send_request(:post, path, query: query, body: body)
23
+ send_request(:post, path, query: query, body: body.to_json)
24
24
  end
25
25
 
26
26
  def put(path, query: {}, body: {})
27
- send_request(:put, path, query: query, body: body)
27
+ send_request(:put, path, query: query, body: body.to_json)
28
28
  end
29
29
 
30
30
  def delete(path, query: {})
@@ -34,9 +34,7 @@ class EasyBroker::ApiClient
34
34
  private
35
35
 
36
36
  def send_request(verb, path = '', params = {})
37
- query = params[:query] || params['query'] || {}
38
-
39
- self.class.send(verb, path, params.merge(query)).tap do |response|
37
+ self.class.send(verb, path, params).tap do |response|
40
38
  check_errors(response)
41
39
  logger&.log response
42
40
  end
@@ -5,7 +5,7 @@ module EasyBroker
5
5
  'Accept' => 'application/json',
6
6
  'User-Agent' => USER_AGENT
7
7
  }
8
- DEFAULT_API_ROOT_URL = 'https://www.easybroker.com/api/v1'
9
- STAGING_API_ROOT_URL = 'https://www.stagingeb.com/api/v1'
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
11
  end
@@ -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 ListingStatuses
6
+ ENDPOINT = '/integration_partners/listing_statuses'
7
+
8
+ attr_reader :api_client
9
+
10
+ def initialize(api_client)
11
+ @api_client = api_client
12
+ end
13
+
14
+ def search(query = {})
15
+ stored_query = EasyBroker::Query.new(api_client, ENDPOINT, query)
16
+ EasyBroker::PaginatedResponse.new(stored_query)
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
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EasyBroker
4
+ module IntegrationPartners
5
+ class PublicClient
6
+ attr_reader :api_client
7
+
8
+ def initialize(api_client)
9
+ @api_client = api_client
10
+ end
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
+
20
+ def listing_statuses
21
+ EasyBroker::IntegrationPartners::ListingStatuses.new(api_client)
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
31
+ end
32
+ end
33
+ end
@@ -26,4 +26,8 @@ class EasyBroker::PublicClient
26
26
  def listing_statuses
27
27
  EasyBroker::ListingStatuses.new(api_client)
28
28
  end
29
+
30
+ def integration_partners
31
+ EasyBroker::IntegrationPartners::PublicClient.new(api_client)
32
+ end
29
33
  end
@@ -9,8 +9,8 @@ class EasyBroker::Query
9
9
  @query_params = query_params
10
10
  end
11
11
 
12
- def get(page = 1)
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
@@ -1,3 +1,3 @@
1
1
  module EasyBroker
2
- VERSION = "0.1.4"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/easy_broker.rb CHANGED
@@ -13,6 +13,12 @@ require 'easy_broker/mls_properties'
13
13
  require 'easy_broker/contact_requests'
14
14
  require 'easy_broker/locations'
15
15
  require 'easy_broker/listing_statuses'
16
+ require 'easy_broker/integration_partners/public_client'
17
+ require 'easy_broker/integration_partners/agencies'
18
+ require 'easy_broker/integration_partners/agents'
19
+ require 'easy_broker/integration_partners/listing_statuses'
20
+ require 'easy_broker/integration_partners/properties'
21
+ require 'easy_broker/integration_partners/property_integrations'
16
22
 
17
23
  module EasyBroker
18
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.1.4
4
+ version: 1.0.1
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-05-10 00:00:00.000000000 Z
11
+ date: 2022-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -130,6 +130,12 @@ 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
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
138
+ - lib/easy_broker/integration_partners/public_client.rb
133
139
  - lib/easy_broker/listing_statuses.rb
134
140
  - lib/easy_broker/locations.rb
135
141
  - lib/easy_broker/mls_properties.rb
@@ -158,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
164
  - !ruby/object:Gem::Version
159
165
  version: '0'
160
166
  requirements: []
161
- rubygems_version: 3.1.6
167
+ rubygems_version: 3.0.3.1
162
168
  signing_key:
163
169
  specification_version: 4
164
170
  summary: A gem to work with EasyBroker's API