amsi 1.0.1 → 1.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.
- checksums.yaml +4 -4
- data/.ci +7 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +7 -0
- data/.rubocop_todo.yml +340 -0
- data/CHANGELOG.txt +1 -0
- data/Gemfile +8 -1
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/amsi/attribute_parser/base.rb +3 -2
- data/lib/amsi/attribute_parser/boolean.rb +1 -0
- data/lib/amsi/attribute_parser/date.rb +2 -1
- data/lib/amsi/attribute_parser/date_time.rb +7 -1
- data/lib/amsi/attribute_parser.rb +5 -3
- data/lib/amsi/document_parser/base.rb +4 -3
- data/lib/amsi/document_parser/get_moveins.rb +2 -0
- data/lib/amsi/document_parser/leases.rb +3 -1
- data/lib/amsi/document_parser/properties.rb +4 -0
- data/lib/amsi/model/address.rb +10 -10
- data/lib/amsi/model/base/attribute.rb +1 -3
- data/lib/amsi/model/base.rb +3 -2
- data/lib/amsi/model/guest_card.rb +1 -1
- data/lib/amsi/model/guest_card_result.rb +6 -6
- data/lib/amsi/model/lease.rb +31 -33
- data/lib/amsi/model/leasing_agent.rb +8 -8
- data/lib/amsi/model/manager.rb +8 -8
- data/lib/amsi/model/marketing_source.rb +8 -8
- data/lib/amsi/model/occupant.rb +21 -21
- data/lib/amsi/model/property.rb +19 -19
- data/lib/amsi/model/unit_type.rb +27 -27
- data/lib/amsi/parameter/prospect.rb +2 -3
- data/lib/amsi/request/add_guest_card.rb +1 -4
- data/lib/amsi/request/get_property_residents.rb +1 -1
- data/lib/amsi/request_section/add_guest_card.rb +6 -7
- data/lib/amsi/request_section/property_list_filter.rb +5 -5
- data/lib/amsi/utils/snowflake_event_tracker.rb +18 -27
- data/lib/amsi/validator/base.rb +2 -2
- data/lib/amsi/validator/prospect_event_validator.rb +2 -5
- data/lib/amsi/validator/request_errors.rb +2 -1
- data/lib/amsi/validator/request_fault.rb +4 -0
- data/lib/amsi/validator/resident_event_validator.rb +2 -5
- data/lib/amsi/version.rb +1 -1
- data/lib/amsi.rb +1 -1
- metadata +4 -2
    
        data/lib/amsi/model/base.rb
    CHANGED
    
    | @@ -49,11 +49,12 @@ module Amsi | |
| 49 49 | 
             
                  #
         | 
| 50 50 | 
             
                  # @param attrs [Hash<String, Object>] the response hash from AMSI.
         | 
| 51 51 | 
             
                  #   Attribute keys are case insensitive.
         | 
| 52 | 
            -
                  def initialize(attrs = {})
         | 
| 52 | 
            +
                  def initialize(attrs = {}, timezone = nil)
         | 
| 53 53 | 
             
                    attrs.each do |attr, value|
         | 
| 54 54 | 
             
                      attribute = self.class.attribute_store.find(attr)
         | 
| 55 55 | 
             
                      next unless attribute
         | 
| 56 | 
            -
             | 
| 56 | 
            +
             | 
| 57 | 
            +
                      parser = AttributeParser.new(value: value, type: attribute.type, timezone: timezone)
         | 
| 57 58 | 
             
                      instance_variable_set("@#{attribute.name}", parser.parse)
         | 
| 58 59 | 
             
                    end
         | 
| 59 60 | 
             
                  end
         | 
| @@ -8,15 +8,15 @@ module Amsi | |
| 8 8 | 
             
                    SUCCESS = 'SUCCESS'.freeze
         | 
| 9 9 | 
             
                  end
         | 
| 10 10 |  | 
| 11 | 
            -
                  string_attrs | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 11 | 
            +
                  string_attrs(*%i[
         | 
| 12 | 
            +
                                 guest_card_id
         | 
| 13 | 
            +
                                 property_id
         | 
| 14 | 
            +
                                 status
         | 
| 15 | 
            +
                               ])
         | 
