amsi 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.ci +7 -0
  3. data/.gitignore +3 -0
  4. data/.rubocop.yml +7 -0
  5. data/.rubocop_todo.yml +340 -0
  6. data/CHANGELOG.txt +1 -0
  7. data/Gemfile +8 -1
  8. data/README.md +1 -1
  9. data/Rakefile +1 -1
  10. data/lib/amsi/attribute_parser/base.rb +3 -2
  11. data/lib/amsi/attribute_parser/boolean.rb +1 -0
  12. data/lib/amsi/attribute_parser/date.rb +2 -1
  13. data/lib/amsi/attribute_parser/date_time.rb +7 -1
  14. data/lib/amsi/attribute_parser.rb +5 -3
  15. data/lib/amsi/document_parser/base.rb +4 -3
  16. data/lib/amsi/document_parser/get_moveins.rb +2 -0
  17. data/lib/amsi/document_parser/leases.rb +3 -1
  18. data/lib/amsi/document_parser/properties.rb +4 -0
  19. data/lib/amsi/model/address.rb +10 -10
  20. data/lib/amsi/model/base/attribute.rb +1 -3
  21. data/lib/amsi/model/base.rb +3 -2
  22. data/lib/amsi/model/guest_card.rb +1 -1
  23. data/lib/amsi/model/guest_card_result.rb +6 -6
  24. data/lib/amsi/model/lease.rb +31 -33
  25. data/lib/amsi/model/leasing_agent.rb +8 -8
  26. data/lib/amsi/model/manager.rb +8 -8
  27. data/lib/amsi/model/marketing_source.rb +8 -8
  28. data/lib/amsi/model/occupant.rb +21 -21
  29. data/lib/amsi/model/property.rb +19 -19
  30. data/lib/amsi/model/unit_type.rb +27 -27
  31. data/lib/amsi/parameter/prospect.rb +2 -3
  32. data/lib/amsi/request/add_guest_card.rb +1 -4
  33. data/lib/amsi/request/get_property_residents.rb +1 -1
  34. data/lib/amsi/request_section/add_guest_card.rb +6 -7
  35. data/lib/amsi/request_section/property_list_filter.rb +5 -5
  36. data/lib/amsi/utils/snowflake_event_tracker.rb +18 -27
  37. data/lib/amsi/validator/base.rb +2 -2
  38. data/lib/amsi/validator/prospect_event_validator.rb +2 -5
  39. data/lib/amsi/validator/request_errors.rb +2 -1
  40. data/lib/amsi/validator/request_fault.rb +4 -0
  41. data/lib/amsi/validator/resident_event_validator.rb +2 -5
  42. data/lib/amsi/version.rb +1 -1
  43. data/lib/amsi.rb +1 -1
  44. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: beca1ea33e01cd5f15966401b03023ed05e1435d6ca8240380a5007970d274ac
4
- data.tar.gz: e2ada1c1cb36033169bae701676efb3bac43ab3686752619dbec4db008dc2070
3
+ metadata.gz: 11c1b8708790808255b03c2cb90034877388a8e0d8f789ff94f0c253c9130018
4
+ data.tar.gz: 38372c491deb97fef4c8c651560e6438d452d053a8c0ab7165376f2c9a3cec5a
5
5
  SHA512:
6
- metadata.gz: 89fda03b62a9b2d7dfcb7066b985286f47dec11da69d384c38346069a61c8022bc4f4323167c843438a61f540cb6a4d0f58ea068aae54e76466233539f80564d
7
- data.tar.gz: 0c37beaaf6996a7a3a54540f6de820da33e79a5fbf65d8518c8a6f67ba230246895b33179b6bedfd0d5cbbf6009999a0bf71fdeb2cd189860db5bf68f81f3667
6
+ metadata.gz: 3e83a6e13092883cf1a4c37bcf9829c31f045b439f1194135e273a164de025f984ee38719c9effee44607020ebcdc0e8524f66ef4ea652626322c03dd6171f6f
7
+ data.tar.gz: 63bf360eb40a413acfe1518df5cbcb76b5ef4c1c529e6f46f8f5a2e03c6216c432e5c268238001c5bac616e8d18f2214815d25a20c39a72d39e75a82cf63b3a0
data/.ci CHANGED
@@ -109,6 +109,13 @@ spec:
109
109
  } //container
110
110
  } //steps
111
111
  } //stage
