vantaca 0.3.0 → 0.3.1

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: 17d644bafa17b33e40ce3695a575773dc6a4c32500b20463e5a85849d9e7f7ce
4
- data.tar.gz: 1d1644fde830360cec3b38860f124528a32411613b5d0d4693866f01f2984bcf
3
+ metadata.gz: c20dee21412de48a8af0be81b7644a2eb0ea379e953776e321aae3d6b148256c
4
+ data.tar.gz: 4d9fb4973d18f7a73caa2afc9a396ccef65f3988df1e7cb9613ee627f53838ab
5
5
  SHA512:
6
- metadata.gz: 69c22312ab4573a406982fed1c14ada85cc2bbeed1b4dbc197266ffda5e6b07d924588575739feeb6b1887a7c04b916b53d7017dde71cfce1712cd6b3959c9fe
7
- data.tar.gz: 205fef825382c52847c32aa83d8ae304cd7bd74372e40602e22aa97fbcb3af181ae1a3eb7c5169d077bdc350d42ac9c0bdf173bd2ab428a3b322a6a474e92093
6
+ metadata.gz: c9a0d82584f6f99953ee7046b7fd2da5baf3e2203937eac1acb0cb127e26cc55c62e9c0c8ca80d1fe3e9b41fe87c7aaf701f6c361b93823771941286de204cf0
7
+ data.tar.gz: 06aa883955d84f50231bd71a28e79b53648cf7918c6220b7ec269bfe3ff5c6cd68d14bff64844fb6b7c589eaa4e852f54b8d939c283a49142218706fb09a3baa
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vantaca (0.3.0)
4
+ vantaca (0.3.1)
5
5
  httparty (~> 0.24)
6
6
  zeitwerk (~> 2.7)
7
7
 
@@ -144,7 +144,7 @@ CHECKSUMS
144
144
  ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
145
145
  unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
146
146
  unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
147
- vantaca (0.3.0)
147
+ vantaca (0.3.1)
148
148
  vcr (6.4.0) sha256=077ac92cc16efc5904eb90492a18153b5e6ca5398046d8a249a7c96a9ea24ae6
149
149
  webmock (3.26.1) sha256=4f696fb57c90a827c20aadb2d4f9058bbff10f7f043bd0d4c3f58791143b1cd7
150
150
  zeitwerk (2.7.5) sha256=d8da92128c09ea6ec62c949011b00ed4a20242b255293dd66bf41545398f73dd
data/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # Vantaca API Gem
2
2
 
