Sha256: 559fed9382b06ccb8c8c31f31b78119baaaf6ca1f3e257b7c4cda224b48961b0

Contents?: true

Size: 395 Bytes

Versions: 25

Compression:

Stored size: 395 Bytes

Contents

module Intercom
  # Our api returns date as unix time stamps. This module helps marshall to and from {Time} objects.
  module UnixTimestampUnwrapper
    def time_at(attribute_name)
      Time.at(@attributes[attribute_name]) if @attributes[attribute_name]
    end

    def set_time_at(attribute_name, time)
      @attributes[attribute_name.to_s] = (time.nil?) ? nil : time.to_i
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
intercom-0.1.4 lib/intercom/unix_timestamp_unwrapper.rb
intercom-0.1.2 lib/intercom/unix_timestamp_unwrapper.rb
intercom-0.1.1 lib/intercom/unix_timestamp_unwrapper.rb
intercom-0.0.12 lib/intercom/unix_timestamp_unwrapper.rb
intercom-0.0.10 lib/intercom/unix_timestamp_unwrapper.rb