rentvine 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 (83) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +4 -0
  3. data/.rubocop.yml +704 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/CHANGELOG.md +5 -0
  7. data/CODE_OF_CONDUCT.md +84 -0
  8. data/Gemfile +11 -0
  9. data/Gemfile.lock +75 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +152 -0
  12. data/Rakefile +8 -0
  13. data/bin/console +15 -0
  14. data/bin/setup +8 -0
  15. data/examples/accounts.rb +17 -0
  16. data/examples/applications.rb +19 -0
  17. data/examples/associations.rb +17 -0
  18. data/examples/bills.rb +54 -0
  19. data/examples/diagnostics.rb +67 -0
  20. data/examples/files.rb +37 -0
  21. data/examples/inspections.rb +37 -0
  22. data/examples/leases.rb +23 -0
  23. data/examples/ledgers.rb +28 -0
  24. data/examples/object_types.rb +15 -0
  25. data/examples/owners.rb +17 -0
  26. data/examples/portfolios.rb +17 -0
  27. data/examples/properties.rb +75 -0
  28. data/examples/tenants.rb +17 -0
  29. data/examples/transaction_entries.rb +17 -0
  30. data/examples/transactions.rb +17 -0
  31. data/examples/units.rb +29 -0
  32. data/examples/vendor_trades.rb +36 -0
  33. data/examples/vendors.rb +17 -0
  34. data/examples/work_order_statuses.rb +36 -0
  35. data/examples/work_orders.rb +42 -0
  36. data/lib/rentvine/client/accounts.rb +13 -0
  37. data/lib/rentvine/client/applications.rb +18 -0
  38. data/lib/rentvine/client/associations.rb +13 -0
  39. data/lib/rentvine/client/bills.rb +32 -0
  40. data/lib/rentvine/client/diagnostics.rb +81 -0
  41. data/lib/rentvine/client/files.rb +37 -0
  42. data/lib/rentvine/client/inspections.rb +27 -0
  43. data/lib/rentvine/client/leases.rb +20 -0
  44. data/lib/rentvine/client/ledgers.rb +25 -0
  45. data/lib/rentvine/client/owners.rb +13 -0
  46. data/lib/rentvine/client/portfolios.rb +19 -0
  47. data/lib/rentvine/client/properties.rb +49 -0
  48. data/lib/rentvine/client/tenants.rb +13 -0
  49. data/lib/rentvine/client/transaction_entries.rb +25 -0
  50. data/lib/rentvine/client/transactions.rb +21 -0
  51. data/lib/rentvine/client/units.rb +20 -0
  52. data/lib/rentvine/client/vendor_trades.rb +27 -0
  53. data/lib/rentvine/client/vendors.rb +13 -0
  54. data/lib/rentvine/client/work_order_statuses.rb +30 -0
  55. data/lib/rentvine/client/work_orders.rb +27 -0
  56. data/lib/rentvine/client.rb +149 -0
  57. data/lib/rentvine/model/account.rb +7 -0
  58. data/lib/rentvine/model/application.rb +7 -0
  59. data/lib/rentvine/model/association.rb +7 -0
  60. data/lib/rentvine/model/bill.rb +7 -0
  61. data/lib/rentvine/model/diagnostic.rb +7 -0
  62. data/lib/rentvine/model/file.rb +7 -0
  63. data/lib/rentvine/model/inspection.rb +7 -0
  64. data/lib/rentvine/model/lease.rb +7 -0
  65. data/lib/rentvine/model/ledger.rb +7 -0
  66. data/lib/rentvine/model/owner.rb +7 -0
  67. data/lib/rentvine/model/portfolio.rb +7 -0
  68. data/lib/rentvine/model/property.rb +16 -0
  69. data/lib/rentvine/model/rentvine_model.rb +26 -0
  70. data/lib/rentvine/model/tenant.rb +7 -0
  71. data/lib/rentvine/model/transaction.rb +7 -0
  72. data/lib/rentvine/model/transaction_entry.rb +7 -0
  73. data/lib/rentvine/model/unit.rb +7 -0
  74. data/lib/rentvine/model/vendor.rb +7 -0
  75. data/lib/rentvine/model/vendor_trade.rb +7 -0
  76. data/lib/rentvine/model/work_order.rb +7 -0
  77. data/lib/rentvine/model/work_order_status.rb +7 -0
  78. data/lib/rentvine/rentvine_error.rb +61 -0
  79. data/lib/rentvine/rentvine_object_types.rb +57 -0
  80. data/lib/rentvine/version.rb +5 -0
  81. data/lib/rentvine.rb +14 -0
  82. data/rentvine.gemspec +34 -0
  83. metadata +185 -0
