Module: Intercom::UnixTimestampUnwrapper

Included in:
Message, MessageThread, UserResource
Defined in:
lib/intercom/unix_timestamp_unwrapper.rb

Overview

Our api returns date as unix time stamps. This module helps marshall to and from Time objects.

Instance Method Summary (collapse)

Instance Method Details

- (Object) set_time_at(attribute_name, time)



8
9
10
# File 'lib/intercom/unix_timestamp_unwrapper.rb', line 8

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

- (Object) time_at(attribute_name)



4
5
6
# File 'lib/intercom/unix_timestamp_unwrapper.rb', line 4

def time_at(attribute_name)
  Time.at(@attributes[attribute_name]) if @attributes[attribute_name]
end