112
+ stage('Rubocop') {
113
+ steps {
114
+ container('ruby') {
115
+ sh label: 'rubocop', script: 'bundle exec rubocop -P -c .rubocop.yml'
116
+ } //container
117
+ } //steps
118
+ } //stage
112
119
  } //parallel
113
120
  } //stage
114
121
  } // stages
data/.gitignore CHANGED
@@ -1,2 +1,5 @@
1
1
  /Gemfile.lock
2
2
  amsi-*.gem
3
+
4
+ # Rubocop cache files
5
+ .rubocop-http*
data/.rubocop.yml ADDED
@@ -0,0 +1,7 @@
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-rails
4
+
5
+ inherit_from:
6
+ - https://raw.githubusercontent.com/apartmentlist/style/rubocop-2022/ruby/global.yml
7
+ - .rubocop_todo.yml
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,340 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config --exclude-limit 100`
3
+ # on 2022-01-18 21:04:48 UTC using RuboCop version 1.25.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ # Configuration parameters: AllowedMethods.
11
+ # AllowedMethods: enums
12
+ Lint/ConstantDefinitionInBlock:
13
+ Exclude:
14
+ - 'spec/amsi/utils/request_generator_spec.rb'
15
+
16
+ # Offense count: 2
17
+ # Configuration parameters: AllowComments, AllowEmptyLambdas.
18
+ Lint/EmptyBlock:
19
+ Exclude:
20
+ - 'spec/amsi/utils/snowflake_event_tracker_spec.rb'
21
+
22
+ # Offense count: 2
23
+ Lint/MissingSuper:
24
+ Exclude:
25
+ - 'lib/amsi/validator/prospect_event_validator.rb'
26
+ - 'lib/amsi/validator/resident_event_validator.rb'
27
+
28
+ # Offense count: 1
29
+ # Cop supports --auto-correct.
30
+ Lint/NonDeterministicRequireOrder:
31
+ Exclude:
32
+ - 'spec/spec_helper.rb'
33
+
34
+ # Offense count: 3
35
+ Lint/UselessAssignment:
36
+ Exclude:
37
+ - 'lib/amsi/document_parser/base.rb'
38
+ - 'spec/amsi/document_parser/leases_spec.rb'
39
+
40
+ # Offense count: 2
41
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
42
+ # IgnoredMethods: refine
43
+ Metrics/BlockLength:
44
+ Max: 62
45
+
46
+ # Offense count: 5
47
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
48
+ Metrics/ParameterLists:
49
+ Max: 14
50
+
51
+ # Offense count: 1
52
+ # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
53
+ # NamePrefix: is_, has_, have_
54
+ # ForbiddenPrefixes: is_, has_, have_
55
+ # AllowedMethods: is_a?
56
+ # MethodDefinitionMacros: define_method, define_singleton_method
57
+ Naming/PredicateName:
58
+ Exclude:
59
+ - 'lib/amsi/validator/base.rb'
60
+
61
+ # Offense count: 13
62
+ # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
63
+ # SupportedStyles: snake_case, normalcase, non_integer
64
+ # AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
65
+ Naming/VariableNumber:
66
+ Exclude:
67
+ - 'lib/amsi/model/address.rb'
68
+ - 'lib/amsi/model/occupant.rb'
69
+ - 'lib/amsi/model/property.rb'
70
+ - 'spec/amsi/model/property_spec.rb'
71
+
72
+ # Offense count: 5
73
+ # Configuration parameters: Prefixes.
74
+ # Prefixes: when, with, without
75
+ RSpec/ContextWording:
76
+ Exclude:
77
+ - 'spec/amsi/document_parser/leases_spec.rb'
78
+ - 'spec/amsi/document_parser/properties_spec.rb'
79
+ - 'spec/amsi/request_section/property_list_filter_spec.rb'
80
+
81
+ # Offense count: 74
82
+ # Cop supports --auto-correct.
83
+ # Configuration parameters: SkipBlocks, EnforcedStyle.
84
+ # SupportedStyles: described_class, explicit
85
+ RSpec/DescribedClass:
86
+ Exclude:
87
+ - 'spec/amsi/attribute_parser/boolean_spec.rb'
88
+ - 'spec/amsi/attribute_parser/date_spec.rb'
89
+ - 'spec/amsi/attribute_parser/date_time_spec.rb'
90
+ - 'spec/amsi/attribute_parser/decimal_spec.rb'
91
+ - 'spec/amsi/attribute_parser/integer_spec.rb'
92
+ - 'spec/amsi/attribute_parser/string_spec.rb'
93
+ - 'spec/amsi/attribute_parser_spec.rb'
94
+ - 'spec/amsi/model/guest_card_result_spec.rb'
95
+ - 'spec/amsi/model/guest_card_spec.rb'
96
+ - 'spec/amsi/model/lease_spec.rb'
97
+ - 'spec/amsi/model/leasing_agent_spec.rb'
98
+ - 'spec/amsi/model/marketing_source_spec.rb'
99
+ - 'spec/amsi/model/occupant_spec.rb'
100
+ - 'spec/amsi/model/property_spec.rb'
101
+ - 'spec/amsi/model/unit_type_spec.rb'
102
+ - 'spec/amsi/request_section/add_guest_card_spec.rb'
103
+ - 'spec/amsi/request_section/auth_spec.rb'
104
+ - 'spec/amsi/request_section/moveins_filter_spec.rb'
105
+ - 'spec/amsi/request_section/property_list_filter_spec.rb'
106
+ - 'spec/amsi/request_section/property_resident_filter_spec.rb'
107
+ - 'spec/amsi/utils/request_fetcher_spec.rb'
108
+ - 'spec/amsi/utils/request_generator_spec.rb'
109
+ - 'spec/amsi/utils/snowflake_event_tracker_spec.rb'
110
+ - 'spec/amsi/validator/request_errors_spec.rb'
111
+ - 'spec/amsi/validator/request_fault_spec.rb'
112
+ - 'spec/integration/add_guest_card_spec.rb'
113
+ - 'spec/integration/get_moveins_by_first_marketing_source_spec.rb'
114
+ - 'spec/integration/get_property_list_spec.rb'
115
+ - 'spec/integration/get_property_residents_spec.rb'
116
+
117
+ # Offense count: 4
118
+ # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
119
+ # Include: **/*_spec*rb*, **/spec/**/*
120
+ RSpec/FilePath:
121
+ Exclude:
122
+ - 'spec/integration/add_guest_card_spec.rb'
123
+ - 'spec/integration/get_moveins_by_first_marketing_source_spec.rb'
124
+ - 'spec/integration/get_property_list_spec.rb'
125
+ - 'spec/integration/get_property_residents_spec.rb'
126
+
127
+ # Offense count: 10
128
+ RSpec/IteratedExpectation:
129
+ Exclude:
130
+ - 'spec/amsi/document_parser/get_moveins_spec.rb'
131
+ - 'spec/amsi/document_parser/leases_spec.rb'
132
+ - 'spec/amsi/document_parser/properties_spec.rb'
133
+ - 'spec/integration/get_moveins_by_first_marketing_source_spec.rb'
134
+ - 'spec/integration/get_property_residents_spec.rb'
135
+
136
+ # Offense count: 2
137
+ RSpec/LeakyConstantDeclaration:
138
+ Exclude:
139
+ - 'spec/amsi/utils/request_generator_spec.rb'
140
+
141
+ # Offense count: 1
142
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
143
+ RSpec/VerifiedDoubles:
144
+ Exclude:
145
+ - 'spec/amsi/attribute_parser_spec.rb'
146
+
147
+ # Offense count: 2
148
+ # Configuration parameters: EnforcedStyle, AllowToTime.
149
+ # SupportedStyles: strict, flexible
150
+ Rails/Date:
151
+ Exclude:
152
+ - 'lib/amsi/request_section/add_guest_card.rb'
153
+
154
+ # Offense count: 1
155
+ # Cop supports --auto-correct.
156
+ Style/CaseLikeIf:
157
+ Exclude:
158
+ - 'lib/amsi/validator/base.rb'
159
+
160
+ # Offense count: 48
161
+ # Configuration parameters: AllowedConstants.
162
+ Style/Documentation:
163
+ Exclude:
164
+ - 'lib/amsi.rb'
165
+ - 'lib/amsi/model/guest_card.rb'
166
+ - 'lib/amsi/model/guest_card_result.rb'
167
+ - 'lib/amsi/model/lease.rb'
168
+ - 'lib/amsi/model/leasing_agent.rb'
169
+ - 'lib/amsi/model/marketing_source.rb'
170
+ - 'lib/amsi/model/occupant.rb'
171
+ - 'lib/amsi/model/property.rb'
172
+ - 'lib/amsi/model/unit_type.rb'
173
+ - 'lib/amsi/parameter/prospect.rb'
174
+ - 'lib/amsi/utils/snowflake_event_tracker.rb'
175
+ - 'lib/amsi/validator/base.rb'
176
+ - 'lib/amsi/validator/prospect_event_validator.rb'
177
+ - 'lib/amsi/validator/request_errors.rb'
178
+ - 'lib/amsi/validator/resident_event_validator.rb'
179
+ - 'spec/amsi/attribute_parser/boolean_spec.rb'
180
+ - 'spec/amsi/attribute_parser/date_spec.rb'
181
+ - 'spec/amsi/attribute_parser/date_time_spec.rb'
182
+ - 'spec/amsi/attribute_parser/decimal_spec.rb'
183
+ - 'spec/amsi/attribute_parser/integer_spec.rb'
184
+ - 'spec/amsi/attribute_parser/string_spec.rb'
185
+ - 'spec/amsi/attribute_parser_spec.rb'
186
+ - 'spec/amsi/document_parser/get_moveins_spec.rb'
187
+ - 'spec/amsi/document_parser/leases_spec.rb'
188
+ - 'spec/amsi/document_parser/properties_spec.rb'
189
+ - 'spec/amsi/model/address_spec.rb'
190
+ - 'spec/amsi/model/guest_card_result_spec.rb'
191
+ - 'spec/amsi/model/guest_card_spec.rb'
192
+ - 'spec/amsi/model/lease_spec.rb'
193
+ - 'spec/amsi/model/leasing_agent_spec.rb'
194
+ - 'spec/amsi/model/manager_spec.rb'
195
+ - 'spec/amsi/model/marketing_source_spec.rb'
196
+ - 'spec/amsi/model/occupant_spec.rb'
197
+ - 'spec/amsi/model/property_spec.rb'
198
+ - 'spec/amsi/model/unit_type_spec.rb'
199
+ - 'spec/amsi/request_section/add_guest_card_spec.rb'
200
+ - 'spec/amsi/request_section/auth_spec.rb'
201
+ - 'spec/amsi/request_section/moveins_filter_spec.rb'
202
+ - 'spec/amsi/request_section/property_list_filter_spec.rb'
203
+ - 'spec/amsi/request_section/property_resident_filter_spec.rb'
204
+ - 'spec/amsi/utils/request_fetcher_spec.rb'
205
+ - 'spec/amsi/utils/request_generator_spec.rb'
206
+ - 'spec/amsi/utils/snowflake_event_tracker_spec.rb'
207
+ - 'spec/amsi/validator/request_errors_spec.rb'
208
+ - 'spec/amsi/validator/request_fault_spec.rb'
209
+ - 'spec/support/helpers/date_time_helper.rb'
210
+
211
+ # Offense count: 97
212
+ # Cop supports --auto-correct.
213
+ # Configuration parameters: EnforcedStyle.
214
+ # SupportedStyles: always, always_true, never
215
+ Style/FrozenStringLiteralComment:
216
+ Exclude:
217
+ - 'Gemfile'
218
+ - 'Rakefile'
219
+ - 'bin/console'
220
+ - 'config/multi_xml.rb'
221
+ - 'lib/amsi.rb'
222
+ - 'lib/amsi/attribute_parser.rb'
223
+ - 'lib/amsi/attribute_parser/base.rb'
224
+ - 'lib/amsi/attribute_parser/boolean.rb'
225
+ - 'lib/amsi/attribute_parser/date.rb'
226
+ - 'lib/amsi/attribute_parser/date_time.rb'
227
+ - 'lib/amsi/attribute_parser/decimal.rb'
228
+ - 'lib/amsi/attribute_parser/integer.rb'
229
+ - 'lib/amsi/attribute_parser/string.rb'
230
+ - 'lib/amsi/document_parser/base.rb'
231
+ - 'lib/amsi/document_parser/get_moveins.rb'
232
+ - 'lib/amsi/document_parser/guest_card_result.rb'
233
+ - 'lib/amsi/document_parser/leases.rb'
234
+ - 'lib/amsi/document_parser/properties.rb'
235
+ - 'lib/amsi/error/bad_request.rb'
236
+ - 'lib/amsi/error/base.rb'
237
+ - 'lib/amsi/error/invalid_response.rb'
238
+ - 'lib/amsi/error/request_fault.rb'
239
+ - 'lib/amsi/error/request_timeout.rb'
240
+ - 'lib/amsi/error/unparsable_response.rb'
241
+ - 'lib/amsi/model/address.rb'
242
+ - 'lib/amsi/model/base.rb'
243
+ - 'lib/amsi/model/base/attribute.rb'
244
+ - 'lib/amsi/model/base/attribute_store.rb'
245
+ - 'lib/amsi/model/guest_card.rb'
246
+ - 'lib/amsi/model/guest_card_result.rb'
247
+ - 'lib/amsi/model/lease.rb'
248
+ - 'lib/amsi/model/leasing_agent.rb'
249
+ - 'lib/amsi/model/manager.rb'
250
+ - 'lib/amsi/model/marketing_source.rb'
251
+ - 'lib/amsi/model/occupant.rb'
252
+ - 'lib/amsi/model/property.rb'
253
+ - 'lib/amsi/model/unit_type.rb'
254
+ - 'lib/amsi/parameter/contact_type.rb'
255
+ - 'lib/amsi/parameter/prospect.rb'
256
+ - 'lib/amsi/request/add_guest_card.rb'
257
+ - 'lib/amsi/request/base.rb'
258
+ - 'lib/amsi/request/get_moveins_by_first_marketing_source.rb'
259
+ - 'lib/amsi/request/get_property_list.rb'
260
+ - 'lib/amsi/request/get_property_residents.rb'
261
+ - 'lib/amsi/request_section/add_guest_card.rb'
262
+ - 'lib/amsi/request_section/auth.rb'
263
+ - 'lib/amsi/request_section/moveins_filter.rb'
264
+ - 'lib/amsi/request_section/property_list_filter.rb'
265
+ - 'lib/amsi/request_section/property_resident_filter.rb'
266
+ - 'lib/amsi/utils/request_fetcher.rb'
267
+ - 'lib/amsi/utils/request_generator.rb'
268
+ - 'lib/amsi/utils/snowflake_event_tracker.rb'
269
+ - 'lib/amsi/validator.rb'
270
+ - 'lib/amsi/validator/base.rb'
271
+ - 'lib/amsi/validator/prospect_event_validator.rb'
272
+ - 'lib/amsi/validator/request_errors.rb'
273
+ - 'lib/amsi/validator/request_fault.rb'
274
+ - 'lib/amsi/validator/resident_event_validator.rb'
275
+ - 'lib/amsi/version.rb'
276
+ - 'spec/amsi/attribute_parser/boolean_spec.rb'
277
+ - 'spec/amsi/attribute_parser/date_spec.rb'
278
+ - 'spec/amsi/attribute_parser/date_time_spec.rb'
279
+ - 'spec/amsi/attribute_parser/decimal_spec.rb'
280
+ - 'spec/amsi/attribute_parser/integer_spec.rb'
281
+ - 'spec/amsi/attribute_parser/string_spec.rb'
282
+ - 'spec/amsi/attribute_parser_spec.rb'
283
+ - 'spec/amsi/document_parser/get_moveins_spec.rb'
284
+ - 'spec/amsi/document_parser/leases_spec.rb'
285
+ - 'spec/amsi/document_parser/properties_spec.rb'
286
+ - 'spec/amsi/model/address_spec.rb'
287
+ - 'spec/amsi/model/guest_card_result_spec.rb'
288
+ - 'spec/amsi/model/guest_card_spec.rb'
289
+ - 'spec/amsi/model/lease_spec.rb'
290
+ - 'spec/amsi/model/leasing_agent_spec.rb'
291
+ - 'spec/amsi/model/manager_spec.rb'
292
+ - 'spec/amsi/model/marketing_source_spec.rb'
293
+ - 'spec/amsi/model/occupant_spec.rb'
294
+ - 'spec/amsi/model/property_spec.rb'
295
+ - 'spec/amsi/model/unit_type_spec.rb'
296
+ - 'spec/amsi/request_section/add_guest_card_spec.rb'
297
+ - 'spec/amsi/request_section/auth_spec.rb'
298
+ - 'spec/amsi/request_section/moveins_filter_spec.rb'
299
+ - 'spec/amsi/request_section/property_list_filter_spec.rb'
300
+ - 'spec/amsi/request_section/property_resident_filter_spec.rb'
301
+ - 'spec/amsi/utils/request_fetcher_spec.rb'
302
+ - 'spec/amsi/utils/request_generator_spec.rb'
303
+ - 'spec/amsi/utils/snowflake_event_tracker_spec.rb'
304
+ - 'spec/amsi/validator/request_errors_spec.rb'
305
+ - 'spec/amsi/validator/request_fault_spec.rb'
306
+ - 'spec/amsi_spec.rb'
307
+ - 'spec/integration/add_guest_card_spec.rb'
308
+ - 'spec/integration/get_moveins_by_first_marketing_source_spec.rb'
309
+ - 'spec/integration/get_property_list_spec.rb'
310
+ - 'spec/integration/get_property_residents_spec.rb'
311
+ - 'spec/spec_helper.rb'
312
+ - 'spec/support/helpers/date_time_helper.rb'
313
+ - 'spec/support/shared_examples/model.rb'
314
+
315
+ # Offense count: 4
316
+ # Cop supports --auto-correct.
317
+ # Configuration parameters: EnforcedStyle.
318
+ # SupportedStyles: literals, strict
319
+ Style/MutableConstant:
320
+ Exclude:
321
+ - 'lib/amsi/request_section/add_guest_card.rb'
322
+ - 'lib/amsi/utils/snowflake_event_tracker.rb'
323
+ - 'lib/amsi/version.rb'
324
+
325
+ # Offense count: 3
326
+ # Cop supports --auto-correct.
327
+ # Configuration parameters: AllowMethodsWithArguments, IgnoredMethods.
328
+ # IgnoredMethods: respond_to, define_method
329
+ Style/SymbolProc:
330
+ Exclude:
331
+ - 'lib/amsi/attribute_parser/date_time.rb'
332
+ - 'spec/amsi/model/lease_spec.rb'
333
+ - 'spec/integration/get_property_residents_spec.rb'
334
+
335
+ # Offense count: 7
336
+ # Cop supports --auto-correct.
337
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
338
+ # URISchemes: http, https
339
+ Layout/LineLength:
340
+ Max: 2096
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,4 @@
1
+ * 1.1.0 Update GetPropertyResidents request to allow timezone as one of the extra config parameters to return datetimes in the given timezone
1
2
  * 1.0.1 Set the service on snowflake events
2
3
  * 1.0.0 Add eventing gem and track import_pms_resident and import_pms_prospect events for each occupant on GetPropertyResidents
3
4
  * 0.12.0 Add lead_source_code, lead_date and lead_id to Model::Lease
data/Gemfile CHANGED
@@ -3,4 +3,11 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in amsi.gemspec
4
4
  gemspec
5
5
 
6
- gem 'event_tracker', git: 'https://github.com/apartmentlist/eventing.git', glob: 'clients/ruby/event_tracker.gemspec', tag: 'rb1.35.0'
6
+ gem 'event_tracker', git: 'https://github.com/apartmentlist/eventing.git', glob: 'clients/ruby/event_tracker.gemspec',
7
+ tag: 'rb1.35.0'
8
+
9
+ gem 'rubocop', '~> 1.25', group: :development
10
+
11
+ gem 'rubocop-rspec', '~> 2.7', group: :development
12
+
13
+ gem 'rubocop-rails', '~> 2.13', group: :development
data/README.md CHANGED
@@ -115,7 +115,7 @@ Required initializer parameters:
115
115
  * `portfolio_name` [String] the unique identifier for the property in Amsi
116
116
  * `property_id` [String] Amsi property id
117
117
  * `web_service_url` [String] Amsi Url to the leasing.asmx resource
118
- * `params` [Hash] extra configuration fields: `:start_date` [String], `:end_date` [String], `:remote_id` [String], `:billing_config` [BillingConfiguration], `:import_id` [String] and `:pmc_id` [String], `:app_name` [String]
118
+ * `params` [Hash] extra configuration fields: `:start_date` [String], `:end_date` [String], `:remote_id` [String], `:billing_config` [BillingConfiguration], `:import_id` [String], `:pmc_id` [String], `:app_name` [String], `:timezone` [String]
119
119
 
120
120
  Optional initializer parameters and default values:
121
121
  * `lease_status` [String] Lease status filter; defaults to current leases ("C"). Valid values: (A)pplicant, (C)urrent, (I)ntent to Transfer, (L)eased, (N)otice, (P)revious, (T)ransfer, (V)approved, (X)cancelled
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -5,8 +5,9 @@ module Amsi
5
5
  # Base class for attribute parsers.
6
6
  class Base
7
7
  # @param value [String] the response value from AMSI
8
- def initialize(value)
8
+ def initialize(value, timezone = nil)
9
9
  @value = value
10
+ @timezone = timezone
10
11
  end
11
12
 
12
13
  # @return [Object] the parsed attribute value
@@ -17,7 +18,7 @@ module Amsi
17
18
 
18
19
  private
19
20
 
20
- attr_reader :value
21
+ attr_reader :value, :timezone
21
22
  end
22
23
  end
23
24
  end
@@ -18,6 +18,7 @@ module Amsi
18
18
  def parse
19
19
  return true if TRUE_VALUES.include?(value)
20
20
  return false if FALSE_VALUES.include?(value)
21
+
21
22
  raise Error::InvalidResponse, "Invalid boolean response value: #{value}"
22
23
  end
23
24
  end
@@ -12,7 +12,8 @@ module Amsi
12
12
  # @return [Date] the parsed attribute value
13
13
  def parse
14
14
  return if value == ''
15
- if value =~ %r[/]
15
+
16
+ if value =~ %r{/}
16
17
  ::Date.strptime(value, FORMAT)
17
18
  else
18
19
  # AMSI sometimes returns 0001-01-01 for dates, which appears to be
@@ -13,8 +13,14 @@ module Amsi
13
13
  # @return [Date] the parsed attribute value
14
14
  def parse
15
15
  return if value == ''
16
+
16
17
  date_time = ::DateTime.parse(value)
17
- TIME_ZONE.local_to_utc(date_time) { |periods| periods.last }
18
+ if timezone.nil?
19
+ TIME_ZONE.local_to_utc(date_time, &:last)
20
+ else
21
+ time_zone = TZInfo::Timezone.get(timezone)
22
+ time_zone.local_to_utc(date_time, &:last)
23
+ end
18
24
  rescue ArgumentError
19
25
  raise Error::InvalidResponse,
20
26
  "Invalid date/time response value: #{value}"
@@ -10,21 +10,23 @@ module Amsi
10
10
  class AttributeParser
11
11
  # @param value [String] the response value from AMSI
12
12
  # @param type [Symbol] the attribute's configured data type
13
- def initialize(value:, type:)
13
+ def initialize(value:, type:, timezone: nil)
14
14
  @value = value
15
15
  @type = type
16
+ @timezone = timezone
16
17
  end
17
18
 
18
19
  # @return [Object] the parsed attribute value
19
20
  def parse
20
21
  return unless value
22
+
21
23
  case type
22
24
  when :boolean
23
25
  AttributeParser::Boolean.new(value).parse
24
26
  when :date
25
27
  AttributeParser::Date.new(value).parse
26
28
  when :date_time
27
- AttributeParser::DateTime.new(value).parse
29
+ AttributeParser::DateTime.new(value, timezone).parse
28
30
  when :decimal
29
31
  AttributeParser::Decimal.new(value).parse
30
32
  when :integer
@@ -38,7 +40,7 @@ module Amsi
38
40
 
39
41
  private
40
42
 
41
- attr_reader :value, :type
43
+ attr_reader :value, :type, :timezone
42
44
  end
43
45
 
44
46
  private_constant :AttributeParser
@@ -19,7 +19,7 @@ module Amsi
19
19
  begin
20
20
  parsed_response = MultiXml.parse(xml)
21
21
  rescue MultiXml::ParseError => e
22
- raise Amsi::Error::UnparsableResponse.new(xml)
22
+ raise Amsi::Error::UnparsableResponse, xml
23
23
  end
24
24
 
25
25
  validate_response!(parsed_response)
@@ -39,13 +39,14 @@ module Amsi
39
39
  # into a Hash
40
40
  # @return [Object] the parsed object(s) from the response
41
41
  # @raise [Amsi::Error::Base] if the response is invalid
42
- def parse_body(body)
42
+ def parse_body(_body)
43
43
  raise NotImplementedError,
44
44
  "#{self.class.name} must implement #{__method__}"
45
45
  end
46
46
 
47
47
  def validator_classes
48
- [Validator::RequestErrors, Validator::RequestFault, Validator::ResidentEventValidator, Validator::ProspectEventValidator]
48
+ [Validator::RequestErrors, Validator::RequestFault, Validator::ResidentEventValidator,
49
+ Validator::ProspectEventValidator]
49
50
  end
50
51
  end
51
52
  end
@@ -31,6 +31,7 @@ module Amsi
31
31
  leases = parsed_result['Leases']['Lease']
32
32
 
33
33
  return [] if leases.nil?
34
+
34
35
  leases.is_a?(Array) ? leases : [leases]
35
36
  end
36
37
 
@@ -44,6 +45,7 @@ module Amsi
44
45
  occupants = lease_hash['Occupant']
45
46
 
46
47
  return [] if occupants.nil?
48
+
47
49
  occupants.is_a?(Array) ? occupants : [occupants]
48
50
  end
49
51
 
@@ -15,7 +15,7 @@ module Amsi
15
15
  # @raise [Amsi::Error::Base] if the response is invalid
16
16
  def parse_body(body)
17
17
  lease_hashes(body).map do |lease_hash|
18
- lease = Model::Lease.new(lease_hash)
18
+ lease = Model::Lease.new(lease_hash, @params[:timezone])
19
19
  lease.occupants = occupant_hashes(lease_hash).map do |occupant_hash|
20
20
  Model::Occupant.new(occupant_hash)
21
21
  end
@@ -32,6 +32,7 @@ module Amsi
32
32
  leases = parsed_result['PropertyResidents']['Lease']
33
33
 
34
34
  return [] if leases.nil?
35
+
35
36
  leases.is_a?(Array) ? leases : [leases]
36
37
  end
37
38
 
@@ -39,6 +40,7 @@ module Amsi
39
40
  occupants = lease_hash['Occupant']
40
41
 
41
42
  return [] if occupants.nil?
43
+
42
44
  occupants.is_a?(Array) ? occupants : [occupants]
43
45
  end
44
46
  end
@@ -65,6 +65,7 @@ module Amsi
65
65
  def leasing_agents(property_hash)
66
66
  agent_hashes = property_hash['LeasingAgent']
67
67
  return [] if agent_hashes.nil?
68
+
68
69
  agent_hashes = [agent_hashes] unless agent_hashes.is_a?(Array)
69
70
  agent_hashes.map do |agent_hash|
70
71
  Model::LeasingAgent.new(agent_hash)
@@ -74,6 +75,7 @@ module Amsi
74
75
  def marketing_sources(property_hash)
75
76
  source_hashes = property_hash['MarketingSource']
76
77
  return [] if source_hashes.nil?
78
+
77
79
  source_hashes = [source_hashes] unless source_hashes.is_a?(Array)
78
80
  source_hashes.map do |source_hash|
79
81
  Model::MarketingSource.new(source_hash)
@@ -83,6 +85,7 @@ module Amsi
83
85
  def unit_types(property_hash)
84
86
  type_hashes = property_hash['UnitType']
85
87
  return [] if type_hashes.nil?
88
+
86
89
  type_hashes = [type_hashes] unless type_hashes.is_a?(Array)
87
90
  type_hashes.map do |type_hash|
88
91
  Model::UnitType.new(type_hash)
@@ -96,6 +99,7 @@ module Amsi
96
99
  properties = parsed_result['Properties']['Property']
97
100
 
98
101
  return [] if properties.nil?
102
+
99
103
  properties.is_a?(Array) ? properties : [properties]
100
104
  end
101
105
  end
@@ -3,16 +3,16 @@ require_relative 'base'
3
3
  module Amsi
4
4
  module Model
5
5
  class Address < Base
6
- string_attrs *%i[
7
- line_1
8
- line_2
9
- line_3
10
- line_4
11
- city
12
- state
13
- zip_code
14
- country
15
- ]
6
+ string_attrs(*%i[
7
+ line_1
8
+ line_2
9
+ line_3
10
+ line_4
11
+ city
12
+ state
13
+ zip_code
14
+ country
15
+ ])
16
16
  end
17
17
  end
18
18
  end
@@ -52,9 +52,7 @@ module Amsi
52
52
  prefixed_name.gsub(/id$/, 'ID')]
53
53
  names.concat(big_id_names)
54
54
  end
55
- if type == :boolean
56
- names.concat(["#{squished_name}flag", "#{squished_name}bit"])
57
- end
55
+ names.concat(["#{squished_name}flag", "#{squished_name}bit"]) if type == :boolean
58
56
  names
59
57
  end
60
58
  end