| 16 16 |  | 
| 17 17 | 
             
                  integer_attrs :contact_seq_no
         | 
| 18 18 |  | 
| 19 | 
            -
                   | 
| 19 | 
            +
                  alias contact_sequence_number contact_seq_no
         | 
| 20 20 |  | 
| 21 21 | 
             
                  def success?
         | 
| 22 22 | 
             
                    status == Status::SUCCESS
         | 
    
        data/lib/amsi/model/lease.rb
    CHANGED
    
    | @@ -15,44 +15,42 @@ module Amsi | |
| 15 15 | 
             
                    CANCELLED = 'X'.freeze
         | 
| 16 16 | 
             
                  end
         | 
| 17 17 |  | 
| 18 | 
            -
                  date_attrs | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
                  string_attrs | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 18 | 
            +
                  date_attrs(*%i[
         | 
| 19 | 
            +
                               application_date
         | 
| 20 | 
            +
                               lease_begin_date
         | 
| 21 | 
            +
                               lease_end_date
         | 
| 22 | 
            +
                               lease_sign_date
         | 
| 23 | 
            +
                               move_in_date
         | 
| 24 | 
            +
                             ])
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  string_attrs(*%i[
         | 
| 27 | 
            +
                                 bldg_id
         | 
| 28 | 
            +
                                 external_reference_id
         | 
| 29 | 
            +
                                 occu_status_code
         | 
| 30 | 
            +
                                 occu_status_code_description
         | 
| 31 | 
            +
                                 property_id
         | 
| 32 | 
            +
                                 resi_id
         | 
| 33 | 
            +
                                 unit_id
         | 
| 34 | 
            +
                                 lease_marketing_source
         | 
| 35 | 
            +
                                 guest_card_no
         | 
| 36 | 
            +
                               ])
         | 
| 37 37 |  | 
| 38 38 | 
             
                  decimal_attrs :rent_amount
         | 
| 39 39 |  | 
| 40 40 | 
             
                  date_time_attrs :guest_first_contact_date
         | 
| 41 41 |  | 
| 42 | 
            -
                   | 
| 43 | 
            -
                   | 
| 44 | 
            -
                   | 
| 45 | 
            -
                   | 
| 46 | 
            -
                   | 
| 47 | 
            -
                   | 
| 48 | 
            -
                   | 
| 49 | 
            -
                   | 
| 50 | 
            -
                   | 
| 51 | 
            -
                   | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
                  attr_accessor :occupants
         | 
| 55 | 
            -
                  attr_accessor :guest_card
         | 
| 42 | 
            +
                  alias begin_date lease_begin_date
         | 
| 43 | 
            +
                  alias end_date lease_end_date
         | 
| 44 | 
            +
                  alias sign_date lease_sign_date
         | 
| 45 | 
            +
                  alias lead_id guest_card_no
         | 
| 46 | 
            +
                  alias lead_date guest_first_contact_date
         | 
| 47 | 
            +
                  alias lead_source_code lease_marketing_source
         | 
| 48 | 
            +
                  alias building_id bldg_id
         | 
| 49 | 
            +
                  alias resident_id resi_id
         | 
| 50 | 
            +
                  alias occupant_status_code occu_status_code
         | 
| 51 | 
            +
                  alias occupant_status_code_description occu_status_code_description
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                  attr_accessor :occupants, :guest_card
         | 
| 56 54 | 
             
                  attr_writer :matched_guest_cards
         | 
| 57 55 |  | 
| 58 56 | 
             
                  def matched_guest_cards
         | 
| @@ -3,15 +3,15 @@ require_relative 'base' | |
| 3 3 | 
             
            module Amsi
         | 
| 4 4 | 
             
              module Model
         | 
| 5 5 | 
             
                class LeasingAgent < Base
         | 
