easy_broker 0.1.1 → 0.1.2

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: e776eb6519e1c3bfcb77a951c47b78d89d425665c9400149ed75b792e6fa7cef
4
- data.tar.gz: 7297f553a3f882198d86cc1857750795fefb76a2afdddb3a8fefd15f2a704d74
3
+ metadata.gz: 7e2c6d6b5f13359963960225c97ceb6088fd2121d2682afa7980239904ffb6c7
4
+ data.tar.gz: 03dd4f8edc6125ee282f2ff8908e12b5a2e90495dab89790a088003580795258
5
5
  SHA512:
6
- metadata.gz: 19205db9c8dde2f1e2024ddc2c1be72e2bdee469dd6a5ff7403fd7f65ac21d3714e4599fb40ac2c5e4f52e4394d768f285ead5bf1260bd8f6f22a190515d90e9
7
- data.tar.gz: 3264d842b5195beca8060faab72b2bdb53991680a0230877ab9ce01eaf333c229590a5e62c359f9019e7b259b4ff8accdfce6d21c5cfe2e533a0344ddd80411d
6
+ metadata.gz: e879f87bf528593c737ce3de70217613b46940330b07171837195ce45bcf4df8d14bdbc50e252d9be6fed98a0805e434e310a68ab44dacd02d959aff0be7a7f8
7
+ data.tar.gz: b9d77c6f693b8acf5cf76449764d16f5cf016f9ac6cd554bd221b9251cd601fb5bb4d90e99fd39ee488ebdbacebf4506f13843c5f8e9a467d10f86a1a33fe47b
data/CHANGELOG.md CHANGED
@@ -2,3 +2,6 @@
2
2
 
3
3
  ## 0.1.1
4
4
  * Initial release
5
+
6
+ ## 0.1.2
7
+ * Added support for contact_requests, mls_properties and locations endpoints
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/api/playground).
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 = 'https://www.myebproxy.com/api/v1/'
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,17 @@ 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.api_client(logger: my_logger)
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
61
81
  ```
62
82
 
63
83
  ## 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", "~> 1.17"
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"
@@ -6,5 +6,6 @@ module EasyBroker
6
6
  'User-Agent' => USER_AGENT
7
7
  }
8
8
  DEFAULT_API_ROOT_URL = 'https://www.easybroker.com/api/v1'
9
+ STAGING_API_ROOT_URL = 'https://www.stagingeb.com/api/v1'
9
10
  AUTHORIZATION_HEADER = 'X-Authorization'
10
11
  end
@@ -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::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
@@ -10,4 +10,16 @@ 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
13
25
  end
@@ -1,3 +1,3 @@
1
1
  module EasyBroker
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/easy_broker.rb CHANGED
@@ -9,6 +9,9 @@ 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'
12
15
 
13
16
  module EasyBroker
14
17
  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.1
4
+ version: 0.1.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: 2021-01-18 00:00:00.000000000 Z
11
+ date: 2022-01-16 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: '1.17'
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: '1.17'
40
+ version: '2.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +128,10 @@ 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/locations.rb
134
+ - lib/easy_broker/mls_properties.rb
132
135
  - lib/easy_broker/paginated_response.rb
133
136
  - lib/easy_broker/properties.rb
134
137
  - lib/easy_broker/public_client.rb
@@ -154,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
157
  - !ruby/object:Gem::Version
155
158
  version: '0'
156
159
  requirements: []
157
- rubygems_version: 3.0.3
160
+ rubygems_version: 3.1.6
158
161
  signing_key:
159
162
  specification_version: 4
160
163
  summary: A gem to work with EasyBroker's API