dotloop 0.1.3 → 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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.rubocop.yml +1 -0
- data/README.md +4 -1
- data/lib/dotloop.rb +14 -7
- data/lib/dotloop/document.rb +6 -1
- data/lib/dotloop/loop.rb +1 -8
- data/lib/dotloop/models/section.rb +10 -4
- data/lib/dotloop/models/sections/contact.rb +42 -0
- data/lib/dotloop/models/sections/contract_dates.rb +11 -0
- data/lib/dotloop/models/sections/contract_info.rb +11 -0
- data/lib/dotloop/models/sections/financials.rb +19 -0
- data/lib/dotloop/models/sections/geographic_description.rb +19 -0
- data/lib/dotloop/models/sections/listing_information.rb +23 -0
- data/lib/dotloop/models/sections/offer_dates.rb +13 -0
- data/lib/dotloop/models/sections/property.rb +16 -0
- data/lib/dotloop/models/sections/property_address.rb +20 -0
- data/lib/dotloop/models/sections/referral.rb +11 -0
- data/lib/dotloop/section.rb +60 -0
- data/lib/dotloop/version.rb +1 -1
- metadata +13 -6
- metadata.gz.sig +0 -0
- data/lib/dotloop/models/buying_brokerage.rb +0 -15
- data/lib/dotloop/models/financials.rb +0 -13
- data/lib/dotloop/models/listing_brokerage.rb +0 -15
- data/lib/dotloop/models/property_address.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b1e7e084caa1e8f18b46dbc62a1015b48b5d8ca
|
4
|
+
data.tar.gz: 3d4ace3f1e2a64ce791ba677e43ee374161e362b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58389e753693271ff12968baf219771f0d702ba2b15fee7bc4745f03b8aed601a19399866ebb3b0ddbb5cbce44021af0eaa77c21e3cafc52fc38b9f375d9e876
|
7
|
+
data.tar.gz: f2652b4fcddeb990c0bef88a3b643bd8a9f01c9a73101196a7e9e2a735cd7ff12e3622490251a0e9828b46c0cfbde148f7084c43ce2d623bbe01ef95edfe0603
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
This library is designed to help ruby applications consume the DotLoop API.
|
6
6
|
|
7
|
-
You can read more about the api
|
7
|
+
You can read more about the api from the official documentation at [https://support.dotloop.com](https://support.dotloop.com/hc/en-us/articles/204407013-Dotloop-REST-API-Developer-s-Guide)
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -25,6 +25,8 @@ Or install it yourself as:
|
|
25
25
|
## Usage
|
26
26
|
|
27
27
|
Optional parameters are prefixed with a __'*'__'
|
28
|
+
|
29
|
+
```ruby
|
28
30
|
client = Dotloop::Client.new(api_key: 'c4c26918-b2df-49a6-9bc2-9009274b23a7')
|
29
31
|
|
30
32
|
client.Profile.all #=> get list of profiles
|
@@ -92,6 +94,7 @@ Optional parameters are prefixed with a __'*'__'
|
|
92
94
|
document_id: '561622',
|
93
95
|
document_name: 'My Offer'
|
94
96
|
) #=> get a PDF document
|
97
|
+
```
|
95
98
|
|
96
99
|
## Development
|
97
100
|
|
data/lib/dotloop.rb
CHANGED
@@ -6,6 +6,7 @@ require 'dotloop/version'
|
|
6
6
|
require 'dotloop/client'
|
7
7
|
require 'dotloop/query_param_helpers'
|
8
8
|
require 'dotloop/profile'
|
9
|
+
require 'dotloop/section'
|
9
10
|
require 'dotloop/loop'
|
10
11
|
require 'dotloop/admin'
|
11
12
|
require 'dotloop/document'
|
@@ -17,13 +18,6 @@ require 'dotloop/participant'
|
|
17
18
|
require 'dotloop/person'
|
18
19
|
require 'dotloop/task'
|
19
20
|
|
20
|
-
require 'dotloop/models/property_address'
|
21
|
-
require 'dotloop/models/buying_brokerage'
|
22
|
-
require 'dotloop/models/listing_brokerage'
|
23
|
-
require 'dotloop/models/financials'
|
24
|
-
require 'dotloop/models/section'
|
25
|
-
require 'dotloop/models/loop_detail'
|
26
|
-
|
27
21
|
require 'dotloop/models/admin'
|
28
22
|
require 'dotloop/models/document'
|
29
23
|
require 'dotloop/models/document_activity'
|
@@ -37,6 +31,19 @@ require 'dotloop/models/profile'
|
|
37
31
|
require 'dotloop/models/tag'
|
38
32
|
require 'dotloop/models/task'
|
39
33
|
|
34
|
+
require 'dotloop/models/sections/contact'
|
35
|
+
require 'dotloop/models/sections/contract_dates'
|
36
|
+
require 'dotloop/models/sections/contract_info'
|
37
|
+
require 'dotloop/models/sections/financials'
|
38
|
+
require 'dotloop/models/sections/geographic_description'
|
39
|
+
require 'dotloop/models/sections/listing_information'
|
40
|
+
require 'dotloop/models/sections/offer_dates'
|
41
|
+
require 'dotloop/models/sections/property_address'
|
42
|
+
require 'dotloop/models/sections/property'
|
43
|
+
require 'dotloop/models/sections/referral'
|
44
|
+
require 'dotloop/models/section'
|
45
|
+
require 'dotloop/models/loop_detail'
|
46
|
+
|
40
47
|
module Dotloop
|
41
48
|
# Your code goes here...
|
42
49
|
end
|
data/lib/dotloop/document.rb
CHANGED
@@ -16,11 +16,16 @@ module Dotloop
|
|
16
16
|
|
17
17
|
def get(profile_id:, loop_view_id:, document_id:, document_name:)
|
18
18
|
document_name = CGI.escape(document_name.delete('/'))
|
19
|
-
StringIO.new
|
19
|
+
sio = StringIO.new
|
20
|
+
sio.set_encoding(Encoding::ASCII_8BIT)
|
21
|
+
sio.write(
|
20
22
|
@client.raw(
|
21
23
|
"/profile/#{profile_id.to_i}/loop/#{loop_view_id.to_i}/document/#{document_id}/#{document_name}.pdf"
|
22
24
|
)
|
23
25
|
)
|
26
|
+
sio.flush
|
27
|
+
sio.close
|
28
|
+
sio
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
data/lib/dotloop/loop.rb
CHANGED
@@ -32,19 +32,12 @@ module Dotloop
|
|
32
32
|
|
33
33
|
def detail(profile_id:, loop_view_id:)
|
34
34
|
loop_detail = @client.get("/profile/#{profile_id.to_i}/loop/#{loop_view_id.to_i}/detail")
|
35
|
-
loop_detail[:sections] =
|
35
|
+
loop_detail[:sections] = Dotloop::Section.new(loop_detail[:sections]).sections if loop_detail[:sections]
|
36
36
|
Dotloop::Models::LoopDetail.new(loop_detail)
|
37
37
|
end
|
38
38
|
|
39
39
|
private
|
40
40
|
|
41
|
-
def fixed_sections(sections)
|
42
|
-
return unless sections
|
43
|
-
sections.each_with_object({}) do |item, memo|
|
44
|
-
memo[item[0].to_s.downcase.tr(' ', '_')] = item[1]
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
41
|
def query_params(options)
|
49
42
|
{
|
50
43
|
batchNumber: batch_number(options),
|
@@ -2,10 +2,16 @@ module Dotloop
|
|
2
2
|
module Models
|
3
3
|
class Section
|
4
4
|
include Virtus.model
|
5
|
-
attribute :
|
6
|
-
attribute :
|
7
|
-
attribute :
|
8
|
-
attribute :
|
5
|
+
attribute :contract_dates, Dotloop::Models::Sections::ContractDates
|
6
|
+
attribute :contract_info, Dotloop::Models::Sections::ContractInfo
|
7
|
+
attribute :financials, Dotloop::Models::Sections::Financials
|
8
|
+
attribute :geographic_description, Dotloop::Models::Sections::GeographicDescription
|
9
|
+
attribute :listing_information, Dotloop::Models::Sections::ListingInformation
|
10
|
+
attribute :offer_dates, Dotloop::Models::Sections::OfferDates
|
11
|
+
attribute :property_address, Dotloop::Models::Sections::PropertyAddress
|
12
|
+
attribute :property, Dotloop::Models::Sections::Property
|
13
|
+
attribute :referral, Dotloop::Models::Sections::Referral
|
14
|
+
attribute :contacts, Array[Dotloop::Models::Sections::Contact]
|
9
15
|
end
|
10
16
|
end
|
11
17
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Dotloop
|
2
|
+
module Models
|
3
|
+
module Sections
|
4
|
+
class Contact
|
5
|
+
include Virtus.model
|
6
|
+
attribute :role
|
7
|
+
attribute :cell_phone
|
8
|
+
attribute :city
|
9
|
+
attribute :company_name
|
10
|
+
attribute :country
|
11
|
+
attribute :email
|
12
|
+
attribute :fax
|
13
|
+
attribute :id
|
14
|
+
attribute :license
|
15
|
+
attribute :marital_status
|
16
|
+
attribute :name
|
17
|
+
attribute :phone
|
18
|
+
attribute :state_prov
|
19
|
+
attribute :street_name
|
20
|
+
attribute :street_number
|
21
|
+
attribute :unit_number
|
22
|
+
attribute :zip_or_postal_code
|
23
|
+
|
24
|
+
alias_method :home_warranty_company, :company_name
|
25
|
+
alias_method :home_warranty_email, :email
|
26
|
+
alias_method :home_warranty_rep, :name
|
27
|
+
alias_method :inspection_company, :company_name
|
28
|
+
alias_method :inspection_company_rep, :name
|
29
|
+
alias_method :mortgage_company, :company_name
|
30
|
+
alias_method :mortgage_company_email, :email
|
31
|
+
alias_method :mortgage_company_rep, :name
|
32
|
+
alias_method :office_phone, :phone
|
33
|
+
alias_method :postal_code, :zip_or_postal_code
|
34
|
+
alias_method :state_or_province, :state_prov
|
35
|
+
alias_method :suite, :unit_number
|
36
|
+
alias_method :title_company_email, :email
|
37
|
+
alias_method :title_company_rep, :name
|
38
|
+
alias_method :zip_postal_code, :zip_or_postal_code
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Dotloop
|
2
|
+
module Models
|
3
|
+
module Sections
|
4
|
+
class Financials
|
5
|
+
include Virtus.model
|
6
|
+
|
7
|
+
attribute :comission_rate
|
8
|
+
attribute :earnest_money_held_by
|
9
|
+
attribute :purchase_price
|
10
|
+
attribute :earnest_money_amount
|
11
|
+
attribute :sale_commission_total
|
12
|
+
attribute :buy_side_sale_commission_split
|
13
|
+
attribute :sale_commission_split_sell_side
|
14
|
+
attribute :sell_side_sale_commission_split
|
15
|
+
attribute :sale_commission_split_buy_side
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Dotloop
|
2
|
+
module Models
|
3
|
+
module Sections
|
4
|
+
class GeographicDescription
|
5
|
+
include Virtus.model
|
6
|
+
attribute :addition
|
7
|
+
attribute :block
|
8
|
+
attribute :deed_book
|
9
|
+
attribute :deed_page
|
10
|
+
attribute :lot
|
11
|
+
attribute :map_grid
|
12
|
+
attribute :mls_area
|
13
|
+
attribute :mls_legal_description
|
14
|
+
attribute :section
|
15
|
+
attribute :subdivision
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Dotloop
|
2
|
+
module Models
|
3
|
+
module Sections
|
4
|
+
class ListingInformation
|
5
|
+
include Virtus.model
|
6
|
+
attribute :property_excludes
|
7
|
+
attribute :description_of_other_liens
|
8
|
+
attribute :expiration_date
|
9
|
+
attribute :listing_date
|
10
|
+
attribute :total_encumbrances
|
11
|
+
attribute :property_includes
|
12
|
+
attribute :remarks
|
13
|
+
attribute :current_price
|
14
|
+
attribute :first_mortgage_balance
|
15
|
+
attribute :homeowner_association
|
16
|
+
attribute :second_mortgage_balance
|
17
|
+
attribute :original_listing_price
|
18
|
+
attribute :other_liens
|
19
|
+
attribute :homeowner_association_dues
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Dotloop
|
2
|
+
module Models
|
3
|
+
module Sections
|
4
|
+
class Property
|
5
|
+
include Virtus.model
|
6
|
+
attribute :bedrooms
|
7
|
+
attribute :year_built
|
8
|
+
attribute :square_footage
|
9
|
+
attribute :type
|
10
|
+
attribute :bathrooms
|
11
|
+
attribute :school_district
|
12
|
+
attribute :lot_size
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Dotloop
|
2
|
+
module Models
|
3
|
+
module Sections
|
4
|
+
class PropertyAddress
|
5
|
+
include Virtus.model
|
6
|
+
|
7
|
+
attribute :city
|
8
|
+
attribute :county
|
9
|
+
attribute :unit_number
|
10
|
+
attribute :parcel_tax_id
|
11
|
+
attribute :mls_number
|
12
|
+
attribute :postal_code
|
13
|
+
attribute :property_address_country
|
14
|
+
attribute :state_or_province
|
15
|
+
attribute :street_name
|
16
|
+
attribute :street_number
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Dotloop
|
2
|
+
class Section
|
3
|
+
attr_accessor :sections
|
4
|
+
FIXED_SECTIONS = %i(
|
5
|
+
contract_dates contract_info financials geographic_description listing_information
|
6
|
+
offer_dates property_address property referral
|
7
|
+
).freeze
|
8
|
+
|
9
|
+
def initialize(data)
|
10
|
+
@sections = FIXED_SECTIONS.each_with_object({}) { |key, memo| memo[key] = {} }.merge(contacts: [])
|
11
|
+
parse_data(data)
|
12
|
+
end
|
13
|
+
|
14
|
+
def parse_data(data)
|
15
|
+
fix_hash_keys(data).each { |item| build_section(item[0], item[1]) }
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def build_section(key, section_data)
|
21
|
+
values = fix_hash_keys(section_data)
|
22
|
+
if FIXED_SECTIONS.include?(key)
|
23
|
+
@sections[key] = values
|
24
|
+
else
|
25
|
+
@sections[:contacts] << build_contact(key, map_contact_keys(values))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def build_contact(key, values)
|
30
|
+
Dotloop::Models::Sections::Contact.new(values.merge(role: key.to_s))
|
31
|
+
end
|
32
|
+
|
33
|
+
def index_to_key(index)
|
34
|
+
index.to_s.downcase.delete(%(')).gsub(/[^a-z]/, '_').squeeze('_').gsub(/^_*/, '').gsub(/_*$/, '').to_sym
|
35
|
+
end
|
36
|
+
|
37
|
+
def fix_hash_keys(bad_hash)
|
38
|
+
bad_hash.each_with_object({}) do |item, memo|
|
39
|
+
memo[index_to_key(item[0])] = item[1]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def map_contact_keys(contact_data)
|
44
|
+
contact_data.each_with_object({}) do |item, memo|
|
45
|
+
key = contact_key_map[item[0].to_sym] || item[0]
|
46
|
+
memo[key] = item[1]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def contact_key_map
|
51
|
+
{
|
52
|
+
home_warranty_company: :company_name, home_warranty_email: :email, home_warranty_rep: :name,
|
53
|
+
inspection_company: :company_name, inspection_company_rep: :name, mortgage_company: :company_name,
|
54
|
+
mortgage_company_email: :email, mortgage_company_rep: :name, office_phone: :phone,
|
55
|
+
postal_code: :zip_or_postal_code, state_or_province: :state_prov, suite: :unit_number,
|
56
|
+
title_company_email: :email, title_company_rep: :name, zip_postal_code: :zip_or_postal_code
|
57
|
+
}
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/dotloop/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dotloop
|
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
|
- Loft47
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
L+ceZspJWVt3gj8EHk5CVnWGEh6Pk69eo8EuR38vWHXOExU+b14Umj8wjYGjDgmQ
|
31
31
|
ULEgdaQHqkQV4C3edSFOUWTGehI=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2016-08
|
33
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: simplecov
|
@@ -243,27 +243,34 @@ files:
|
|
243
243
|
- lib/dotloop/loop.rb
|
244
244
|
- lib/dotloop/loop_activity.rb
|
245
245
|
- lib/dotloop/models/admin.rb
|
246
|
-
- lib/dotloop/models/buying_brokerage.rb
|
247
246
|
- lib/dotloop/models/document.rb
|
248
247
|
- lib/dotloop/models/document_activity.rb
|
249
248
|
- lib/dotloop/models/employee.rb
|
250
|
-
- lib/dotloop/models/financials.rb
|
251
249
|
- lib/dotloop/models/folder.rb
|
252
|
-
- lib/dotloop/models/listing_brokerage.rb
|
253
250
|
- lib/dotloop/models/loop.rb
|
254
251
|
- lib/dotloop/models/loop_activity.rb
|
255
252
|
- lib/dotloop/models/loop_detail.rb
|
256
253
|
- lib/dotloop/models/participant.rb
|
257
254
|
- lib/dotloop/models/person.rb
|
258
255
|
- lib/dotloop/models/profile.rb
|
259
|
-
- lib/dotloop/models/property_address.rb
|
260
256
|
- lib/dotloop/models/section.rb
|
257
|
+
- lib/dotloop/models/sections/contact.rb
|
258
|
+
- lib/dotloop/models/sections/contract_dates.rb
|
259
|
+
- lib/dotloop/models/sections/contract_info.rb
|
260
|
+
- lib/dotloop/models/sections/financials.rb
|
261
|
+
- lib/dotloop/models/sections/geographic_description.rb
|
262
|
+
- lib/dotloop/models/sections/listing_information.rb
|
263
|
+
- lib/dotloop/models/sections/offer_dates.rb
|
264
|
+
- lib/dotloop/models/sections/property.rb
|
265
|
+
- lib/dotloop/models/sections/property_address.rb
|
266
|
+
- lib/dotloop/models/sections/referral.rb
|
261
267
|
- lib/dotloop/models/tag.rb
|
262
268
|
- lib/dotloop/models/task.rb
|
263
269
|
- lib/dotloop/participant.rb
|
264
270
|
- lib/dotloop/person.rb
|
265
271
|
- lib/dotloop/profile.rb
|
266
272
|
- lib/dotloop/query_param_helpers.rb
|
273
|
+
- lib/dotloop/section.rb
|
267
274
|
- lib/dotloop/task.rb
|
268
275
|
- lib/dotloop/version.rb
|
269
276
|
homepage: http://github.com/Loft47/dotloop
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Dotloop
|
2
|
-
module Models
|
3
|
-
class BuyingBrokerage
|
4
|
-
include Virtus.model
|
5
|
-
|
6
|
-
attribute :city
|
7
|
-
attribute :name
|
8
|
-
attribute :postal_code
|
9
|
-
attribute :state_or_province
|
10
|
-
attribute :street_name
|
11
|
-
attribute :street_number
|
12
|
-
attribute :suite
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Dotloop
|
2
|
-
module Models
|
3
|
-
class ListingBrokerage
|
4
|
-
include Virtus.model
|
5
|
-
|
6
|
-
attribute :city
|
7
|
-
attribute :name
|
8
|
-
attribute :office_phone
|
9
|
-
attribute :postal_code
|
10
|
-
attribute :state_or_province
|
11
|
-
attribute :street_name
|
12
|
-
attribute :street_number
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Dotloop
|
2
|
-
module Models
|
3
|
-
class PropertyAddress
|
4
|
-
include Virtus.model
|
5
|
-
|
6
|
-
attribute :city
|
7
|
-
attribute :country
|
8
|
-
attribute :mls_number
|
9
|
-
attribute :postal_code
|
10
|
-
attribute :property_address_country
|
11
|
-
attribute :state_or_province
|
12
|
-
attribute :street_name
|
13
|
-
attribute :street_number
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|