| 6 | 
            -
                  string_attrs | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 6 | 
            +
                  string_attrs(*%i[
         | 
| 7 | 
            +
                                 agent_active_flag
         | 
| 8 | 
            +
                                 agent_code
         | 
| 9 | 
            +
                                 agent_name
         | 
| 10 | 
            +
                                 property_id
         | 
| 11 | 
            +
                               ])
         | 
| 12 12 |  | 
| 13 | 
            -
                   | 
| 14 | 
            -
                   | 
| 13 | 
            +
                  alias code agent_code
         | 
| 14 | 
            +
                  alias name agent_name
         | 
| 15 15 |  | 
| 16 16 | 
             
                  def active?
         | 
| 17 17 | 
             
                    agent_active_flag == 'Y'
         | 
    
        data/lib/amsi/model/manager.rb
    CHANGED
    
    | @@ -3,14 +3,14 @@ require_relative 'base' | |
| 3 3 | 
             
            module Amsi
         | 
| 4 4 | 
             
              module Model
         | 
| 5 5 | 
             
                class Manager < Base
         | 
| 6 | 
            -
                  string_attrs | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 6 | 
            +
                  string_attrs(*%i[
         | 
| 7 | 
            +
                                 fax
         | 
| 8 | 
            +
                                 first_name
         | 
| 9 | 
            +
                                 last_name
         | 
| 10 | 
            +
                                 middle_name
         | 
| 11 | 
            +
                                 phone
         | 
| 12 | 
            +
                                 salutation
         | 
| 13 | 
            +
                               ])
         | 
| 14 14 | 
             
                end
         | 
| 15 15 | 
             
              end
         | 
| 16 16 | 
             
            end
         | 
| @@ -3,15 +3,15 @@ require_relative 'base' | |
| 3 3 | 
             
            module Amsi
         | 
| 4 4 | 
             
              module Model
         | 
| 5 5 | 
             
                class MarketingSource < Base
         | 
| 6 | 
            -
                  string_attrs | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 6 | 
            +
                  string_attrs(*%i[
         | 
| 7 | 
            +
                                 property_id
         | 
| 8 | 
            +
                                 source_code
         | 
| 9 | 
            +
                                 source_desc
         | 
| 10 | 
            +
                                 source_active_flag
         | 
| 11 | 
            +
                               ])
         | 
| 12 12 |  | 
| 13 | 
            -
                   | 
| 14 | 
            -
                   | 
| 13 | 
            +
                  alias code source_code
         | 
| 14 | 
            +
                  alias description source_desc
         | 
| 15 15 |  | 
| 16 16 | 
             
                  def active?
         | 
| 17 17 | 
             
                    source_active_flag == 'Y'
         | 
    
        data/lib/amsi/model/occupant.rb
    CHANGED
    
    | @@ -3,30 +3,30 @@ require_relative 'base' | |
| 3 3 | 
             
            module Amsi
         | 
| 4 4 | 
             
              module Model
         | 
| 5 5 | 
             
                class Occupant < Base
         | 
| 6 | 
            -
                  string_attrs | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 6 | 
            +
                  string_attrs(*%i[
         | 
| 7 | 
            +
                                 bldg_id
         | 
| 8 | 
            +
                                 email
         | 
| 9 | 
            +
                                 external_reference_id
         | 
| 10 | 
            +
                                 occu_first_name
         | 
| 11 | 
            +
                                 occu_last_name
         | 
| 12 | 
            +
                                 occu_seq_no
         | 
| 13 | 
            +
                                 phone_1_no
         | 
| 14 | 
            +
                                 phone_2_no
         | 
| 15 | 
            +
                                 property_id
         | 
| 16 | 
            +
                                 resi_id
         | 
| 17 | 
            +
                                 responsible_flag
         | 
| 18 | 
            +
                                 unit_id
         | 
| 19 | 
            +
                               ])
         | 
| 20 20 |  | 
| 21 21 | 
             
                  decimal_attrs :rent_amount
         | 
| 22 22 |  | 
| 23 | 
            -
                   | 
| 24 | 
            -
                   | 
| 25 | 
            -
                   | 
| 26 | 
            -
                   | 
| 27 | 
            -
                   | 
| 28 | 
            -
                   | 
