Sha256: d3fab3efc0624e0e1b30b84e0189e61986c36eeeaf0ea11fe5a7594ad05d05db

Contents?: true

Size: 878 Bytes

Versions: 6

Compression:

Stored size: 878 Bytes

Contents

module PatronusFati
  module DataModels
    class Ssid
      include CommonState

      attr_accessor :local_attributes

      LOCAL_ATTRIBUTE_KEYS = [
        :beacon_info, :beacon_rate, :cloaked, :crypt_set, :essid, :max_rate
      ].freeze

      def self.current_expiration_threshold
        Time.now.to_i - SSID_EXPIRATION
      end

      def initialize(essid)
        super
        self.local_attributes = {
          cloaked: essid.nil? || essid.empty?,
          essid: essid
        }
      end

      def full_state
        { last_visible: presence.last_visible }.merge(local_attributes)
      end

      def update(attrs)
        attrs.each do |k, v|
          next unless LOCAL_ATTRIBUTE_KEYS.include?(k)
          next if local_attributes[k] == v

          set_sync_flag(:dirtyAttributes)
          local_attributes[k] = v
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
patronus_fati-1.3.5 lib/patronus_fati/data_models/ssid.rb
patronus_fati-1.3.4 lib/patronus_fati/data_models/ssid.rb
patronus_fati-1.3.3 lib/patronus_fati/data_models/ssid.rb
patronus_fati-1.3.2 lib/patronus_fati/data_models/ssid.rb
patronus_fati-1.3.1 lib/patronus_fati/data_models/ssid.rb
patronus_fati-1.3.0 lib/patronus_fati/data_models/ssid.rb