doorloop 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +0 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +87 -0
- data/LICENSE.txt +21 -0
- data/README.md +54 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/doorloop.gemspec +35 -0
- data/lib/doorloop/accounts.rb +39 -0
- data/lib/doorloop/client.rb +205 -0
- data/lib/doorloop/communication_logs.rb +29 -0
- data/lib/doorloop/error_handler.rb +44 -0
- data/lib/doorloop/expenses.rb +29 -0
- data/lib/doorloop/files.rb +65 -0
- data/lib/doorloop/lease_charges.rb +29 -0
- data/lib/doorloop/lease_credits.rb +29 -0
- data/lib/doorloop/lease_payments.rb +29 -0
- data/lib/doorloop/lease_returned_payments.rb +29 -0
- data/lib/doorloop/leases.rb +30 -0
- data/lib/doorloop/notes.rb +29 -0
- data/lib/doorloop/owners.rb +29 -0
- data/lib/doorloop/portfolios.rb +17 -0
- data/lib/doorloop/properties.rb +17 -0
- data/lib/doorloop/reports.rb +41 -0
- data/lib/doorloop/tasks.rb +33 -0
- data/lib/doorloop/tenants.rb +31 -0
- data/lib/doorloop/units.rb +17 -0
- data/lib/doorloop/users.rb +23 -0
- data/lib/doorloop/vendor_bills.rb +29 -0
- data/lib/doorloop/vendor_credits.rb +29 -0
- data/lib/doorloop/vendors.rb +29 -0
- data/lib/doorloop/version.rb +3 -0
- data/lib/doorloop.rb +13 -0
- metadata +141 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class Expenses
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('expenses', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
@client.post('expenses', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve(id)
|
18
|
+
@client.get("expenses/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(id, params)
|
22
|
+
@client.put("expenses/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(id)
|
26
|
+
@client.delete("expenses/#{id}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rest-client'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module DoorLoop
|
7
|
+
class Files
|
8
|
+
MAX_FILE_SIZE = 50 * 1024 * 1024 # 50 MB
|
9
|
+
|
10
|
+
def initialize(client)
|
11
|
+
@client = client
|
12
|
+
@logger = client.logger
|
13
|
+
end
|
14
|
+
|
15
|
+
def list(options = {})
|
16
|
+
@client.get('files', options)
|
17
|
+
end
|
18
|
+
|
19
|
+
def retrieve(id)
|
20
|
+
@client.get("files/#{id}")
|
21
|
+
end
|
22
|
+
|
23
|
+
def update(id, params)
|
24
|
+
@client.put("files/#{id}", params)
|
25
|
+
end
|
26
|
+
|
27
|
+
def delete(id)
|
28
|
+
@client.delete("files/#{id}")
|
29
|
+
end
|
30
|
+
|
31
|
+
def upload(file_path, params)
|
32
|
+
unless params[:name] && params[:resourceType] && params[:resourceId]
|
33
|
+
@logger.error("name, resourceType and resourceId are required parameters")
|
34
|
+
return nil
|
35
|
+
end
|
36
|
+
|
37
|
+
file_size = File.size(file_path)
|
38
|
+
if file_size > MAX_FILE_SIZE
|
39
|
+
@logger.error("File size exceeds the 50MB limit")
|
40
|
+
return nil
|
41
|
+
end
|
42
|
+
|
43
|
+
payload = {
|
44
|
+
multipart: true,
|
45
|
+
file: File.new(file_path, 'rb'),
|
46
|
+
name: params[:name],
|
47
|
+
resourceId: params[:resourceId],
|
48
|
+
resourceType: params[:resourceType],
|
49
|
+
notes: params[:notes],
|
50
|
+
tags: params[:tags],
|
51
|
+
size: params[:size] || file_size,
|
52
|
+
mimeType: params[:mimeType],
|
53
|
+
createdBy: params[:createdBy],
|
54
|
+
createdAt: params[:createdAt]
|
55
|
+
}.compact
|
56
|
+
|
57
|
+
begin
|
58
|
+
response = @client.post('files', payload)
|
59
|
+
rescue RestClient::ExceptionWithResponse => e
|
60
|
+
@logger.error("File upload failed: #{e.response}")
|
61
|
+
@client.error_handler.handle(e)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class LeaseCharges
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('lease-charges', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
@client.post('lease-charges', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve(id)
|
18
|
+
@client.get("lease-charges/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(id, params)
|
22
|
+
@client.put("lease-charges/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(id)
|
26
|
+
@client.delete("lease-charges/#{id}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class LeaseCredits
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('lease-credits', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
@client.post('lease-credits', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve(id)
|
18
|
+
@client.get("lease-credits/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(id, params)
|
22
|
+
@client.put("lease-credits/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(id)
|
26
|
+
@client.delete("lease-credits/#{id}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class LeasePayments
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('lease-payments', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
@client.post('lease-payments', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve(id)
|
18
|
+
@client.get("lease-payments/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(id, params)
|
22
|
+
@client.put("lease-payments/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(id)
|
26
|
+
@client.delete("lease-payments/#{id}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class LeaseReturnedPayments
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('lease-reversed-payments', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
@client.post('lease-reversed-payments', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve(id)
|
18
|
+
@client.get("lease-reversed-payments/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(id, params)
|
22
|
+
@client.put("lease-reversed-payments/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(id)
|
26
|
+
@client.delete("lease-reversed-payments/#{id}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class Leases
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('leases', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def retrieve(id)
|
14
|
+
@client.get("leases/#{id}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def move_in_tenant(params)
|
18
|
+
@client.post('leases/move-in', params)
|
19
|
+
end
|
20
|
+
|
21
|
+
def move_out_tenant(params)
|
22
|
+
@client.post('leases/move-out', params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def tenants
|
26
|
+
@client.get('leases/tenants')
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class Notes
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('notes', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
@client.post('notes', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve(task_id)
|
18
|
+
@client.get("notes/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(id, params)
|
22
|
+
@client.put("notes/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(id)
|
26
|
+
@client.delete("notes/#{id}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class Owners
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('owners', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
@client.post('owners', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve(task_id)
|
18
|
+
@client.get("owners/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(id, params)
|
22
|
+
@client.put("owners/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(id)
|
26
|
+
@client.delete("owners/#{id}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class Portfolios
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('property-groups', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def retrieve(id)
|
14
|
+
@client.get("property-groups/#{id}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class Properties
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('properties', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def retrieve(id)
|
14
|
+
@client.get("properties/#{id}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class Reports
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
@logger = client.logger
|
8
|
+
end
|
9
|
+
|
10
|
+
def rent_roll(options = {})
|
11
|
+
@client.get('reports/rent-roll', options)
|
12
|
+
end
|
13
|
+
|
14
|
+
def profit_loss_summary(options = {})
|
15
|
+
unless options[:filter_accountingMethod]
|
16
|
+
@logger.error("filter_accountingMethod is required (CASH / ACCRUAL)")
|
17
|
+
return nil
|
18
|
+
end
|
19
|
+
|
20
|
+
@client.get('reports/profit-and-loss-summary', options)
|
21
|
+
end
|
22
|
+
|
23
|
+
def cash_flow_statement(options = {})
|
24
|
+
unless options[:filter_accountingMethod]
|
25
|
+
@logger.error("filter_accountingMethod is required (CASH / ACCRUAL)")
|
26
|
+
return nil
|
27
|
+
end
|
28
|
+
|
29
|
+
@client.get('reports/cash-flow-statement', options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def balance_sheet_summary(options = {})
|
33
|
+
unless options[:filter_accountingMethod]
|
34
|
+
@logger.error("filter_accountingMethod is required (CASH / ACCRUAL)")
|
35
|
+
return nil
|
36
|
+
end
|
37
|
+
|
38
|
+
@client.get('reports/balance-sheet-summary', options)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class Tasks
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('tasks', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
@client.post('tasks', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve(id)
|
18
|
+
@client.get("tasks/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(id, params)
|
22
|
+
@client.put("tasks/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(id)
|
26
|
+
@client.delete("tasks/#{id}")
|
27
|
+
end
|
28
|
+
|
29
|
+
def post_update(params)
|
30
|
+
@client.post('tasks/update', params)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class Tenants
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def retrieve(id)
|
10
|
+
@client.get("tenants/#{id}")
|
11
|
+
end
|
12
|
+
|
13
|
+
def list(options = {})
|
14
|
+
@client.get('tenants', options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def create(params)
|
18
|
+
@client.post('tenants', params)
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(id, params)
|
22
|
+
@client.put("tenants/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(id)
|
26
|
+
@client.delete("tenants/#{id}")
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class Units
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('units', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def retrieve(id)
|
14
|
+
@client.get("units/#{id}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class Users
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_current_user
|
10
|
+
@client.get('users/me')
|
11
|
+
end
|
12
|
+
|
13
|
+
def list(options = {})
|
14
|
+
@client.get('users', options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve(id)
|
18
|
+
@client.get("users/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class VendorBills
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('vendor-bills', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
@client.post('vendor-bills', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve(id)
|
18
|
+
@client.get("vendor-bills/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(id, params)
|
22
|
+
@client.put("vendor-bills/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(id)
|
26
|
+
@client.delete("vendor-bills/#{id}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class VendorCredits
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('vendor-credits', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
@client.post('vendor-credits', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve(id)
|
18
|
+
@client.get("vendor-credits/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(id, params)
|
22
|
+
@client.put("vendor-credits/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(id)
|
26
|
+
@client.delete("vendor-credits/#{id}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DoorLoop
|
4
|
+
class Vendors
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
@client.get('vendors', options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
@client.post('vendors', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve(id)
|
18
|
+
@client.get("vendors/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(id, params)
|
22
|
+
@client.put("vendors/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(id)
|
26
|
+
@client.delete("vendors/#{id}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/doorloop.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'doorloop/version'
|
4
|
+
require_relative 'doorloop/client'
|
5
|
+
|
6
|
+
module DoorLoop
|
7
|
+
class Error < StandardError; end
|
8
|
+
class UnauthorizedError < Error; end
|
9
|
+
class ForbiddenError < Error; end
|
10
|
+
class NotFoundError < Error; end
|
11
|
+
class TooManyRequestsError < Error; end
|
12
|
+
class InvalidResponseError < Error; end
|
13
|
+
end
|