rentvine 0.1.0 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f46b3c038f078ae2b3f258e6dbc823a83e1dadedf69abc468d5ac01c2efdaa0f
4
- data.tar.gz: 7eb3580fd56d9ec05aaabeb877b7e26fc100180701292682b662064bf46ae556
3
+ metadata.gz: a22391298dd007527b72afe3a5ec88163944eb9e539c6f060a0a016f26a586b7
4
+ data.tar.gz: 82d4c9ce93ac414e3efefb6aff99e385322bef0fd66e20818e61c83e39c7a22b
5
5
  SHA512:
6
- metadata.gz: 0526fb377f7c87906394a044dafa1dc78c8e32b7899a64536f3415bb1bbc881469e49acac8c20872b395845c77b3e89499c6949e1a2722a3a6d98c0bf22380fe
7
- data.tar.gz: 981d03241bf3826b09fc7e83949d97f00ec3c2729ea8bd12f8a1e371548a3dad1646480571b68f5a7b96eb0685233fc2ed489fcb5f9628aa77d8d4afa3b43b16
6
+ metadata.gz: d55139eee0a55924cc34cd4f793d02b54f23a65bd466d79aa8f347f399742465491107726e18cc1f7ce0072d85118b474cd9fe88b98b09068e28dc4250d76de8
7
+ data.tar.gz: a96da0ce3459339f1db75fe238d0d965e1a121783bd5939a1c7bc51b18eb8d1042a05b79eca872d948908df0cb25b01124669e79136b2ad6fe0c799a48ccf15c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2024-09-19
4
+
5
+ - Added model for parsing the owner distributions on the portfolio response.
6
+
7
+ ## [0.2.0] - 2024-09-15
8
+
9
+ - Added export endpoints for properties, units, and leases.
10
+ - Updated examples to show export usage for properties, units, and leases.
11
+ - Added model for lease balances.
12
+ - Added example for lease balances.
13
+
3
14
  ## [0.1.0] - 2024-09-01
4
15
 
5
16
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rentvine (0.1.0)
4
+ rentvine (0.3.0)
5
5
  awrence (~> 3.0)
6
6
  json (~> 2.7)
7
7
  plissken (~> 3.0)
@@ -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
+ # Assocation Examples
13
+ # =========================================
14
+
15
+ rv_client.export_leaeses.each do |lease_info|
16
+ puts lease_info.balance.past_due_total_amount
17
+ end
data/examples/owners.rb CHANGED
@@ -15,3 +15,7 @@ rv_client = Rentvine::Client.new(auth)
15
15
  rv_client.owners.each do |owner|
16
16
  puts owner.name
17
17
  end
18
+
19
+ rv_client.owners(page: 1, page_size: 5).each do |owner|
20
+ puts owner.name
21
+ end
@@ -13,5 +13,5 @@ rv_client = Rentvine::Client.new(auth)
13
13
  # =========================================
14
14
 
15
15
  rv_client.portfolios.each do |portfolio|
16
- puts portfolio.name
16
+ puts [portfolio.portfolio_id, portfolio.name].join(' :: ')
17
17
  end
@@ -55,21 +55,27 @@ else
55
55
  puts new_property_saved_or_rentvine_error.address
56
56
  end
57
57
 
58
- puts '---------------------------------'
58
+ # ===========================
59
59
 
60
60
  property_id = 13
61
61
  rv_client.activate_property(13)
62
62
  puts 'Property 13 activated'
63
63
 
64
- puts '---------------------------------'
64
+ # ===========================
65
65
 
66
66
  property_id = 13
67
67
  rv_client.deactivate_property(13)
68
68
  puts 'Property 13 deactivated'
69
69
 
70
- puts '---------------------------------'
70
+ # ===========================
71
71
 
72
72
  property_id = new_property_saved_or_rentvine_error.property_id
73
73
  rv_client.delete_property(property_id)
74
74
 
75
- puts '---------------------------------'
75
+ # ===========================
76
+
77
+ rv_client.export_properties.each do |property|
78
+ puts property.address
79
+ end
80
+
81
+ # ===========================
data/examples/units.rb CHANGED
@@ -27,3 +27,9 @@ rvu = rv_client.unit(property_id, unit_id)
27
27
  puts rvu.address
28
28
 
29
29
  # ===========================
30
+
31
+ rv_client.export_units.each do |unit|
32
+ puts unit.address
33
+ end
34
+
35
+ # ===========================
@@ -15,6 +15,23 @@ module Rentvine
15
15
 
16
16
  Rentvine::Lease.new(result[:lease])
17
17
  end
18
+
19
+ def export_leaeses(args = {})
20
+ results = process_request(:get, 'leases/export', params: args)
21
+ return results if results.is_a?(RentvineError)
22
+
23
+ results.map do |result|
24
+ rvobj = Rentvine::Lease.new(result[:lease])
25
+ rvobj.balance = Rentvine::Balance.new(result[:balances])
26
+ rvobj.balances = rvobj.balance
27
+ rvobj.tenants = result[:lease][:tenants].map { |tenant| Rentvine::Tenant.new(tenant) }
28
+ rvobj.property = Rentvine::Property.new(result[:property])
29
+ rvobj.unit = Rentvine::Unit.new(result[:unit])
30
+ rvobj.portfolio = Rentvine::Unit.new(result[:portfolio])
31
+ rvobj.meta = { appends: [:balances, :balance, :tenants, :property, :unit, :portfolio] }
32
+ rvobj
33
+ end
34
+ end
18
35
  end
19
36
  end
20
37
  end
