Sha256: fa8795f6952b67a89c46af23656e077aa36e65800f11a160e433be20e99c7775

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

require 'yardi/utils'
require 'yardi/utils/google_cloud_storage'

module Yardi
  module Utils
    class TestDataFetcher
      RESIDENTS_PATH = 'test_data/residents/'
      GUESTCARD_ACTIVITY_PATH = 'test_data/yardi_prospects/'
      def self.residents(property_id)
        GoogleCloudStorage.read_file(file_path: RESIDENTS_PATH + "#{property_id}.xml")
      end

      def self.guest_card_activity(property_id, prospect)
        search_by = case prospect
                    when -> (p) { p.yardi_prospect_id }
                      { '/prospect_id/' => prospect.yardi_prospect_id }
                    when -> (p) { p.email }
                      { '/email/' => prospect.email.gsub(/\./,'') }
                    when -> (p) { p.first_name } && -> (p) { p.last_name }
                      { '/name/' => prospect.first_name + ' ' + prospect.last_name }
                    when -> (p) { p.phone }
                      { '/phone/' => prospect.phone }
                    end 

        file_path = GUESTCARD_ACTIVITY_PATH + property_id.to_s + search_by.keys.first + search_by[search_by.keys.first] + '.xml'
        GoogleCloudStorage.read_file(file_path: file_path)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yardi-4.11.4 lib/yardi/utils/test_data_fetcher.rb
yardi-4.11.3 lib/yardi/utils/test_data_fetcher.rb
yardi-5.0.1 lib/yardi/utils/test_data_fetcher.rb
yardi-4.11.2 lib/yardi/utils/test_data_fetcher.rb