Sha256: 5d1b31e6b35963f0599c24c4a9de965c111140951d0f387759fd28aba9bb2128

Contents?: true

Size: 714 Bytes

Versions: 2

Compression:

Stored size: 714 Bytes

Contents

module DeviceCloud
  class PushNotification::Base
    attr_reader :id, :full_path, :device_id, :value, :queued_at, :type
    
    def self.handle!(file_data)
      event = new(file_data)
      event.handle!
    end

    def initialize(file_data)
      @file_data = file_data
      @id = data["id"]
      @full_path = file_data.full_path
      @device_id = data["device_id"]
      @type = data["type"]
      @queued_at = data["queued_dt"]
      @value = data["value"]
    end

    def handle!
      raise NotImplementedError
    end

    def mac_address
      return '' unless device_id.size > 0
      device_id.sub(/\Am:/, '').scan(/.{2}|.+/).join(':')
    end

    def data
      @file_data.data
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
device_cloud-0.0.5 lib/device_cloud/push_notification/base.rb
device_cloud-0.0.4 lib/device_cloud/push_notification/base.rb