easy_broker 0.1.1 → 0.1.4
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/CHANGELOG.md +10 -1
- data/README.md +24 -3
- data/easy_broker.gemspec +1 -1
- data/lib/easy_broker/constants.rb +1 -0
- data/lib/easy_broker/contact_requests.rb +16 -0
- data/lib/easy_broker/listing_statuses.rb +16 -0
- data/lib/easy_broker/locations.rb +16 -0
- data/lib/easy_broker/mls_properties.rb +21 -0
- data/lib/easy_broker/paginated_response.rb +4 -6
- data/lib/easy_broker/public_client.rb +16 -0
- data/lib/easy_broker/version.rb +1 -1
- data/lib/easy_broker.rb +4 -0
- metadata +9 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee218a0504e6003f7e3016af14294e825984af1059e24e99742175e012d74867
|
|
4
|
+
data.tar.gz: c4ed7d8a4b5abd8805eae7c3476e253900f5729d5e4189dc4a7db18ecb91d8f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6daa0c152e04a78f23685e78046ab4a2456776f84c8a2da4caf5b53329ef8d76c7e64dbc727f3bea82674a59bec19307f4621182ce9430e37f62fead07baeb31
|
|
7
|
+
data.tar.gz: f6b9dc60d9cee16b53f7b61360534a68190591cffc7641d4009334917fe2af42a8d9f382fb1ab0e7089c1b0e69c45120acbe847f74c4b7356008643cf3fc4fa9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
## 0.1.1
|
|
4
|
-
* Initial release
|
|
4
|
+
* Initial release.
|
|
5
|
+
|
|
6
|
+
## 0.1.2
|
|
7
|
+
* Added support for contact_requests, mls_properties and locations endpoints.
|
|
8
|
+
|
|
9
|
+
## 0.1.3
|
|
10
|
+
* Fixed pagination bug where the last page may not have been included.
|
|
11
|
+
|
|
12
|
+
## 0.1.4
|
|
13
|
+
* Added support for the listing_statuses endpoint.
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# EasyBroker
|
|
2
2
|
|
|
3
|
-
A gem that makes it easy to work with the [EasyBroker API](https://api.easybroker.com/
|
|
3
|
+
A gem that makes it easy to work with the [EasyBroker API](https://api.easybroker.com/).
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -28,7 +28,7 @@ EasyBroker.configure do |config|
|
|
|
28
28
|
config.api_key = 'your_app_key'
|
|
29
29
|
|
|
30
30
|
# Optionally change the root API URL
|
|
31
|
-
# config.api_root_url =
|
|
31
|
+
# config.api_root_url = EasyBroker::STAGING_API_ROOT_URL
|
|
32
32
|
end
|
|
33
33
|
```
|
|
34
34
|
|
|
@@ -50,6 +50,16 @@ results.find_each do |property|
|
|
|
50
50
|
puts property.public_id
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
+
# The total number of results of all pages
|
|
54
|
+
results.total
|
|
55
|
+
|
|
56
|
+
# The current page
|
|
57
|
+
results.page
|
|
58
|
+
|
|
59
|
+
# Loads the next page results
|
|
60
|
+
results.next_page
|
|
61
|
+
|
|
62
|
+
|
|
53
63
|
# Search for only published properties
|
|
54
64
|
client.properties.search(search: { statuses: [:published] } )
|
|
55
65
|
```
|
|
@@ -57,7 +67,18 @@ client.properties.search(search: { statuses: [:published] } )
|
|
|
57
67
|
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.
|
|
58
68
|
|
|
59
69
|
```ruby
|
|
60
|
-
EasyBroker.
|
|
70
|
+
EasyBroker.client(logger: my_logger)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Available Endpoints
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
```ruby
|
|
77
|
+
client.locations # List and search geographic locations
|
|
78
|
+
client.contact_requests # List and search contact requests in your account - TDB create via post
|
|
79
|
+
client.properties # List, search and find properties in your account
|
|
80
|
+
client.mls_properties # List, search and find properties in the MLS - requires MLS API Plan
|
|
81
|
+
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
|
|
61
82
|
```
|
|
62
83
|
|
|
63
84
|
## Development
|
data/easy_broker.gemspec
CHANGED
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
|
|
31
31
|
spec.add_dependency "httparty", "~> 0.18"
|
|
32
32
|
|
|
33
|
-
spec.add_development_dependency "bundler", "~>
|
|
33
|
+
spec.add_development_dependency "bundler", "~> 2.2"
|
|
34
34
|
spec.add_development_dependency "rake", "~> 13.0"
|
|
35
35
|
spec.add_development_dependency "minitest", "~> 5.0"
|
|
36
36
|
spec.add_development_dependency "pry"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class EasyBroker::ContactRequests
|
|
4
|
+
ENDPOINT = '/contact_requests'
|
|
5
|
+
|
|
6
|
+
attr_reader :api_client
|
|
7
|
+
|
|
8
|
+
def initialize(api_client)
|
|
9
|
+
@api_client = api_client
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def search(query = {})
|
|
13
|
+
stored_query = EasyBroker::Query.new(api_client, ENDPOINT, query)
|
|
14
|
+
EasyBroker::PaginatedResponse.new(stored_query)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class EasyBroker::ListingStatuses
|
|
4
|
+
ENDPOINT = '/listing_statuses'
|
|
5
|
+
|
|
6
|
+
attr_reader :api_client
|
|
7
|
+
|
|
8
|
+
def initialize(api_client)
|
|
9
|
+
@api_client = api_client
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def search(query = {})
|
|
13
|
+
stored_query = EasyBroker::Query.new(api_client, ENDPOINT, query)
|
|
14
|
+
EasyBroker::PaginatedResponse.new(stored_query)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class EasyBroker::Locations
|
|
4
|
+
ENDPOINT = '/locations'
|
|
5
|
+
|
|
6
|
+
attr_reader :api_client
|
|
7
|
+
|
|
8
|
+
def initialize(api_client)
|
|
9
|
+
@api_client = api_client
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def search(query = {})
|
|
13
|
+
stored_query = EasyBroker::Query.new(api_client, ENDPOINT, query)
|
|
14
|
+
EasyBroker::PaginatedResponse.new(stored_query)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class EasyBroker::MlsProperties
|
|
4
|
+
ENDPOINT = '/mls_properties'
|
|
5
|
+
|
|
6
|
+
attr_reader :api_client
|
|
7
|
+
|
|
8
|
+
def initialize(api_client)
|
|
9
|
+
@api_client = api_client
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def find(public_id)
|
|
13
|
+
response = api_client.get("#{ENDPOINT}/#{public_id}")
|
|
14
|
+
JSON.parse(response.body, object_class: OpenStruct)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def search(query = {})
|
|
18
|
+
stored_query = EasyBroker::Query.new(api_client, ENDPOINT, query)
|
|
19
|
+
EasyBroker::PaginatedResponse.new(stored_query)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -17,14 +17,12 @@ class EasyBroker::PaginatedResponse
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def page
|
|
20
|
-
pagination&.page
|
|
20
|
+
pagination&.page || 1
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def next_page
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if next_page_number * limit <= total
|
|
27
|
-
@response = query.get(next_page_number)
|
|
24
|
+
if page * limit < total
|
|
25
|
+
@response = query.get(page + 1)
|
|
28
26
|
end
|
|
29
27
|
end
|
|
30
28
|
|
|
@@ -51,4 +49,4 @@ class EasyBroker::PaginatedResponse
|
|
|
51
49
|
def pagination
|
|
52
50
|
response&.pagination
|
|
53
51
|
end
|
|
54
|
-
end
|
|
52
|
+
end
|
|
@@ -10,4 +10,20 @@ class EasyBroker::PublicClient
|
|
|
10
10
|
def properties
|
|
11
11
|
EasyBroker::Properties.new(api_client)
|
|
12
12
|
end
|
|
13
|
+
|
|
14
|
+
def mls_properties
|
|
15
|
+
EasyBroker::MlsProperties.new(api_client)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def contact_requests
|
|
19
|
+
EasyBroker::ContactRequests.new(api_client)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def locations
|
|
23
|
+
EasyBroker::Locations.new(api_client)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def listing_statuses
|
|
27
|
+
EasyBroker::ListingStatuses.new(api_client)
|
|
28
|
+
end
|
|
13
29
|
end
|
data/lib/easy_broker/version.rb
CHANGED
data/lib/easy_broker.rb
CHANGED
|
@@ -9,6 +9,10 @@ require 'easy_broker/public_client'
|
|
|
9
9
|
require 'easy_broker/paginated_response'
|
|
10
10
|
require 'easy_broker/query'
|
|
11
11
|
require 'easy_broker/properties'
|
|
12
|
+
require 'easy_broker/mls_properties'
|
|
13
|
+
require 'easy_broker/contact_requests'
|
|
14
|
+
require 'easy_broker/locations'
|
|
15
|
+
require 'easy_broker/listing_statuses'
|
|
12
16
|
|
|
13
17
|
module EasyBroker
|
|
14
18
|
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
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Northam
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-05-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '2.2'
|
|
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: '2.2'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rake
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -128,7 +128,11 @@ files:
|
|
|
128
128
|
- lib/easy_broker/api_client.rb
|
|
129
129
|
- lib/easy_broker/configuration.rb
|
|
130
130
|
- lib/easy_broker/constants.rb
|
|
131
|
+
- lib/easy_broker/contact_requests.rb
|
|
131
132
|
- lib/easy_broker/errors.rb
|
|
133
|
+
- lib/easy_broker/listing_statuses.rb
|
|
134
|
+
- lib/easy_broker/locations.rb
|
|
135
|
+
- lib/easy_broker/mls_properties.rb
|
|
132
136
|
- lib/easy_broker/paginated_response.rb
|
|
133
137
|
- lib/easy_broker/properties.rb
|
|
134
138
|
- lib/easy_broker/public_client.rb
|
|
@@ -154,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
154
158
|
- !ruby/object:Gem::Version
|
|
155
159
|
version: '0'
|
|
156
160
|
requirements: []
|
|
157
|
-
rubygems_version: 3.
|
|
161
|
+
rubygems_version: 3.1.6
|
|
158
162
|
signing_key:
|
|
159
163
|
specification_version: 4
|
|
160
164
|
summary: A gem to work with EasyBroker's API
|