3
- [![Build Status](https://github.com/ValenciaMgmt/Vantaca/workflows/RSpec/badge.svg?branch=master)](https://github.com/ValenciaMgmt/Vantaca/actions?query=workflow%3A%22RSpec%22)
3
+ [![Build Status](https://github.com/Valencia-Management-Group/Vantaca/actions/workflows/ruby.yml/badge.svg)](https://github.com/Valencia-Management-Group/Vantaca/actions/workflows/ruby.yml)
@@ -17,6 +17,9 @@ module Vantaca
17
17
  Array(response).map { Vantaca::Models::ActionCategory.new(it) }
18
18
  end
19
19
 
20
+ # Load all active action types and their steps.
21
+ #
22
+ # @return [Array<Vantaca::Models::ActionType>] active action types
20
23
  def action_types
21
24
  response = get('/read/actionTypeList')
22
25
 
@@ -24,5 +27,93 @@ module Vantaca
24
27
 
25
28
  Array(response).map { Vantaca::Models::ActionType.new(it) }
26
29
  end
30
+
31
+ # Retrieve details about an action item.
32
+ #
33
+ # @param action_item_id [Integer] the internal Vantaca ID of an action item
34
+ # @return [Vantaca::Models::ActionItem] the action item with the specified ID
35
+ # @raise [Vantaca::Errors::NotFoundError] if the action item does not exist
36
+ def action_item(action_item_id)
37
+ response = get('/read/getActionItem', actionItemID: action_item_id)
38
+
39
+ raise Vantaca::Errors::NotFoundError unless response
40
+
41
+ Vantaca::Models::ActionItem.new response
42
+ end
43
+
44
+ # Create a new action item for a specific association. Only action items in the Standard category can be created
45
+ # through the API.
46
+ #
47
+ # @param assoc_code [String] the 3-4 character association code for a community
48
+ # @param action_type_id [Integer] the internal Vantaca action type ID
49
+ # @param options [Hash] Additional options for the action item
50
+ # @option options [Integer, nil] :step_id Unique identifier for an action item step.
51
+ # @option options [Integer, nil] :property_id Unique identifier for a property related to this action item.
52
+ # @option options [String, nil] :description A description of the action item.
53
+ # @option options [String, nil] :subject A short subject line for the action item.
54
+ # @option options [Date, nil] :followup_date The follow-up date for this action item.
55
+ # @option options [Date, nil] :due_date The due date for this action item.
56
+ # @option options [Hash] :file An optional file attachment for this action item, with keys :path (the local file
57
+ # path) and :is_primary (a boolean indicating whether this is the primary attachment for the action item).
58
+ #
59
+ # @return [Hash] the API response for the created action item
60
+ def create_association_action_item(assoc_code, action_type_id:, **options)
61
+ post(
62
+ '/write/createStandardActionItem',
63
+ action_item_body(options[:file]),
64
+ assocCode: assoc_code,
65
+ actionTypeID: action_type_id,
66
+ **action_item_parameters(options)
67
+ )
68
+ end
69
+
70
+ # Create a new action item for a specific account. Only action items in the Standard category can be created
71
+ # through the API.
72
+ #
73
+ # @param account_no [String] the 7-9 character account number for a property's homeowner
74
+ # @param action_type_id [Integer] the internal Vantaca action type ID
75
+ # @param options [Hash] Additional options for the action item
76
+ # @option options [Integer, nil] :step_id Unique identifier for an action item step.
77
+ # @option options [Integer, nil] :property_id Unique identifier for a property related to this action item.
78
+ # @option options [String, nil] :description A description of the action item.
79
+ # @option options [String, nil] :subject A short subject line for the action item.
80
+ # @option options [Date, nil] :followup_date The follow-up date for this action item.
81
+ # @option options [Date, nil] :due_date The due date for this action item.
82
+ # @option options [Hash] :file An optional file attachment for this action item, with keys :path (the local file
83
+ # path) and :is_primary (a boolean indicating whether this is the primary attachment for the action item).
84
+ #
85
+ # @return [Hash] the API response for the created action item
86
+ def create_account_action_item(account_no, action_type_id:, **options)
87
+ post(
88
+ '/write/createStandardActionItem',
89
+ action_item_body(options[:file]),
90
+ accountNo: account_no,
91
+ actionTypeID: action_type_id,
92
+ **action_item_parameters(options)
93
+ )
94
+ end
95
+
96
+ protected
97
+
98
+ def action_item_parameters(options)
99
+ {
100
+ stepID: options[:step_id],
101
+ propertyID: options[:property_id],
102
+ description: options[:description],
103
+ subject: options[:subject],
104
+ dueDate: options[:due_date]&.iso8601,
105
+ followupDate: options[:followup_date]&.iso8601
106
+ }
107
+ end
108
+
109
+ def action_item_body(file)
110
+ return unless file
111
+
112
+ {
113
+ file: Base64.strict_encode64(File.read(file[:path])),
114
+ fileName: File.basename(file[:path]),
115
+ isPrimary: file[:is_primary] || false
116
+ }
117
+ end
27
118
  end
28
119
  end
@@ -10,7 +10,7 @@ module Vantaca
10
10
  #
11
11
  # @param account [String] The 7-9 character account number for the homeowner, e.g. 'ABC12345'
12
12
  # @param type [String] Type of transaction. Possible values: Charge, Adjustment, Writeoff.
13
- # @param charge_id [Fixnum] The association Charge ID associated with this owners account.
13
+ # @param charge_id [Integer] The association Charge ID associated with this owners account.
14
14
  # @param date [String] The ledger date for this transaction, e.g. '2020-12-25'
15
15
  # @param amount [Float] Transaction amount. Must be greater than 0.
16
16
  # @param description [String] Description of the transaction.
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) Valencia Management Group
4
+ # All rights reserved.
5
+
6
+ module Vantaca
7
+ module Models
8
+ # Information about an action category
9
+ class ActionItem < Base
10
+ # @return [Integer] unique identifier for action category
11
+ def type_id = data['actionTypeID']
12
+
13
+ # @return [Integer] unique identifier for action step
14
+ def step_id = data['actionStepID']
15
+
16
+ # @return [Integer] unique identifier for action category
17
+ def category_id = data['actionCategoryID']
18
+
19
+ # @return [String] action category description
20
+ def description = data['descr']
21
+
22
+ # @return [Time] date and time when this action item was created
23
+ def created_at = Time.parse(data['created'])
24
+
25
+ # @return [Time] date and time when this action item was last modified
26
+ def updated_at = Time.parse(data['lastModified'])
27
+
28
+ # @return [String] the 3-4 character association code for the community
29
+ def assoc_code = data['assocCode']
30
+
31
+ # @return [Array<Vantaca::Models::ActionItemNote>] notes associated with this action item
32
+ def notes = data['actionItemNotes'].map { Vantaca::Models::ActionItemNote.new(it) }
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) Valencia Management Group
4
+ # All rights reserved.
5
+
6
+ module Vantaca
7
+ module Models
8
+ # Information about an action item note
9
+ class ActionItemNote < Base
10
+ # @return [Integer] unique identifier for action step
11
+ def step_id = data['actionStepID']
12
+
13
+ # @return [String] action item note
14
+ def note = data['note']
15
+
16
+ # @return [Time] date and time when this action item was created
17
+ def created_at = Time.parse(data['created'])
18
+ end
19
+ end
20
+ end
@@ -32,7 +32,8 @@ module Vantaca
32
32
  # Loading an owner by their account number doesn't need a community code, since the account numbers are unique.
33
33
  #
34
34
  # @param account [String] the 7-9 character account number for a property's homeowner
35
- # @option opts [Symbol, Array<Symbol>] :include Include additional information, using keys from OWNER_PARAMETERS
35
+ # @param options [Hash] Additional options for loading information
36
+ # @option options [Symbol, Array<Symbol>] :include Include additional information, using keys from OWNER_PARAMETERS
36
37
  # @return [Vantaca::Models::Owner] a list of all current and former owners in this community.
37
38
  def account_owner(account, **options)
38
39
  params = owner_parameters(nil, options).merge(account:)
@@ -47,8 +48,9 @@ module Vantaca
47
48
  # Load a list of all owners for a specific property
48
49
  #
49
50
  # @param assoc_code [String] the 3-4 character association code for a community
50
- # @param property_id [Fixnum] the internal Vantaca property ID
51
- # @option opts [Symbol, Array<Symbol>] :include Include additional information, using keys from OWNER_PARAMETERS
51
+ # @param property_id [Integer] the internal Vantaca property ID
52
+ # @param options [Hash] Additional options for loading information
53
+ # @option options [Symbol, Array<Symbol>] :include Include additional information, using keys from OWNER_PARAMETERS
52
54
  # @return [Array<Vantaca::Models::Owner>] a list of all current and former owners for this property.
53
55
  def property_owners(assoc_code, property_id, **options)
54
56
  params = owner_parameters(assoc_code, options).merge(propertyID: property_id)
@@ -64,8 +66,9 @@ module Vantaca
64
66
  # properties in this community.
65
67
  #
66
68
  # @param assoc_code [String] the 3-4 character association code for a community
67
- # @param owner_id [Fixnum] the internal Vantaca homeowner ID
68
- # @option opts [Symbol, Array<Symbol>] :include Include additional information, using keys from OWNER_PARAMETERS
69
+ # @param owner_id [Integer] the internal Vantaca homeowner ID
70
+ # @param options [Hash] Additional options for loading information
71
+ # @option options [Symbol, Array<Symbol>] :include Include additional information, using keys from OWNER_PARAMETERS
69
72
  # @return [Vantaca::Models::Owner] the owner record for this homeowner
70
73
  def owner(assoc_code, owner_id, **options)
71
74
  params = owner_parameters(assoc_code, options).merge(Hoid: owner_id)
@@ -91,7 +94,7 @@ module Vantaca
91
94
 
92
95
  # Update the communication preferences for a homeowner.
93
96
  #
94
- # @param owner_id [Fixnum] the internal Vantaca homeowner ID
97
+ # @param owner_id [Integer] the internal Vantaca homeowner ID
95
98
  # @param communication [String] the new general communication preference, accepted values: Paper, Email, App, Text
96
99
  # @param billing [String] the internal the new billing communication preference, accepted values: Paper, Text, Email
97
100
  # @return [true]
@@ -103,14 +106,23 @@ module Vantaca
103
106
  post('/write/commPrefUpdate', params.compact)
104
107
  end
105
108
 
106
- def update_name(owner_id, first_name:, last_name:, spouse_first_name: nil, spouse_last_name: nil, business_name: nil)
109
+ # Update name fields for a homeowner. Use empty strings to clear existing values, or nil to leave them unchanged.
110
+ #
111
+ # @param owner_id [Integer] the internal Vantaca homeowner ID
112
+ # @param options [Hash] the name fields to update
113
+ # @option options [String, nil] :first_name The homeowner's first name
114
+ # @option options [String, nil] :last_name The homeowner's last name
115
+ # @option options [String, nil] :spouse_first_name The homeowner's spouse's first name
116
+ # @option options [String, nil] :spouse_last_name The homeowner's spouse's last name
117
+ # @option options [String, nil] :business_name The homeowner's business name
118
+ def update_name(owner_id, **options)
107
119
  params = {
108
120
  hoID: owner_id,
109
- firstName: first_name,
110
- lastName: last_name,
111
- spouseFirstName: spouse_first_name,
112
- spouseLastName: spouse_last_name,
113
- businessName: business_name
121
+ firstName: options[:first_name],
122
+ lastName: options[:last_name],
123
+ spouseFirstName: options[:spouse_first_name],
124
+ spouseLastName: options[:spouse_last_name],
125
+ businessName: options[:business_name]
114
126
  }
115
127
 
116
128
  post('/write/nameUpdate', params.compact)
@@ -4,5 +4,5 @@
4
4
  # All rights reserved.
5
5
 
6
6
  module Vantaca
7
- VERSION = '0.3.0'
7
+ VERSION = '0.3.1'
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vantaca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Hoffman
@@ -61,6 +61,8 @@ files:
61
61
  - lib/vantaca/errors.rb
62
62
  - lib/vantaca/ledger.rb
63
63
  - lib/vantaca/models/action_category.rb
64
+ - lib/vantaca/models/action_item.rb
65
+ - lib/vantaca/models/action_item_note.rb
64
66
  - lib/vantaca/models/action_type.rb
65
67
  - lib/vantaca/models/address.rb
66
68
  - lib/vantaca/models/base.rb