dotloop-ruby 0.1.0

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.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +2 -0
  4. data/CODE_OF_CONDUCT.md +74 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +386 -0
  8. data/Rakefile +6 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/dotloop-ruby.gemspec +46 -0
  12. data/lib/.DS_Store +0 -0
  13. data/lib/dotloop-ruby.rb +45 -0
  14. data/lib/dotloop/.DS_Store +0 -0
  15. data/lib/dotloop/authenticate.rb +92 -0
  16. data/lib/dotloop/client.rb +160 -0
  17. data/lib/dotloop/contact.rb +70 -0
  18. data/lib/dotloop/document.rb +72 -0
  19. data/lib/dotloop/exceptions.rb +10 -0
  20. data/lib/dotloop/folder.rb +60 -0
  21. data/lib/dotloop/loop.rb +157 -0
  22. data/lib/dotloop/loop_detail.rb +38 -0
  23. data/lib/dotloop/models/.DS_Store +0 -0
  24. data/lib/dotloop/models/contact.rb +22 -0
  25. data/lib/dotloop/models/document.rb +27 -0
  26. data/lib/dotloop/models/folder.rb +19 -0
  27. data/lib/dotloop/models/loop.rb +45 -0
  28. data/lib/dotloop/models/loop_detail.rb +22 -0
  29. data/lib/dotloop/models/loop_details/contact.rb +28 -0
  30. data/lib/dotloop/models/loop_details/contract_dates.rb +13 -0
  31. data/lib/dotloop/models/loop_details/contract_info.rb +13 -0
  32. data/lib/dotloop/models/loop_details/financials.rb +20 -0
  33. data/lib/dotloop/models/loop_details/geographic_description.rb +22 -0
  34. data/lib/dotloop/models/loop_details/listing_information.rb +25 -0
  35. data/lib/dotloop/models/loop_details/offer_dates.rb +15 -0
  36. data/lib/dotloop/models/loop_details/property.rb +18 -0
  37. data/lib/dotloop/models/loop_details/property_address.rb +21 -0
  38. data/lib/dotloop/models/loop_details/referral.rb +13 -0
  39. data/lib/dotloop/models/participant.rb +17 -0
  40. data/lib/dotloop/models/profile.rb +36 -0
  41. data/lib/dotloop/models/task.rb +18 -0
  42. data/lib/dotloop/models/tasklist.rb +31 -0
  43. data/lib/dotloop/models/template.rb +18 -0
  44. data/lib/dotloop/participant.rb +66 -0
  45. data/lib/dotloop/profile.rb +26 -0
  46. data/lib/dotloop/query_param_helpers.rb +36 -0
  47. data/lib/dotloop/task.rb +32 -0
  48. data/lib/dotloop/tasklist.rb +30 -0
  49. data/lib/dotloop/template.rb +28 -0
  50. data/lib/dotloop/version.rb +3 -0
  51. metadata +276 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0ea45a664b65e4d47429fa29d74e526ac3ca6ebb