| 29 | 
            -
                   | 
| 23 | 
            +
                  alias building_id bldg_id
         | 
| 24 | 
            +
                  alias resident_id resi_id
         | 
| 25 | 
            +
                  alias sequence_number occu_seq_no
         | 
| 26 | 
            +
                  alias first_name occu_first_name
         | 
| 27 | 
            +
                  alias last_name occu_last_name
         | 
| 28 | 
            +
                  alias phone_1 phone_1_no
         | 
| 29 | 
            +
                  alias phone_2 phone_2_no
         | 
| 30 30 | 
             
                end
         | 
| 31 31 | 
             
              end
         | 
| 32 32 | 
             
            end
         | 
    
        data/lib/amsi/model/property.rb
    CHANGED
    
    | @@ -5,27 +5,27 @@ module Amsi | |
| 5 5 | 
             
                class Property < Base
         | 
| 6 6 | 
             
                  date_attrs :live_date
         | 
| 7 7 |  | 
| 8 | 
            -
                  string_attrs | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 8 | 
            +
                  string_attrs(*%i[
         | 
| 9 | 
            +
                                 property_id
         | 
| 10 | 
            +
                                 property_name_1
         | 
| 11 | 
            +
                                 property_name_2
         | 
| 12 | 
            +
                                 property_addr_email
         | 
| 13 | 
            +
                                 live_flag
         | 
| 14 | 
            +
                               ])
         | 
| 15 15 |  | 
| 16 | 
            -
                  attr_accessor | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 16 | 
            +
                  attr_accessor(*%i[
         | 
| 17 | 
            +
                                  address
         | 
| 18 | 
            +
                                  leasing_agents
         | 
| 19 | 
            +
                                  manager
         | 
| 20 | 
            +
                                  marketing_sources
         | 
| 21 | 
            +
                                  remit_to_address
         | 
| 22 | 
            +
                                  unit_types
         | 
| 23 | 
            +
                                ])
         | 
| 24 24 |  | 
| 25 | 
            -
                   | 
| 26 | 
            -
                   | 
| 27 | 
            -
                   | 
| 28 | 
            -
                   | 
| 25 | 
            +
                  alias email property_addr_email
         | 
| 26 | 
            +
                  alias id property_id
         | 
| 27 | 
            +
                  alias name property_name_1
         | 
| 28 | 
            +
                  alias name_2 property_name_2
         | 
| 29 29 |  | 
| 30 30 | 
             
                  def live?
         | 
| 31 31 | 
             
                    live_flag == 'Y'
         | 
    
        data/lib/amsi/model/unit_type.rb
    CHANGED
    
    | @@ -3,36 +3,36 @@ require_relative 'base' | |
| 3 3 | 
             
            module Amsi
         | 
| 4 4 | 
             
              module Model
         | 
| 5 5 | 
             
                class UnitType < Base
         | 
| 6 | 
            -
                  decimal_attrs | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 6 | 
            +
                  decimal_attrs(*%i[
         | 
| 7 | 
            +
                                  baths
         | 
| 8 | 
            +
                                  market_rent
         | 
| 9 | 
            +
                                  sec_min
         | 
| 10 | 
            +
                                  standard_renew
         | 
| 11 | 
            +
                                  mtm_renew
         | 
| 12 | 
            +
                                  other_renew
         | 
| 13 | 
            +
                                ])
         | 
| 14 14 |  | 
| 15 | 
            -
                  integer_attrs | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 15 | 
            +
                  integer_attrs(*%i[
         | 
| 16 | 
            +
                                  bedrooms
         | 
| 17 | 
            +
                                  rooms
         | 
| 18 | 
            +
                                  sqftg
         | 
| 19 | 
            +
                                  unit_type_count
         | 
| 20 | 
            +
                                ])
         | 
| 21 21 |  | 
| 22 | 
            -
                  string_attrs | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 22 | 
            +
                  string_attrs(*%i[
         | 
| 23 | 
            +
                                 property_id
         | 
| 24 | 
            +
                                 unit_subtype
         | 
| 25 | 
            +
                                 unit_type
         | 
| 26 | 
            +
                                 unit_type_desc
         | 
| 27 | 
            +
                               ])
         | 
