Sha256: 11873a3037b918aae9e5520b45d1b5d8e1d45f0f25812c0ce13844ba1b70fa83

Contents?: true

Size: 861 Bytes

Versions: 6

Compression:

Stored size: 861 Bytes

Contents

# frozen_string_literal: true
module TopsConnect
  class Property < Base
    def property_key
      data['PropertyKey']
    end
    alias id property_key

    def account_number
      data['AccountNumber']
    end

    def address
      ["#{address_number} #{street}", unit_number].compact.join(' #')
    end

    def city
      data['City']
    end

    def state
      data['State']
    end

    def address_number
      data['AddressNumber']
    end

    def unit_number
      data['AptNumber'] unless data['AptNumber'].blank?
    end

    def street
      data['Street']
    end

    def zip
      data['Zip']
    end

    def community_key
      data['CommunityKey']
    end

    def updated_at
      return unless data['Metadata']['ModifiedDate']

      DateTime.parse data['Metadata']['ModifiedDate']
    end
    alias modified_date updated_at
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tops_connect-0.4.3.2 lib/tops_connect/property.rb
tops_connect-0.4.3.1 lib/tops_connect/property.rb
tops_connect-0.4.3 lib/tops_connect/property.rb
tops_connect-0.4.2.1 lib/tops_connect/property.rb
tops_connect-0.4.2 lib/tops_connect/property.rb
tops_connect-0.4.1 lib/tops_connect/property.rb