@@ -0,0 +1,28 @@
1
+ require 'pry-byebug'
2
+ require_relative '../lib/rentvine'
3
+
4
+ auth = {
5
+ account_code: ENV['RENTVINE_ACCOUNT_CODE'],
6
+ api_key: ENV['RENTVINE_API_KEY'],
7
+ api_secret: ENV['RENTVINE_API_SECRET']
8
+ }
9
+ rv_client = Rentvine::Client.new(auth)
10
+
11
+ # =========================================
12
+ # Ledger Examples
13
+ # =========================================
14
+
15
+ search_for = 'Hays'
16
+ rv_client.ledgers(search_for).each do |ledger|
17
+ puts [ledger.ledger_id, ledger.name].join(' :: ')
18
+ end
19
+
20
+ # ===========================
21
+
22
+ args = {
23
+ search: 'Hays',
24
+ is_active: 1
25
+ }
26
+ rv_client.search_ledgers(args).each do |ledger|
27
+ puts ledger.name
28
+ end
@@ -0,0 +1,15 @@
1
+ require 'pry-byebug'
2
+ require_relative '../lib/rentvine'
3
+
4
+ auth = {
5
+ account_code: ENV['RENTVINE_ACCOUNT_CODE'],
6
+ api_key: ENV['RENTVINE_API_KEY'],
7
+ api_secret: ENV['RENTVINE_API_SECRET']
8
+ }
9
+ rv_client = Rentvine::Client.new(auth)
10
+
11
+ # =========================================
12
+ # Assocation Examples
13
+ # =========================================
14
+
15
+ puts Rentvine::OBJECT_TYPES.first
@@ -0,0 +1,17 @@
1
+ require 'pry-byebug'
2
+ require_relative '../lib/rentvine'
3
+
4
+ auth = {
5
+ account_code: ENV['RENTVINE_ACCOUNT_CODE'],
6
+ api_key: ENV['RENTVINE_API_KEY'],
7
+ api_secret: ENV['RENTVINE_API_SECRET']
8
+ }
9
+ rv_client = Rentvine::Client.new(auth)
10
+
11
+ # =========================================
12
+ # Owner Examples
13
+ # =========================================
14
+
15
+ rv_client.owners.each do |owner|
16
+ puts owner.name
17
+ end
@@ -0,0 +1,17 @@
1
+ require 'pry-byebug'
2
+ require_relative '../lib/rentvine'
3
+
4
+ auth = {
5
+ account_code: ENV['RENTVINE_ACCOUNT_CODE'],
6
+ api_key: ENV['RENTVINE_API_KEY'],
7
+ api_secret: ENV['RENTVINE_API_SECRET']
8
+ }
9
+ rv_client = Rentvine::Client.new(auth)
10
+
11
+ # =========================================
12
+ # Portfolio Examples
13
+ # =========================================
14
+
15
+ rv_client.portfolios.each do |portfolio|
16
+ puts portfolio.name
17
+ end
@@ -0,0 +1,75 @@
1
+ require 'pry-byebug'
2
+ require_relative '../lib/rentvine'
3
+
4
+ auth = {
5
+ account_code: ENV['RENTVINE_ACCOUNT_CODE'],
6
+ api_key: ENV['RENTVINE_API_KEY'],
7
+ api_secret: ENV['RENTVINE_API_SECRET']
8
+ }
9
+ rv_client = Rentvine::Client.new(auth)
10
+
11
+ # =========================================
12
+ # Property Examples
13
+ # =========================================
14
+
15
+ rv_client.properties.each do |property|
16
+ puts property.address
17
+ end
18
+
19
+ # ===========================
20
+
21
+ property_id = 13
22
+ rv_obj = rv_client.property(property_id)
23
+ puts rv_obj.address
24
+
25
+ # ===========================
26
+
27
+ new_property = Rentvine::Property.new
28
+ new_property.address = '123 Main St'
29
+ new_property.city = 'Reno'
30
+ new_property.state_id = 'NV'
31
+ new_property.postal_code = '89509'
32
+ new_property.county = 'Washoe'
33
+ new_property.country_id = 'US'
34
+ new_property.property_image_id = 1
35
+ new_property.property_type_id = 1
36
+ new_property.is_multi_unit = 0
37
+ new_property.portfolio_id = 7
38
+ new_property.management_fee_setting_id = 1
39
+ new_property.date_time_created = '2022-07-23 22:06:17'
40
+ new_property.reserve_amount = '1200.00'
41
+ new_property.is_active = 1
42
+ new_property.is_from_import = 0
43
+ new_property.unit = {
44
+ rent: '1250.00',
45
+ deposit: '1000.00',
46
+ beds: '2',
47
+ full_baths: '1',
48
+ size: 988
49
+ }
50
+
51
+ new_property_saved_or_rentvine_error = rv_client.save_property(new_property)
52
+ if new_property_saved_or_rentvine_error.is_a?(Rentvine::RentvineError)
53
+ puts new_property_saved_or_rentvine_error.message
54
+ else
55
+ puts new_property_saved_or_rentvine_error.address
56
+ end
57
+
58
+ puts '---------------------------------'
59
+
60
+ property_id = 13
61
+ rv_client.activate_property(13)
62
+ puts 'Property 13 activated'
63
+
64
+ puts '---------------------------------'
65
+
66
+ property_id = 13
67
+ rv_client.deactivate_property(13)
68
+ puts 'Property 13 deactivated'
69
+
70
+ puts '---------------------------------'
71
+
72
+ property_id = new_property_saved_or_rentvine_error.property_id
73
+ rv_client.delete_property(property_id)
74
+
75
+ puts '---------------------------------'
@@ -0,0 +1,17 @@
1
+ require 'pry-byebug'
2
+ require_relative '../lib/rentvine'
3
+
4
+ auth = {
5
+ account_code: ENV['RENTVINE_ACCOUNT_CODE'],
6
+ api_key: ENV['RENTVINE_API_KEY'],
7
+ api_secret: ENV['RENTVINE_API_SECRET']
8
+ }
9
+ rv_client = Rentvine::Client.new(auth)
10
+
11
+ # =========================================
12
+ # Tenant Examples
13
+ # =========================================
14
+
15
+ rv_client.tenants.each do |tenant|
16
+ puts tenant.name
17
+ end
@@ -0,0 +1,17 @@
1
+ require 'pry-byebug'
2
+ require_relative '../lib/rentvine'
3
+
4
+ auth = {
5
+ account_code: ENV['RENTVINE_ACCOUNT_CODE'],
6
+ api_key: ENV['RENTVINE_API_KEY'],
7
+ api_secret: ENV['RENTVINE_API_SECRET']
8
+ }
9
+ rv_client = Rentvine::Client.new(auth)
10
+
11
+ # =========================================
12
+ # Transaction Entry Examples
13
+ # =========================================
14
+
15
+ rv_client.transaction_entries.each do |transaction_entry|
16
+ puts transaction_entry.credit
17
+ end
@@ -0,0 +1,17 @@
1
+ require 'pry-byebug'
2
+ require_relative '../lib/rentvine'
3
+
4
+ auth = {
5
+ account_code: ENV['RENTVINE_ACCOUNT_CODE'],
6
+ api_key: ENV['RENTVINE_API_KEY'],
7
+ api_secret: ENV['RENTVINE_API_SECRET']
8
+ }
9
+ rv_client = Rentvine::Client.new(auth)
10
+
11
+ # =========================================
12
+ # Transaction Examples
13
+ # =========================================
14
+
15
+ rv_client.transactions.each do |transaction|
16
+ puts transaction.description
17
+ end
data/examples/units.rb ADDED
@@ -0,0 +1,29 @@
1
+ require 'pry-byebug'
2
+ require_relative '../lib/rentvine'
3
+
4
+ auth = {
5
+ account_code: ENV['RENTVINE_ACCOUNT_CODE'],
6
+ api_key: ENV['RENTVINE_API_KEY'],
7
+ api_secret: ENV['RENTVINE_API_SECRET']
8
+ }
9
+ rv_client = Rentvine::Client.new(auth)
10
+
11
+ # =========================================
12
+ # Unit Examples
13
+ # =========================================
14
+
15
+ # ===========================
16
+
17
+ property_id = 13
18
+ rv_client.units(property_id).each do |unit|
19
+ puts unit.address
20
+ end
21
+
22
+ # ===========================
23
+
24
+ property_id = 13
25
+ unit_id = 38
26
+ rvu = rv_client.unit(property_id, unit_id)
27
+ puts rvu.address
28
+
29
+ # ===========================
@@ -0,0 +1,36 @@
1
+ require 'pry-byebug'
2
+ require_relative '../lib/rentvine'
3
+
4
+ auth = {
5
+ account_code: ENV['RENTVINE_ACCOUNT_CODE'],
6
+ api_key: ENV['RENTVINE_API_KEY'],
7
+ api_secret: ENV['RENTVINE_API_SECRET']
8
+ }
9
+ rv_client = Rentvine::Client.new(auth)
10
+
11
+ # =========================================
12
+ # Vendor Trade Examples
13
+ # =========================================
14
+
15
+ rv_client.vendor_trades.each do |vendor_trade|
16
+ puts vendor_trade.vendor_trade_id
17
+ end
18
+
19
+ # ===========================
20
+
21
+ vendor_trade_id = 1
22
+ rv_obj = rv_client.vendor_trade(vendor_trade_id)
23
+ puts rv_obj.vendor_trade_id
24
+
25
+ # ===========================
26
+
27
+ new_vendor_trade = Rentvine::WorkOrderStatus.new
28
+ new_vendor_trade.name = 'Welding'
29
+ new_vendor_trade.is_visible_tenant_portal = 1
30
+
31
+ new_vendor_trade_saved_or_rentvine_error = rv_client.save_vendor_trade(new_vendor_trade)
32
+ if new_vendor_trade_saved_or_rentvine_error.is_a?(Rentvine::RentvineError)
33
+ puts new_vendor_trade_saved_or_rentvine_error.message
34
+ else
35
+ puts new_vendor_trade_saved_or_rentvine_error.vendor_trade_id
36
+ end
@@ -0,0 +1,17 @@
1
+ require 'pry-byebug'
2
+ require_relative '../lib/rentvine'
3
+
4
+ auth = {
5
+ account_code: ENV['RENTVINE_ACCOUNT_CODE'],
6
+ api_key: ENV['RENTVINE_API_KEY'],
7
+ api_secret: ENV['RENTVINE_API_SECRET']
8
+ }
9
+ rv_client = Rentvine::Client.new(auth)
10
+
11
+ # =========================================
12
+ # Vendor Examples
13
+ # =========================================
14
+
15
+ rv_client.vendors.each do |vendor|
16
+ puts vendor.name
17
+ end
@@ -0,0 +1,36 @@
1
+ require 'pry-byebug'
2
+ require_relative '../lib/rentvine'
3
+
4
+ auth = {
5
+ account_code: ENV['RENTVINE_ACCOUNT_CODE'],
6
+ api_key: ENV['RENTVINE_API_KEY'],
7
+ api_secret: ENV['RENTVINE_API_SECRET']
8
+ }
9
+ rv_client = Rentvine::Client.new(auth)
10
+
11
+ # =========================================
12
+ # Work Order Examples
13
+ # =========================================
14
+
15
+ rv_client.work_order_statuses.each do |work_order_status|
16
+ puts work_order_status.work_order_status_id
17
+ end
18
+
19
+ # ===========================
20
+
21
+ work_order_status_id = 7
22
+ rv_obj = rv_client.work_order_status(work_order_status_id)
23
+ puts rv_obj.work_order_status_id
24
+
25
+ # ===========================
26
+
27
+ new_work_order_status = Rentvine::WorkOrderStatus.new
28
+ new_work_order_status.primary_work_order_status_id = 1
29
+ new_work_order_status.name = 'Wes Work Order Status'
30
+
31
+ new_work_order_status_saved_or_rentvine_error = rv_client.save_work_order_status(new_work_order_status)
32
+ if new_work_order_status_saved_or_rentvine_error.is_a?(Rentvine::RentvineError)
33
+ puts new_work_order_status_saved_or_rentvine_error.message
34
+ else
35
+ puts new_work_order_status_saved_or_rentvine_error.work_order_status_id
36
+ end
@@ -0,0 +1,42 @@
1
+ require 'pry-byebug'
2
+ require_relative '../lib/rentvine'
3
+
4
+ auth = {
5
+ account_code: ENV['RENTVINE_ACCOUNT_CODE'],
6
+ api_key: ENV['RENTVINE_API_KEY'],
7
+ api_secret: ENV['RENTVINE_API_SECRET']
8
+ }
9
+ rv_client = Rentvine::Client.new(auth)
10
+
11
+ # =========================================
12
+ # Work Order Examples
13
+ # =========================================
14
+
15
+ rv_client.work_orders.each do |work_order|
16
+ puts work_order.work_order_id
17
+ end
18
+
19
+ # ===========================
20
+
21
+ work_order_id = 7
22
+ rv_obj = rv_client.work_order(work_order_id)
23
+ puts rv_obj.work_order_id
24
+
25
+ # ===========================
26
+
27
+ new_work_order = Rentvine::WorkOrder.new
28
+ new_work_order.property_id = 32
29
+ new_work_order.work_order_status_id = 1
30
+ new_work_order.priority_id = 1
31
+ new_work_order.is_owner_approved = 1
32
+ new_work_order.is_vacant = 0
33
+ new_work_order.description = 'This is something to fix'
34
+ new_work_order.is_shared_with_tenant = 1
35
+ new_work_order.is_shared_with_owner = 1
36
+
37
+ new_work_order_saved_or_rentvine_error = rv_client.save_work_order(new_work_order)
38
+ if new_work_order_saved_or_rentvine_error.is_a?(Rentvine::RentvineError)
39
+ puts new_work_order_saved_or_rentvine_error.message
40
+ else
41
+ puts new_work_order_saved_or_rentvine_error.work_order_id
42
+ end
@@ -0,0 +1,13 @@
1
+ module Rentvine
2
+ class Client
3
+ module Accounts
4
+ def accounts(args = {})
5
+ results = process_request(:get, 'accounting/accounts', params: args)
6
+ return results if results.is_a?(RentvineError)
7
+
8
+ results.map { |result| Rentvine::Account.new(result[:account]) }
9
+ end
10
+ alias list_accounts accounts
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ module Rentvine
2
+ class Client
3
+ module Applications
4
+ def export_applications(args = {})
5
+ results = process_request(:get, 'screening/applications/export', params: args)
6
+ return results if results.is_a?(RentvineError)
7
+
8
+ results.map do |result|
9
+ rvobj = Rentvine::Portfolio.new(result[:application])
10
+ rvobj.unit = Rentvine::Unit.new(result[:unit])
11
+ rvobj.lease = Rentvine::Lease.new(result[:lease])
12
+ rvobj.meta = { appends: [:unit, :lease] }
13
+ rvobj
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ module Rentvine
2
+ class Client
3
+ module Associations
4
+ def associations(args = {})
5
+ results = process_request(:get, 'associations/search', params: args)
6
+ return results if results.is_a?(RentvineError)
7
+
8
+ results.map { |result| Rentvine::Association.new(result[:contact]) }
9
+ end
10
+ alias list_associations associations
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,32 @@
1
+ module Rentvine
2
+ class Client
3
+ module Bills
4
+ def bills(args = {})
5
+ results = process_request(:get, 'accounting/bills', params: args)
6
+ return results if results.is_a?(RentvineError)
7
+
8
+ results.map do |result|
9
+ rvobj = Rentvine::Bill.new(result[:bill])
10
+ rvobj.contact = Rentvine::Vendor.new(result[:contact])
11
+ rvobj.meta = { appends: [:contact] }
12
+ rvobj
13
+ end
14
+ end
15
+ alias list_bills bills
16
+
17
+ def bill(bill_id)
18
+ result = process_request(:get, "accounting/bills/#{bill_id}")
19
+ return result if result.is_a?(RentvineError)
20
+
21
+ Rentvine::Bill.new(result[:bill])
22
+ end
23
+
24
+ def save_bill(bill_model)
25
+ result = process_request(:post, 'accounting/bills', body: bill_model.to_rentvine_hash)
26
+ return result if result.is_a?(RentvineError)
27
+
28
+ Rentvine::Bill.new(result[:bill])
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,81 @@
1
+ module Rentvine
2
+ class Client
3
+ module Diagnostics
4
+ def bank_account_reconciliation_lapse
5
+ results = process_request(:get, '/accounting/diagnostics/bank-account-reconciliation-lapse')
6
+ return results if results.is_a?(RentvineError)
7
+ results.map { |result| Rentvine::Diagnostic.new(result) }
8
+ end
9
+
10
+ def credit_debit_mismatch
11
+ results = process_request(:get, '/accounting/diagnostics/credit-debit-mismatch')
12
+ return results if results.is_a?(RentvineError)
13
+
14
+ results.map { |result| Rentvine::Diagnostic.new(result) }
15
+ end
16
+
17
+ def escrow_mismatch
18
+ results = process_request(:get, '/accounting/diagnostics/escrow-mismatch')
19
+ return results if results.is_a?(RentvineError)
20
+
21
+ results.map { |result| Rentvine::Diagnostic.new(result) }
22
+ end
23
+
24
+ def manager_ledger_balance
25
+ result = process_request(:get, '/accounting/diagnostics/manager-ledger-balance')
26
+ return result if result.is_a?(RentvineError)
27
+
28
+ Rentvine::Diagnostic.new(result)
29
+ end
30
+
31
+ def negative_bank_accounts
32
+ results = process_request(:get, '/accounting/diagnostics/negative-bank-accounts')
33
+ return results if results.is_a?(RentvineError)
34
+
35
+ results.map { |result| Rentvine::Diagnostic.new(result) }
36
+ end
37
+
38
+ def prepayment_mismatch
39
+ results = process_request(:get, '/accounting/diagnostics/prepayment-mismatch')
40
+ return results if results.is_a?(RentvineError)
41
+
42
+ results.map { |result| Rentvine::Diagnostic.new(result) }
43
+ end
44
+
45
+ def reserve_not_met
46
+ results = process_request(:get, '/accounting/diagnostics/reserve-not-met')
47
+ return results if results.is_a?(RentvineError)
48
+
49
+ results.map { |result| Rentvine::Diagnostic.new(result) }
50
+ end
51
+
52
+ def suppressed_fee_balance_mismatch
53
+ results = process_request(:get, '/accounting/diagnostics/suppressed-fee-balance-mismatch')
54
+ return results if results.is_a?(RentvineError)
55
+
56
+ results.map { |result| Rentvine::Diagnostic.new(result) }
57
+ end
58
+
59
+ def unused_prepayments
60
+ results = process_request(:get, '/accounting/diagnostics/unused-prepayments')
61
+ return results if results.is_a?(RentvineError)
62
+
63
+ results.map { |result| Rentvine::Diagnostic.new(result) }
64
+ end
65
+
66
+ def unused_vendor_credits
67
+ results = process_request(:get, '/accounting/diagnostics/unused-vendor-credits')
68
+ return results if results.is_a?(RentvineError)
69
+
70
+ results.map { |result| Rentvine::Diagnostic.new(result) }
71
+ end
72
+
73
+ def vendor_insurance_lapse
74
+ results = process_request(:get, '/accounting/diagnostics/vendor-insurance-lapse')
75
+ return results if results.is_a?(RentvineError)
76
+
77
+ results.map { |result| Rentvine::Diagnostic.new(result) }
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,37 @@
1
+ module Rentvine
2
+ class Client
3
+ module Files
4
+ def files(args = {})
5
+ results = process_request(:get, 'files', params: args)
6
+ return results if results.is_a?(RentvineError)
7
+
8
+ results.map { |result| Rentvine::File.new(result[:file]) }
9
+ end
10
+ alias list_files files
11
+
12
+ def file(file_id)
13
+ result = process_request(:get, "files/#{file_id}")
14
+ return result if result.is_a?(RentvineError)
15
+
16
+ Rentvine::File.new(result[:file])
17
+ end
18
+
19
+ def upload_file(path_to_file, object_type_id, object_id)
20
+ result = process_file(
21
+ path_to_file,
22
+ { object_type_id: object_type_id, object_id: object_id }
23
+ )
24
+ return result if result.is_a?(RentvineError)
25
+
26
+ Rentvine::File.new(result[:file])
27
+ end
28
+
29
+ def delete_file(file_id)
30
+ result = process_request(:delete, "files/#{file_id}")
31
+ return result if result.is_a?(RentvineError)
32
+
33
+ true
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,27 @@
1
+ module Rentvine
2
+ class Client
3
+ module Inspections
4
+ def inspections(args = {})
5
+ results = process_request(:get, 'maintenance/inspections', params: args)
6
+ return results if results.is_a?(RentvineError)
7
+
8
+ results.map { |result| Rentvine::Inspection.new(result[:inspection]) }
9
+ end
10
+ alias list_inspections inspections
11
+
12
+ def inspection(inspection_id)
13
+ result = process_request(:get, "maintenance/inspections/#{inspection_id}")
14
+ return result if result.is_a?(RentvineError)
15
+
16
+ Rentvine::Inspection.new(result[:inspection])
17
+ end
18
+
19
+ def save_inspection(inspection_model)
20
+ result = process_request(:post, '/maintenance/inspections', body: inspection_model.to_rentvine_hash)
21
+ return result if result.is_a?(RentvineError)
22
+
23
+ Rentvine::Inspection.new(result[:inspection])
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,20 @@
1
+ module Rentvine
2
+ class Client
3
+ module Leases
4
+ def leases(args = {})
5
+ results = process_request(:get, 'leases', params: args)
6
+ return results if results.is_a?(RentvineError)
7
+
8
+ results.map { |result| Rentvine::Lease.new(result[:lease]) }
9
+ end
10
+ alias list_leases leases
11
+
12
+ def lease(lease_id)
13
+ result = process_request(:get, "leases/#{lease_id}")
14
+ return result if result.is_a?(RentvineError)
15
+
16
+ Rentvine::Lease.new(result[:lease])
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,25 @@
1
+ module Rentvine
2
+ class Client
3
+ module Ledgers
4
+ def ledgers(search)
5
+ results = process_request(:get, 'accounting/ledgers', params: { search: search })
6
+ return results if results.is_a?(RentvineError)
7
+
8
+ results.map { |result| Rentvine::Ledger.new(result[:ledger]) }
9
+ end
10
+ alias list_ledgers ledgers
11
+
12
+ def search_ledgers(args = {})
13
+ results = process_request(:get, 'accounting/ledgers/search', params: args)
14
+ return results if results.is_a?(RentvineError)
15
+
16
+ results.map do |result|
17
+ rvobj = Rentvine::Ledger.new(result[:ledger])
18
+ rvobj.unit = Rentvine::Unit.new(result[:unit])
19
+ rvobj.meta = { appends: [:unit] }
20
+ rvobj
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,13 @@
1
+ module Rentvine
2
+ class Client
3
+ module Owners
4
+ def owners(args = {})
5
+ results = process_request(:get, 'owners/search', params: args)
6
+ return results if results.is_a?(RentvineError)
7
+
8
+ results.map { |result| Rentvine::Owner.new(result[:contact]) }
9
+ end
10
+ alias list_owners owners
11
+ end
12
+ end
13
+ end