| 28 28 |  | 
| 29 | 
            -
                   | 
| 30 | 
            -
                   | 
| 31 | 
            -
                   | 
| 32 | 
            -
                   | 
| 33 | 
            -
                   | 
| 34 | 
            -
                   | 
| 35 | 
            -
                   | 
| 29 | 
            +
                  alias count unit_type_count
         | 
| 30 | 
            +
                  alias description unit_type_desc
         | 
| 31 | 
            +
                  alias minimum_security_deposit sec_min
         | 
| 32 | 
            +
                  alias month_to_month_renew mtm_renew
         | 
| 33 | 
            +
                  alias sqft sqftg
         | 
| 34 | 
            +
                  alias subtype unit_subtype
         | 
| 35 | 
            +
                  alias type unit_type
         | 
| 36 36 | 
             
                end
         | 
| 37 37 | 
             
              end
         | 
| 38 38 | 
             
            end
         | 
| @@ -4,10 +4,9 @@ module Amsi | |
| 4 4 | 
             
                  attr_reader :daytime_phone, :email, :first_name, :last_name
         | 
| 5 5 |  | 
| 6 6 | 
             
                  def initialize(
         | 
| 7 | 
            -
                    daytime_phone: nil,
         | 
| 7 | 
            +
                    last_name:, daytime_phone: nil,
         | 
| 8 8 | 
             
                    email: nil,
         | 
| 9 | 
            -
                    first_name: nil | 
| 10 | 
            -
                    last_name:
         | 
| 9 | 
            +
                    first_name: nil
         | 
| 11 10 | 
             
                  )
         | 
| 12 11 | 
             
                    @daytime_phone = daytime_phone
         | 
| 13 12 | 
             
                    @email = email
         | 
| @@ -16,16 +16,13 @@ module Amsi | |
| 16 16 | 
             
                # @see request/base.rb for additional params required by every request.
         | 
| 17 17 | 
             
                class AddGuestCard < Base
         | 
