real_page 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/.ci +139 -0
  3. data/.gitignore +3 -0
  4. data/.rakeTasks +7 -0
  5. data/.rspec +3 -0
  6. data/CHANGELOG.txt +12 -0
  7. data/CODEOWNERS +1 -0
  8. data/CODE_OF_CONDUCT.md +13 -0
  9. data/Gemfile +6 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +588 -0
  12. data/Rakefile +7 -0
  13. data/bin/console +15 -0
  14. data/bin/setup +7 -0
  15. data/config/multi_xml.rb +4 -0
  16. data/lib/real_page.rb +54 -0
  17. data/lib/real_page/attribute_parser.rb +48 -0
  18. data/lib/real_page/attribute_parser/base.rb +21 -0
  19. data/lib/real_page/attribute_parser/boolean.rb +25 -0
  20. data/lib/real_page/attribute_parser/date.rb +28 -0
  21. data/lib/real_page/attribute_parser/date_time.rb +23 -0
  22. data/lib/real_page/attribute_parser/decimal.rb +15 -0
  23. data/lib/real_page/attribute_parser/integer.rb +15 -0
  24. data/lib/real_page/attribute_parser/object.rb +13 -0
  25. data/lib/real_page/attribute_parser/string.rb +13 -0
  26. data/lib/real_page/document_parser.rb +6 -0
  27. data/lib/real_page/document_parser/base.rb +51 -0
  28. data/lib/real_page/document_parser/floor_plan_object.rb +30 -0
  29. data/lib/real_page/document_parser/guest_cards.rb +102 -0
  30. data/lib/real_page/document_parser/guest_cards/amenities.rb +34 -0
  31. data/lib/real_page/document_parser/guest_cards/prospects.rb +45 -0
  32. data/lib/real_page/document_parser/leases.rb +37 -0
  33. data/lib/real_page/document_parser/picklist.rb +38 -0
  34. data/lib/real_page/document_parser/rent_matrices.rb +39 -0
  35. data/lib/real_page/document_parser/rent_matrices/options.rb +31 -0
  36. data/lib/real_page/document_parser/rent_matrices/rows.rb +30 -0
  37. data/lib/real_page/document_parser/unit_object.rb +30 -0
  38. data/lib/real_page/error/bad_request.rb +18 -0
  39. data/lib/real_page/error/base.rb +9 -0
  40. data/lib/real_page/error/invalid_configuration.rb +9 -0
  41. data/lib/real_page/error/invalid_response.rb +9 -0
  42. data/lib/real_page/error/request_fault.rb +19 -0
  43. data/lib/real_page/error/request_fault/details.rb +17 -0
  44. data/lib/real_page/model/activity.rb +39 -0
  45. data/lib/real_page/model/address.rb +17 -0
  46. data/lib/real_page/model/amenity.rb +14 -0
  47. data/lib/real_page/model/appointment.rb +23 -0
  48. data/lib/real_page/model/base.rb +63 -0
  49. data/lib/real_page/model/base/attribute.rb +56 -0
  50. data/lib/real_page/model/base/attribute_store.rb +37 -0
  51. data/lib/real_page/model/floor_plan.rb +33 -0
  52. data/lib/real_page/model/follow_up.rb +34 -0
  53. data/lib/real_page/model/guest_card.rb +49 -0
  54. data/lib/real_page/model/lease.rb +36 -0
  55. data/lib/real_page/model/lease_action.rb +32 -0
  56. data/lib/real_page/model/phone_number.rb +13 -0
  57. data/lib/real_page/model/picklist_item.rb +10 -0
  58. data/lib/real_page/model/preferences.rb +25 -0
  59. data/lib/real_page/model/prospect.rb +35 -0
  60. data/lib/real_page/model/quote.rb +56 -0
  61. data/lib/real_page/model/rent_matrix.rb +16 -0
  62. data/lib/real_page/model/rent_matrix/concessions.rb +15 -0
  63. data/lib/real_page/model/rent_matrix/option.rb +19 -0
  64. data/lib/real_page/model/rent_matrix/row.rb +18 -0
  65. data/lib/real_page/model/screening.rb +22 -0
  66. data/lib/real_page/model/unit.rb +61 -0
  67. data/lib/real_page/model/unit_shown.rb +48 -0
  68. data/lib/real_page/parameter/list_criterion.rb +14 -0
  69. data/lib/real_page/request/base.rb +89 -0
  70. data/lib/real_page/request/get_floor_plan_list.rb +45 -0
  71. data/lib/real_page/request/get_leases_by_traffic_source.rb +59 -0
  72. data/lib/real_page/request/get_marketing_sources_by_property.rb +23 -0
  73. data/lib/real_page/request/get_rent_matrix.rb +57 -0
  74. data/lib/real_page/request/get_units_by_property.rb +39 -0
  75. data/lib/real_page/request/prospect_search.rb +50 -0
  76. data/lib/real_page/request_section.rb +6 -0
  77. data/lib/real_page/request_section/auth.rb +31 -0
  78. data/lib/real_page/request_section/get_rent_matrix.rb +32 -0
  79. data/lib/real_page/request_section/list_criteria.rb +29 -0
  80. data/lib/real_page/request_section/parameter.rb +31 -0
  81. data/lib/real_page/request_section/prospect_search_criterion.rb +24 -0
  82. data/lib/real_page/utils.rb +6 -0
  83. data/lib/real_page/utils/array_fetcher.rb +35 -0
  84. data/lib/real_page/utils/configuration_validator.rb +20 -0
  85. data/lib/real_page/utils/request_fetcher.rb +30 -0
  86. data/lib/real_page/utils/request_generator.rb +52 -0
  87. data/lib/real_page/utils/snowflake_event_tracker.rb +107 -0
  88. data/lib/real_page/validator.rb +6 -0
  89. data/lib/real_page/validator/move_in_report.rb +65 -0
  90. data/lib/real_page/validator/prospects_data.rb +93 -0
  91. data/lib/real_page/validator/request_errors.rb +97 -0
  92. data/lib/real_page/validator/request_fault.rb +97 -0
  93. data/lib/real_page/version.rb +3 -0
  94. data/real_page.gemspec +32 -0
  95. metadata +291 -0
