Sha256: 7fb2e755dd5fd5d3bcc1ae2f74e6e1d7439bf1201480c9b957c2dc98babdb6d8
Contents?: true
Size: 1.04 KB
Versions: 7
Compression:
Stored size: 1.04 KB
Contents
module Urbanairship module Devices class Attributes SET = 'set' REMOVE = 'remove' def initialize(attributes) @attributes = attributes end def payload @payload ||= { attributes: attributes_list } end private def attributes_list @attributes.map{ |attribute| attribute_payload(attribute) } end def attribute_payload(attribute) if REMOVE == attribute[:action] remove_payload(attribute) else set_payload(attribute) end end def set_payload(attribute) { action: SET, key: attribute[:key], value: attribute[:value], timestamp: (attribute[:timestamp] || timestamp).iso8601, } end def remove_payload(attribute) { action: REMOVE, key: attribute[:key], timestamp: (attribute[:timestamp] || timestamp).iso8601, } end def timestamp @timestamp ||= Time.now.utc end end end end
Version data entries
7 entries across 7 versions & 1 rubygems