| 18 18 | 
             
                  def after_initialize(
         | 
| 19 | 
            -
                    appointment_date: nil,
         | 
| 19 | 
            +
                    contact_type:, property_id:, prospect:, appointment_date: nil,
         | 
| 20 20 | 
             
                    comments: nil,
         | 
| 21 21 | 
             
                    contact_datetime: nil,
         | 
| 22 | 
            -
                    contact_type:,
         | 
| 23 22 | 
             
                    date_needed: nil,
         | 
| 24 23 | 
             
                    initial_source_id: nil,
         | 
| 25 24 | 
             
                    lease_term_desired: nil,
         | 
| 26 25 | 
             
                    leasing_agent_id: nil,
         | 
| 27 | 
            -
                    property_id:,
         | 
| 28 | 
            -
                    prospect:,
         | 
| 29 26 | 
             
                    qualified: nil,
         | 
| 30 27 | 
             
                    requirements: nil,
         | 
| 31 28 | 
             
                    unit_subtype: nil,
         | 
| @@ -16,7 +16,7 @@ module Amsi | |
| 16 16 | 
             
                #   Valid values in: Amsi::Model::Lease::Status
         | 
| 17 17 | 
             
                # @see request/base.rb for additional params required by every request.
         | 
| 18 18 | 
             
                class GetPropertyResidents < Base
         | 
| 19 | 
            -
                  def after_initialize(property_id:, lease_status:, include_marketing_source: false | 
| 19 | 
            +
                  def after_initialize(property_id:, lease_status:, params:, include_marketing_source: false)
         | 
| 20 20 | 
             
                    @property_id = property_id
         | 
| 21 21 | 
             
                    @lease_status = lease_status
         | 
| 22 22 | 
             
                    @include_marketing_source = include_marketing_source
         | 
| @@ -7,16 +7,13 @@ module Amsi | |
| 7 7 | 
             
                  private_constant :DATE_FORMAT
         | 
| 8 8 |  | 
| 9 9 | 
             
                  def initialize(
         | 
| 10 | 
            -
                    appointment_date: nil,
         | 
| 10 | 
            +
                    contact_type:, property_id:, prospect:, appointment_date: nil,
         | 
| 11 11 | 
             
                    comments: nil,
         | 
| 12 12 | 
             
                    contact_datetime: nil,
         | 
| 13 | 
            -
                    contact_type:,
         | 
| 14 13 | 
             
                    date_needed: nil,
         | 
| 15 14 | 
             
                    initial_source_id: nil,
         | 
| 16 15 | 
             
                    lease_term_desired: nil,
         | 
| 17 16 | 
             
                    leasing_agent_id: nil,
         | 
| 18 | 
            -
                    property_id:,
         | 
| 19 | 
            -
                    prospect:,
         | 
| 20 17 | 
             
                    requirements: nil,
         | 
| 21 18 | 
             
                    qualified: nil,
         | 
| 22 19 | 
             
                    unit_subtype: nil,
         | 
| @@ -81,9 +78,11 @@ module Amsi | |
| 81 78 | 
             
                        edex.unitsubtype(unit_subtype) if unit_subtype
         | 
| 82 79 | 
             
                        edex.leasingagentid(leasing_agent_id) if leasing_agent_id
         | 
| 83 80 | 
             
                        edex.requirements(requirements) if requirements
         | 
| 84 | 
            -
                         | 
| 85 | 
            -
                           | 
| 86 | 
            -
             | 
| 81 | 
            +
                        if comments
         | 
| 82 | 
            +
                          edex.comments do |comments_xml|
         | 
| 83 | 
            +
                            comments_xml.comment_(comments, date: format_date(Date.today))
         | 
| 84 | 
            +
                          end
         | 
| 85 | 
            +
                        end
         | 
| 87 86 | 
             
                      end
         | 
| 88 87 | 
             
                    end.doc.root
         | 
| 89 88 | 
             
                  end
         | 
| @@ -3,11 +3,11 @@ module Amsi | |
| 3 3 | 
             
                # Generate the property list filter elements of an AMSI request
         | 
| 4 4 | 
             
                class PropertyListFilter
         | 
| 5 5 | 
             
                  def initialize(
         | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 6 | 
            +
                    include_leasing_agents: false,
         | 
| 7 | 
            +
                    include_marketing_sources: false,
         | 
| 8 | 
            +
                    include_unit_types: false,
         | 
| 9 | 
            +
                    property_id: nil
         | 
| 10 | 
            +
                  )
         | 
| 11 11 | 
             
                    @include_leasing_agents = include_leasing_agents
         | 
| 12 12 | 
             
                    @include_marketing_sources = include_marketing_sources
         | 
| 13 13 | 
             
                    @include_unit_types = include_unit_types
         | 
| @@ -7,21 +7,17 @@ module Amsi | |
| 7 7 | 
             
                  IMPORT_PMS_PROSPECT_EVENT = 'import_pms_prospect'
         | 
| 8 8 |  | 
| 9 9 | 
             
                  def self.track_pms_resident_event(
         | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
                      unit_name:,
         | 
| 22 | 
            -
                      resident_id: nil,
         | 
| 23 | 
            -
                      error: nil
         | 
| 24 | 
            -
                    )
         | 
| 10 | 
            +
                    import_resident_id:, resident_type:, request_params:, unit_name:, remote_lease_id: nil,
         | 
| 11 | 
            +
                    move_in_date: nil,
         | 
| 12 | 
            +
                    lease_to: nil,
         | 
| 13 | 
            +
                    lease_from: nil,
         | 
| 14 | 
            +
                    first_name_present: false,
         | 
| 15 | 
            +
                    last_name_present: false,
         | 
| 16 | 
            +
                    email_present: false,
         | 
| 17 | 
            +
                    phones_count: 0,
         | 
| 18 | 
            +
                    resident_id: nil,
         | 
| 19 | 
            +
                    error: nil
         | 
| 20 | 
            +
                  )
         | 
| 25 21 | 
             
                    EventTracker.track_process_events(name: IMPORT_PMS_RESIDENT_EVENT) do |events|
         | 
| 26 22 | 
             
                      events.add_imported_event(
         | 
| 27 23 | 
             
                        EventTracker::ResourceFactory.build_pms_resident(
         | 
| @@ -63,17 +59,12 @@ module Amsi | |
| 63 59 | 
             
                  end
         | 
| 64 60 |  | 
| 65 61 | 
             
                  def self.track_pms_prospect_event(
         | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
                      contact_date: nil,
         | 
| 73 | 
            -
                      contact_source: nil,
         | 
| 74 | 
            -
                      remote_prospect_id: nil,
         | 
| 75 | 
            -
                      error: nil
         | 
| 76 | 
            -
                    )
         | 
| 62 | 
            +
                    request_params:, first_name_present:, last_name_present:, email_present:, phone_present:, remote_lease_id: nil,
         | 
| 63 | 
            +
                    contact_date: nil,
         | 
| 64 | 
            +
                    contact_source: nil,
         | 
| 65 | 
            +
                    remote_prospect_id: nil,
         | 
| 66 | 
            +
                    error: nil
         | 
| 67 | 
            +
                  )
         | 
| 77 68 | 
             
                    EventTracker.track_process_events(name: IMPORT_PMS_PROSPECT_EVENT) do |events|
         | 
| 78 69 | 
             
                      events.add_imported_event(
         | 
| 79 70 | 
             
                        EventTracker::ResourceFactory.build_pms_prospect(
         | 
| @@ -97,7 +88,7 @@ module Amsi | |
| 97 88 | 
             
                            first_name_present: first_name_present,
         | 
| 98 89 | 
             
                            last_name_present: last_name_present,
         | 
| 99 90 | 
             
                            email_present: email_present,
         | 
| 100 | 
            -
                            phone_present: phone_present | 
| 91 | 
            +
                            phone_present: phone_present
         | 
| 101 92 | 
             
                          ),
         | 
| 102 93 | 
             
                          contact_date: contact_date,
         | 
| 103 94 | 
             
                          contact_source: contact_source,
         | 
    
        data/lib/amsi/validator/base.rb
    CHANGED
    
    | @@ -6,7 +6,7 @@ module Amsi | |
| 6 6 | 
             
              module Validator
         | 
| 7 7 | 
             
                class Base
         | 
| 8 8 | 
             
                  def send_pms_resident_event(lease:, params:, error_message: nil)
         | 
| 9 | 
            -
                    remote_lease_id, lease_to, lease_from = [ | 
| 9 | 
            +
                    remote_lease_id, lease_to, lease_from = [nil] * 3
         | 
| 10 10 | 
             
                    if lease
         | 
| 11 11 | 
             
                      unit_name = lease.unit_id
         | 
| 12 12 | 
             
                      move_in_date = lease.move_in_date
         | 
| @@ -18,7 +18,7 @@ module Amsi | |
| 18 18 | 
             
                      Utils::SnowflakeEventTracker.track_pms_resident_event(
         | 
| 19 19 | 
             
                        remote_lease_id: remote_lease_id,
         | 
| 20 20 | 
             
                        import_resident_id: import_resident_id(params),
         | 
| 21 | 
            -
                        resident_type: index == 0 ? 'PRIMARY': 'ROOMMATE',
         | 
| 21 | 
            +
                        resident_type: index == 0 ? 'PRIMARY' : 'ROOMMATE',
         | 
| 22 22 | 
             
                        request_params: pms_resident_request_params(params),
         | 
| 23 23 | 
             
                        move_in_date: move_in_date&.to_time,
         | 
| 24 24 | 
             
                        lease_to: lease_to,
         | 
| @@ -4,12 +4,9 @@ require_relative 'base' | |
| 4 4 | 
             
            module Amsi
         | 
| 5 5 | 
             
              module Validator
         | 
| 6 6 | 
             
                class ProspectEventValidator < Base
         | 
| 7 | 
            +
                  def initialize(response = nil); end
         | 
| 7 8 |  | 
| 8 | 
            -
                  def  | 
| 9 | 
            -
                  end
         | 
| 10 | 
            -
             | 
| 11 | 
            -
                  def validate!
         | 
| 12 | 
            -
                  end
         | 
| 9 | 
            +
                  def validate!; end
         | 
| 13 10 |  | 
| 14 11 | 
             
                  # Send parased response's individual prospect data to Snowflake via event tracker
         | 
| 15 12 | 
             
                  def send_event(lease, params)
         | 
| @@ -14,6 +14,7 @@ module Amsi | |
| 14 14 | 
             
                  # @raise [Amsi::Error::RequestFault] if the response has a fault
         | 
| 15 15 | 
             
                  def validate!
         | 
| 16 16 | 
             
                    return unless error?
         | 
| 17 | 
            +
             | 
| 17 18 | 
             
                    raise Error::RequestFault.new(error_message, fault_code, details)
         | 
| 18 19 | 
             
                  end
         | 
| 19 20 |  | 
| @@ -27,6 +28,7 @@ module Amsi | |
| 27 28 |  | 
| 28 29 | 
             
                  def details
         | 
| 29 30 | 
             
                    return unless fault['detail']
         | 
| 31 | 
            +
             | 
| 30 32 | 
             
                    app_fault = fault['detail'].values.first
         | 
| 31 33 | 
             
                    FaultDetails.new(
         | 
| 32 34 | 
             
                      app_fault['CustomMessage'],
         | 
| @@ -41,6 +43,7 @@ module Amsi | |
| 41 43 |  | 
| 42 44 | 
             
                  def fault_code
         | 
| 43 45 | 
             
                    return unless fault
         | 
| 46 | 
            +
             | 
| 44 47 | 
             
                    code = fault['faultcode']
         | 
| 45 48 | 
             
                    code = code['__content__'] if code.is_a?(Hash)
         | 
| 46 49 | 
             
                    code.strip
         | 
| @@ -48,6 +51,7 @@ module Amsi | |
| 48 51 |  | 
| 49 52 | 
             
                  def error_message
         | 
| 50 53 | 
             
                    return unless fault
         | 
| 54 | 
            +
             | 
| 51 55 | 
             
                    fault_string = fault['faultstring']
         | 
| 52 56 | 
             
                    fault_string = fault_string['__content__'] if fault_string.is_a?(Hash)
         | 
| 53 57 | 
             
                    fault_string.strip
         | 
| @@ -4,12 +4,9 @@ require_relative 'base' | |
| 4 4 | 
             
            module Amsi
         | 
| 5 5 | 
             
              module Validator
         | 
| 6 6 | 
             
                class ResidentEventValidator < Base
         | 
| 7 | 
            +
                  def initialize(response = nil); end
         | 
| 7 8 |  | 
| 8 | 
            -
                  def  | 
| 9 | 
            -
                  end
         | 
| 10 | 
            -
             | 
| 11 | 
            -
                  def validate!
         | 
| 12 | 
            -
                  end
         | 
| 9 | 
            +
                  def validate!; end
         | 
| 13 10 |  | 
| 14 11 | 
             
                  # Send parased response's individual resident data to Snowflake via event tracker
         | 
| 15 12 | 
             
                  def send_event(lease, params)
         | 
    
        data/lib/amsi/version.rb
    CHANGED
    
    
    
        data/lib/amsi.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: amsi
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0 | 
| 4 | 
            +
              version: 1.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Justin Richard
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2022- | 
| 11 | 
            +
            date: 2022-03-02 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: faraday
         | 
| @@ -174,6 +174,8 @@ files: | |
| 174 174 | 
             
            - ".ci"
         | 
| 175 175 | 
             
            - ".gitignore"
         | 
| 176 176 | 
             
            - ".rspec"
         | 
| 177 | 
            +
            - ".rubocop.yml"
         | 
| 178 | 
            +
            - ".rubocop_todo.yml"
         | 
| 177 179 | 
             
            - CHANGELOG.txt
         | 
| 178 180 | 
             
            - CODEOWNERS
         | 
| 179 181 | 
             
            - Gemfile
         |