@@ -6,10 +6,20 @@ module Rentvine
6
6
  return results if results.is_a?(RentvineError)
7
7
 
8
8
  results.map do |result|
9
+ contacts_str = result[:portfolio].delete(:contacts)
9
10
  rvobj = Rentvine::Portfolio.new(result[:portfolio])
11
+
12
+ begin
13
+ rvobj.owner_distributions = process_rentvine_response(contacts_str).map do |owner|
14
+ Rentvine::OwnerDistribution.new(owner)
15
+ end
16
+ rescue
17
+ rvobj.owner_distributions = contacts_str
18
+ end
19
+
10
20
  rvobj.statement_setting = result[:statement_setting]
11
21
  rvobj.last_statement = result[:last_statement]
12
- rvobj.meta = { appends: [:statement_setting, :last_statement] }
22
+ rvobj.meta = { appends: [:owner_distributions, :statement_setting, :last_statement] }
13
23
  rvobj
14
24
  end
15
25
  end
@@ -44,6 +44,18 @@ module Rentvine
44
44
 
45
45
  true
46
46
  end
47
+
48
+ def export_properties(args = {})
49
+ results = process_request(:get, 'properties/export', params: args)
50
+ return results if results.is_a?(RentvineError)
51
+
52
+ results.map do |result|
53
+ rvobj = Rentvine::Property.new(result[:property])
54
+ rvobj.portfolio = Rentvine::Portfolio.new(result[:portfolio])
55
+ rvobj.meta = { appends: [:portfolio] }
56
+ rvobj
57
+ end
58
+ end
47
59
  end
48
60
  end
49
61
  end
@@ -15,6 +15,18 @@ module Rentvine
15
15
 
16
16
  Rentvine::Unit.new(result[:unit])
17
17
  end
18
+
19
+ def export_units(args = {})
20
+ results = process_request(:get, 'properties/units/export', params: args)
21
+ return results if results.is_a?(RentvineError)
22
+
23
+ results.map do |result|
24
+ rvobj = Rentvine::Unit.new(result[:unit])
25
+ rvobj.property = Rentvine::Property.new(result[:property])
26
+ rvobj.meta = { appends: [:property] }
27
+ rvobj
28
+ end
29
+ end
18
30
  end
19
31
  end
20
32
  end
@@ -23,6 +23,7 @@ require_relative 'model/rentvine_model'
23
23
  require_relative 'model/account'
24
24
  require_relative 'model/application'
25
25
  require_relative 'model/association'
26
+ require_relative 'model/balance'
26
27
  require_relative 'model/bill'
27
28
  require_relative 'model/diagnostic'
28
29
  require_relative 'model/file'
@@ -30,6 +31,7 @@ require_relative 'model/inspection'
30
31
  require_relative 'model/lease'
31
32
  require_relative 'model/ledger'
32
33
  require_relative 'model/owner'
34
+ require_relative 'model/owner_distribution'
33
35
  require_relative 'model/portfolio'
34
36
  require_relative 'model/property'
35
37
  require_relative 'model/tenant'
@@ -104,13 +106,13 @@ module Rentvine
104
106
  ).run
105
107
  return RentvineError.new(response) unless response.success?
106
108
 
107
- process_rentvine_response(response)
109
+ process_rentvine_response(response.body)
108
110
  end
109
111
 
110
- def process_rentvine_response(response)
111
- JSON.parse(response.body, symbolize_names: true).to_snake_keys
112
+ def process_rentvine_response(response_body)
113
+ JSON.parse(response_body, symbolize_names: true).to_snake_keys
112
114
  rescue
113
- response.body
115
+ response_body
114
116
  end
115
117
 
116
118
  def process_request(request_type, url_path, options = {})
@@ -131,7 +133,7 @@ module Rentvine
131
133
  ).run
132
134
  return RentvineError.new(response) unless response.success?
133
135
 
134
- process_rentvine_response(response)
136
+ process_rentvine_response(response.body)
135
137
  end
136
138
 
137
139
  def rentvine_auth_headers
@@ -0,0 +1,7 @@
1
+ module Rentvine
2
+ class Balance < RentvineModel
3
+ def initialize(data = {})
4
+ super(data)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Rentvine
2
+ class OwnerDistribution < RentvineModel
3
+ def initialize(data = {})
4
+ super(data)
5
+ end
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rentvine
4
- VERSION = '0.1.0'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rentvine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wes Hays
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-10 00:00:00.000000000 Z
11
+ date: 2024-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -90,6 +90,7 @@ files:
90
90
  - examples/accounts.rb
91
91
  - examples/applications.rb
92
92
  - examples/associations.rb
93
+ - examples/balances.rb
93
94
  - examples/bills.rb
94
95
  - examples/diagnostics.rb
95
96
  - examples/files.rb
@@ -133,6 +134,7 @@ files:
133
134
  - lib/rentvine/model/account.rb
134
135
  - lib/rentvine/model/application.rb
135
136
  - lib/rentvine/model/association.rb
137
+ - lib/rentvine/model/balance.rb
136
138
  - lib/rentvine/model/bill.rb
137
139
  - lib/rentvine/model/diagnostic.rb
138
140
  - lib/rentvine/model/file.rb
@@ -140,6 +142,7 @@ files:
140
142
  - lib/rentvine/model/lease.rb
141
143
  - lib/rentvine/model/ledger.rb
142
144
  - lib/rentvine/model/owner.rb
145
+ - lib/rentvine/model/owner_distribution.rb
143
146
  - lib/rentvine/model/portfolio.rb
144
147
  - lib/rentvine/model/property.rb
145
148
  - lib/rentvine/model/rentvine_model.rb