4
+ data.tar.gz: 6935a5327aa3fee3daf1cee706dfc58d8bd895b4
5
+ SHA512:
6
+ metadata.gz: 5a8766fd9534e93261be7606469592fcb8ad7f5c1fc6508dd570e7f21eb788cd86f0a6193b15516fb50a741fae05e1827cba64af6dcd08323af543d5818027db
7
+ data.tar.gz: f9d0ed7347e1b063e4a3be49bf929bd3345b3af5b7e3379262667b69cc3a8dad55e14cf567fd55b0e1468035f9bef433522b1abb940b16ae145ec5e82acfb484
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at sampat.badhe@kiprosh.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dotloop.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 sampatbadhe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,386 @@
1
+ # Ruby library for Dotloop API v2
2
+
3
+ * [Homepage](https://www.dotloop.com)
4
+ * [API Documentation](https://dotloop.github.io/public-api)
5
+ * [Sign Up](https://www.dotloop.com/#/signup)
6
+
7
+
8
+ ## Description
9
+
10
+ Provides a Ruby interface to [Dotloop](https://www.dotloop.com/). This library is designed to help ruby applications consume the DotLoop API v2.
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'dotloop-ruby'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install dotloop-ruby
27
+
28
+ ## Usage
29
+
30
+
31
+ ### Setup
32
+
33
+ Register for your OAuth2 credentials by creating a client at https://www.dotloop.com/my/account/#/clients.
34
+
35
+ NOTE: You'll need at least `Account Access: Read` to use this strategy.
36
+
37
+ ### Authentication
38
+
39
+ Dotloop uses OAuth2 for authentication (https://dotloop.github.io/public-api/#authentication).
40
+
41
+ ```ruby
42
+ require 'dotloop-ruby'
43
+
44
+ dotloop_auth = Dotloop::Authenticate.new(
45
+ app_id: ENV['DOTLOOP_APP_ID'],
46
+ app_secret: ENV['DOTLOOP_APP_SECRET'],
47
+ application: 'dotloop'
48
+ )
49
+
50
+ dotloop_auth.url_for_authentication(callback_url, { redirect_on_deny: true })
51
+
52
+ # callback_url = The url that Dotloop will redirect the user to when the account is authenticated.
53
+
54
+ # It will return code on successfully authenticated.
55
+
56
+ code = params[:code]
57
+
58
+ access_and_refresh_token = dotloop_auth.acquire_access_and_refresh_token(code, { redirect_uri: callback_url })
59
+
60
+ {
61
+ "access_token": "0b043f2f-2abe-4c9d-844a-3eb008dcba67",
62
+ "token_type": "Bearer",
63
+ "refresh_token": "19bfda68-ca62-480c-9c62-2ba408458fc7",
64
+ "expires_in": 43145,
65
+ "scope": "profile:*, loop:*"
66
+ }
67
+ ```
68
+
69
+ ### Usage
70
+
71
+ **Initialize**
72
+ ```ruby
73
+ require 'dotloop-ruby'
74
+
75
+ dotloop_client = Dotloop::Client.new(access_token: access_token)
76
+ ```
77
+
78
+ **Account Details**
79
+ ```ruby
80
+ #=> get account details
81
+ account = dotloop_client.account
82
+ ```
83
+
84
+ **Profiles**
85
+ ```ruby
86
+ #=> get list of profiles
87
+ profiles = dotloop_client.Profile.all
88
+
89
+ #=> get single profile
90
+ profile = dotloop_client.Profile.find(profile_id: '1234')
91
+
92
+ #=> get list of loops for profile
93
+ loops = dotloop_client.Profile.find(profile_id: '1234').loops
94
+
95
+ #=> create new loop in profile
96
+ loops = dotloop_client.Profile.find(profile_id: '1234').create(data)
97
+ data = {
98
+ "name": "Atturo Garay, 3059 Main, Chicago, IL 60614",
99
+ "status": "PRE_LISTING",
100
+ "transactionType": "LISTING_FOR_SALE"
101
+ }
102
+
103
+ #=> create new loop in profile using `loop-it`
104
+ loops = dotloop_client.Profile.find(profile_id: '1234').loop_it(data)
105
+ data = {
106
+ "name": "Brian Erwin",
107
+ "transactionType": "PURCHASE_OFFER",
108
+ "status": "PRE_OFFER",
109
+ "streetName": "Waterview Dr",
110
+ "streetNumber": "2100",
111
+ "unit": "12",
112
+ "city": "San Francisco",
113
+ "zipCode": "94114",
114
+ "state": "CA",
115
+ "country": "US",
116
+ "participants": [
117
+ {
118
+ "fullName": "Brian Erwin",
119
+ "email": "brianerwin@newkyhome.com",
120
+ "role": "BUYER"
121
+ },
122
+ {
123
+ "fullName": "Allen Agent",
124
+ "email": "allen.agent@gmail.com",
125
+ "role": "LISTING_AGENT"
126
+ },
127
+ {
128
+ "fullName": "Sean Seller",
129
+ "email": "sean.seller@yahoo.com",
130
+ "role": "SELLER"
131
+ }
132
+ ],
133
+ "templateId": 1424,
134
+ "mlsPropertyId": "43FSB8",
135
+ "mlsId": "789",
136
+ "mlsAgentId": "123456789"
137
+ }
138
+ ```
139
+
140
+ **Profile Loops**
141
+ ```ruby
142
+ #=> get list of loops for profile
143
+ loops = dotloop_client.Loop.all(options)
144
+ options = {
145
+ profile_id: '1234',
146
+ *batch_number: 1,
147
+ *batch_size: 50
148
+ }
149
+
150
+ #=> get single loop
151
+ loop = dotloop_client.Loop.find(profile_id: 1234, loop_id: 34308)
152
+
153
+ #=> create new loop
154
+ loop = dotloop_client.Loop.create(profile_id: 1234, params: params)
155
+ params = {
156
+ "name": "Atturo Garay, 3059 Main, Chicago, IL 60614",
157
+ "status": "PRE_LISTING",
158
+ "transactionType": "LISTING_FOR_SALE"
159
+ }
160
+
161
+ #=> update loop
162
+ loop = dotloop_client.Loop.update(profile_id: 1234, loop_id: 34308, params: data)
163
+ OR
164
+ loop = dotloop_client.Loop.find(profile_id: 1234, loop_id: 34308).update(data: data)
165
+ data = {
166
+ "status": "SOLD"
167
+ }
168
+ ```
169
+
170
+ **Loop Details**
171
+ ```ruby
172
+ #=> get single loop details
173
+ loop_details = dotloop_client.Loop.detail(profile_id: 1234, loop_id: 34308)
174
+ OR
175
+ loop_details = dotloop_client.Loop.find(profile_id: 1234, loop_id: 34308).detail
176
+
177
+ #=> update single loop details
178
+ loop_details = dotloop_client.Loop.update_details(profile_id: 1234, loop_id: 34308, data: data)
179
+ OR
180
+ loop_details = dotloop_client.Loop.find(profile_id: 1234, loop_id: 34308).update_details(params: data)
181
+ data = {
182
+ # https://dotloop.github.io/public-api/#parameters-12
183
+ }
184
+ ```
185
+
186
+ **Loop Folders**
187
+ ```ruby
188
+ #=> get list of folders for loop
189
+ folders = dotloop_client.Folder.all(options)
190
+ options = {
191
+ profile_id: '1234',
192
+ loop_id: '34308'
193
+ }
194
+
195
+ #=> get single folder
196
+ folder = dotloop_client.Folder.find(profile_id: 1234, loop_id: 34308, folder_id: 423424)
197
+
198
+ #=> create new folder
199
+ folder = dotloop_client.Folder.create(profile_id: 1234 loop_id: 34308, params: params)
200
+ params = {
201
+ "name": "Disclosures"
202
+ }
203
+
204
+ #=> update folder
205
+ folder = dotloop_client.Folder.update(profile_id: 1234, loop_id: 34308, folder_id: 423424, params: data)
206
+ data = {
207
+ "name": "Disclosures (renamed)"
208
+ }
209
+ ```
210
+
211
+ **Loop Documents**
212
+ ```ruby
213
+ #=> get list of documents for folder
214
+ documents = dotloop_client.Document.all(options)
215
+ options = {
216
+ profile_id: '1234',
217
+ loop_id: '34308',
218
+ folder_id: '423424'
219
+ }
220
+
221
+ #=> get single document
222
+ document = dotloop_client.Document.find(
223
+ profile_id: '1234',
224
+ loop_id: '34308',
225
+ folder_id: '423424',
226
+ document_id: '561621'
227
+ )
228
+
229
+ #=> upload new document
230
+ document = dotloop_api.Document.upload(
231
+ profile_id: '1234',
232
+ loop_id: '34308',
233
+ folder_id: '423424',
234
+ params: { "file_url" => file_url, "file_name" => file_name }
235
+ )
236
+
237
+ #=> dowload a document - Retrieve an individual document (binary)
238
+ document = dotloop_api.Document.get(
239
+ profile_id: '1234',
240
+ loop_id: '34308',
241
+ folder_id: '423424',
242
+ document_id: '561621'
243
+ )
244
+ ```
245
+
246
+ **Loop Participants**
247
+ ```ruby
248
+ #=> get list of participants for loop
249
+ participants = dotloop_client.Participant.all(options)
250
+ options = {
251
+ profile_id: '1234',
252
+ loop_id: '34308'
253
+ }
254
+
255
+ #=> get single participant
256
+ participant = dotloop_client.Participant.find(
257
+ profile_id: '1234',
258
+ loop_id: '34308',
259
+ participant_id: '24743'
260
+ )
261
+
262
+ #=> create participant for loop
263
+ participant = dotloop_client.Participant.create(
264
+ profile_id: '1234',
265
+ loop_id: '34308',
266
+ params: params
267
+ )
268
+ params = {
269
+ "fullName": "Brian Erwin",
270
+ "email": "brian@gmail.com",
271
+ "role": "BUYER"
272
+ }
273
+
274
+ #=> update participant
275
+ participant = dotloop_client.Participant.update(
276
+ profile_id: '1234',
277
+ loop_id: '34308',
278
+ participant_id: '24743',
279
+ params: params
280
+ )
281
+ params = {
282
+ "email": "brian@gmail.com"
283
+ }
284
+
285
+ #=> delete participant
286
+ participant = dotloop_client.Participant.delete(
287
+ profile_id: '1234',
288
+ loop_id: '34308',
289
+ participant_id: '24743'
290
+ )
291
+ ```
292
+
293
+ **Loop Templates**
294
+ ```ruby
295
+ #=> get list of loop templates for profile
296
+ loop_templates = dotloop_client.Loop.all(profile_id: '1234')
297
+
298
+ #=> get single loop template
299
+ loop = dotloop_client.Loop.find(profile_id: '1234', loop_template_id: '423')
300
+ ```
301
+
302
+ **Loop Tasks**
303
+ ```ruby
304
+ #=> get list of tasklists for loop
305
+ tasklists = dotloop_client.Tasklist.all(profile_id: '1234', loop_id: '34308')
306
+
307
+ #=> get single tasklist
308
+ tasklist = dotloop_client.Tasklist.find(
309
+ profile_id: '1234',
310
+ loop_id: '34308',
311
+ task_list_id: '12345'
312
+ )
313
+
314
+ #=> get list of task for loop
315
+ tasklists = dotloop_client.Task.all(
316
+ profile_id: '1234',
317
+ loop_id: '34308',
318
+ task_list_id: '12345'
319
+ )
320
+
321
+ #=> get single task
322
+ tasklist = dotloop_client.Task.find(
323
+ profile_id: '1234',
324
+ loop_id: '34308',
325
+ task_list_id: '12345'
326
+ task_id: '125736485'
327
+ )
328
+
329
+ ```
330
+
331
+ **Contacts**
332
+ ```ruby
333
+ #=> get list of contacts
334
+ contacts = dotloop_client.Contact.all(options)
335
+ options = {
336
+ *batch_number: 1,
337
+ *batch_size: 50
338
+ }
339
+
340
+ #=> get single contact
341
+ contact = dotloop_client.Contact.find(contact_id: '3603862')
342
+
343
+ #=> create new contact
344
+ contact = dotloop_client.Contact.create(params: params)
345
+ params = {
346
+ "firstName": "Brian",
347
+ "lastName": "Erwin",
348
+ "email": "brianerwin@newkyhome.com",
349
+ "home": "(415) 8936 332",
350
+ "office": "(415) 1213 656",
351
+ "fax": "(415) 8655 686",
352
+ "address": "2100 Waterview Dr",
353
+ "city": "San Francisco",
354
+ "zipCode": "94114",
355
+ "state": "CA",
356
+ "country": "US"
357
+ }
358
+
359
+ #=> update contact
360
+ contact = dotloop_client.Contact.update(
361
+ contact_id: '3603862',
362
+ params: params
363
+ )
364
+ params = {
365
+ "home": "(415) 888 8888"
366
+ }
367
+
368
+ #=> delete contact
369
+ dotloop_client.Contact.delete(contact_id: '3603862')
370
+ ```
371
+
372
+ ## Development
373
+
374
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
375
+
376
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
377
+
378
+ ## Contributing
379
+
380
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sampatbadhe/dotloop-ruby.
381
+
382
+
383
+ ## License
384
+
385
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
386
+