@@ -0,0 +1,35 @@
1
+ require_relative 'base'
2
+
3
+ module RealPage
4
+ module Model
5
+ # A container for a Prospect as represented by RealPage.
6
+ class Prospect < Base
7
+ object_attrs *%i[
8
+ address
9
+ phone_numbers
10
+ ]
11
+
12
+ integer_attrs *%i[
13
+ customer_id
14
+ pmc_id
15
+ site_id
16
+ ]
17
+
18
+ string_attrs *%i[
19
+ email
20
+ first_name
21
+ gender
22
+ id_issuer
23
+ id_number
24
+ id_numberencrypted
25
+ id_type
26
+ last_name
27
+ middle_name
28
+ pref_communication_type
29
+ relationship_id
30
+ ssn
31
+ ssn_encrypted
32
+ ]
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,56 @@
1
+ require_relative 'base'
2
+
3
+ module RealPage
4
+ module Model
5
+ # Object to encapsulate a Quote from a RealPage response.
6
+ class Quote < Base
7
+ boolean_attrs *%i[
8
+ available
9
+ enable_payment_plan
10
+ unit_applied
11
+ ]
12
+
13
+ date_attrs *%i[
14
+ reservation_expire_date
15
+ ]
16
+
17
+ decimal_attrs *%i[
18
+ deposit
19
+ market_rent
20
+ rent
21
+ ]
22
+
23
+ integer_attrs *%i[
24
+ floor_plan_id
25
+ id
26
+ lease_term_id
27
+ ]
28
+
29
+ string_attrs *%i[
30
+ agent_name
31
+ bldg_unit
32
+ building
33
+ context_name
34
+ date_created
35
+ date_lease_begin
36
+ date_lease_end
37
+ date_move_in
38
+ date_quote_expires
39
+ date_range_lease
40
+ floor_plan_id
41
+ floor_plan_name
42
+ id
43
+ lease_term_id
44
+ site
45
+ site_id
46
+ time_created
47
+ type
48
+ type_code
49
+ unit
50
+ unit_id
51
+ unit_reserved
52
+ unit_status
53
+ ]
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'base'
2
+
3
+ module RealPage
4
+ module Model
5
+ # Object to encapsulate a rent matrix from a RealPage response.
6
+ class RentMatrix < Base
7
+ date_attrs *%i[needed_by_date]
8
+
9
+ integer_attrs *%i[lease_term lease_term_max lease_term_min]
10
+
11
+ object_attrs *%i[rows]
12
+
13
+ string_attrs *%i[property_id]
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ require_relative '../base'
2
+
3
+ module RealPage
4
+ module Model
5
+ class RentMatrix
6
+ # Object to encapsulate a rent matrix concessions node from a RealPage
7
+ # response.
8
+ class Concessions < Base
9
+ decimal_attrs *%i[monthly_fixed monthly_percent months]
10
+
11
+ integer_attrs *%i[one_time_fixed total]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../base'
2
+
3
+ module RealPage
4
+ module Model
5
+ class RentMatrix
6
+ # Object to encapsulate a rent matrix option node from a RealPage
7
+ # response.
8
+ class Option < Base
9
+ boolean_attrs *%i[best]
10
+
11
+ date_attrs *%i[lease_end_date lease_start_date]
12
+
13
+ integer_attrs *%i[lease_term rent]
14
+
15
+ object_attrs *%i[concessions]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ require_relative '../base'
2
+
3
+ module RealPage
4
+ module Model
5
+ class RentMatrix
6
+ # Object to encapsulate a rent matrix row node from a RealPage response.
7
+ class Row < Base
8
+ date_attrs *%i[lease_end_date lease_start_date make_ready_date]
9
+
10
+ integer_attrs *%i[max_rent min_rent rent]
11
+
12
+ object_attrs *%i[options]
13
+
14
+ string_attrs *%i[building unit ys_quote_id]
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ require_relative 'base'
2
+
3
+ module RealPage
4
+ module Model
5
+ # Object to encapsulate a Screening from a RealPage response.
6
+ class Screening < Base
7
+ integer_attrs *%i[
8
+ customer_id
9
+ ]
10
+
11
+ string_attrs *%i[
12
+ apg_id
13
+ app_id
14
+ customer_name
15
+ external_screening_service
16
+ result
17
+ result_code
18
+ result_date
19
+ ]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,61 @@
1
+ require_relative 'base'
2
+
3
+ module RealPage
4
+ module Model
5
+ # A container for a unit as represented by RealPage.
6
+ class Unit < Base
7
+ boolean_attrs *%i[
8
+ available
9
+ fp_report_unit_occupancy
10
+ hearing
11
+ lock
12
+ made_ready
13
+ mobility
14
+ nonrevenue
15
+ reserve
16
+ vacant
17
+ vision
18
+ ]
19
+
20
+ date_attrs *%i[available_date made_ready_date reserved_until vacant_date]
21
+
22
+ decimal_attrs *%i[
23
+ base_rent_amount
24
+ deposit_amount
25
+ floor_plan_market_rent
26
+ market_rent
27
+ nonrefund_fee
28
+ ]
29
+
30
+ integer_attrs *%i[
31
+ building_id
32
+ floor_plan_id
33
+ gross_sqft_count
34
+ id
35
+ rent_sqft_count
36
+ property_number_id
37
+ ]
38
+
39
+ string_attrs *%i[
40
+ address_1
41
+ address_2
42
+ city_name
43
+ county_name
44
+ country_name
45
+ description
46
+ floor_number
47
+ last_action_code
48
+ last_action_desc
49
+ lock_owner
50
+ non_revenue_description
51
+ note_description
52
+ number
53
+ pmc_id
54
+ site_id
55
+ state
56
+ unavailable_code
57
+ zip
58
+ ]
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,48 @@
1
+ require_relative 'base'
2
+
3
+ module RealPage
4
+ module Model
5
+ # Object to encapsulate a UnitShown from a RealPage response.
6
+ class UnitShown < Base
7
+ boolean_attrs *%i[
8
+ unit_applied
9
+ ]
10
+
11
+ date_attrs *%i[
12
+ activity_date
13
+ create_date
14
+ unit_reserved
15
+ ]
16
+
17
+ decimal_attrs *%i[
18
+ market_rent
19
+ ]
20
+
21
+ integer_attrs *%i[
22
+ agent_id
23
+ max_create_date_time
24
+ unit_id
25
+ unit_status
26
+ ]
27
+
28
+ string_attrs *%i[
29
+ activity_id
30
+ activity_name
31
+ activity_time
32
+ agent_name
33
+ building
34
+ building_unit
35
+ edit_type_name
36
+ guest_card_journal_type_edit_id
37
+ guest_card_journal_type_id
38
+ logged_by_name
39
+ notes
40
+ result
41
+ site
42
+ site_id
43
+ status
44
+ unit_number
45
+ ]
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,14 @@
1
+ module RealPage
2
+ module Parameter
3
+ class ListCriterion
4
+ attr_reader :name, :single_value, :min_value, :max_value
5
+
6
+ def initialize(name:, single_value:, min_value: nil, max_value: nil)
7
+ @name = name
8
+ @single_value = single_value
9
+ @min_value = min_value
10
+ @max_value = max_value
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,89 @@
1
+ require 'real_page/request_section/auth'
2
+ require 'real_page/utils/request_fetcher'
3
+ require 'real_page/utils/request_generator'
4
+
5
+ module RealPage
6
+ module Request
7
+ # Base class for actions that fetch and parse specific RealPage SOAP
8
+ # actions.
9
+ #
10
+ # When subclassing this base class, you may override the following methods
11
+ # to extend functionality:
12
+ #
13
+ # * after_initialize(params) - a hook into the initializer to give
14
+ # subclasses access to the parameters passed in. If the subclass uses
15
+ # any parameters that the base class is agnostic to, this is the place
16
+ # the set these values to instance variables
17
+ # * sections (returns Array<RequestSection>) - add additional request
18
+ # sections to the request XML document. The 'auth' section will always
19
+ # be inserted into the XML document by this class, so there is no need
20
+ # to add it to the response of this method.
21
+ #
22
+ # Additionally, this base class provides the #soap_action method, which
23
+ # returns the CamelCased name of the SOAP action being requested. This
24
+ # method assumes that the subclass will be named the same as the action.
25
+ class Base
26
+ # @param params [Hash<Symbol, Object>] the parameters needed to build the
27
+ # XML request.
28
+ # @option params pmc_id [String] the unique identifier for the property
29
+ # management company in RealPage (required)
30
+ # @option params site_id [String] the unique identifier for the property
31
+ # in RealPage (required)
32
+ def initialize(params)
33
+ %i[pmc_id site_id].each do |required_param|
34
+ unless params[required_param]
35
+ raise ArgumentError, "Params must include :#{required_param}"
36
+ end
37
+ end
38
+ @pmc_id = params[:pmc_id]
39
+ @site_id = params[:site_id]
40
+ after_initialize(params)
41
+ end
42
+
43
+ # @return [RealPage::Model|Array<RealPage::Model>] the parsed response
44
+ # from RealPage
45
+ # @raise [RealPage::Error] an error when validating the response
46
+ def perform
47
+ parser.parse(xml)
48
+ end
49
+
50
+ # @return [String] the XMl response from RealPage
51
+ def xml
52
+ generator =
53
+ Utils::RequestGenerator.new(soap_action, [auth_section, *sections])
54
+ Utils::RequestFetcher.new(generator: generator).fetch
55
+ end
56
+
57
+
58
+ private
59
+
60
+ attr_reader :pmc_id, :site_id
61
+
62
+ # A hook into the initializer to give subclasses access to the parameters
63
+ # passed in. If the subclass uses any parameters that the base class is
64
+ # agnostic to, this is the place the set these values to instance
65
+ # variables
66
+ def after_initialize(params)
67
+ # No-op, this method is a call back for subclasses
68
+ end
69
+
70
+ # A hook to add additional request sections to the request XML document.
71
+ # The 'auth' section will always be inserted into the XML document by this
72
+ # class, so there is no need to add it to the response of this method.
73
+ def sections
74
+ []
75
+ end
76
+
77
+ # The CamelCased name of the SOAP action
78
+ def soap_action
79
+ self.class.name.split('::').last
80
+ end
81
+
82
+ def auth_section
83
+ RequestSection::Auth.new(pmc_id: pmc_id, site_id: site_id)
84
+ end
85
+ end
86
+
87
+ private_constant :Base
88
+ end
89
+ end
@@ -0,0 +1,45 @@
1
+ require 'real_page/document_parser/floor_plan_object'
2
+ require 'real_page/request_section/list_criteria'
3
+
4
+ require_relative 'base'
5
+
6
+ module RealPage
7
+ module Request
8
+ # Retrieve floor plan information for a specific property.
9
+ #
10
+ # Required intializer parameters:
11
+ #
12
+ # @param pmc_id [String] the unique identifier for the property management
13
+ # company in RealPage
14
+ # @param site_id [String] the unique identifier for the property in RealPage
15
+ #
16
+ # Optional initializer parameters:
17
+ #
18
+ # @param list_criteria [Array<RealPage::Parameter::ListCriterion>] the query
19
+ # criteria, see GetFloorPlanList::Name for the allowed values for
20
+ # ListCriterion#name
21
+ class GetFloorPlanList < Base
22
+ module Name
23
+ FLOOR_PLAN_CODE = 'FloorPlanCode'.freeze
24
+ FLOOR_PLAN_ID = 'FloorPlanID'.freeze
25
+ FLOOR_PLAN_NAME = 'FloorPlanName'.freeze
26
+ end
27
+
28
+ private
29
+
30
+ attr_reader :list_criteria
31
+
32
+ def after_initialize(params)
33
+ @list_criteria = params[:list_criteria] || []
34
+ end
35
+
36
+ def sections
37
+ [RequestSection::ListCriteria.new(list_criteria: list_criteria)]
38
+ end
39
+
40
+ def parser
41
+ DocumentParser::FloorPlanObject.new
42
+ end
43
+ end
44
+ end
45
+ end