mirror of
https://github.com/samsonjs/instapaper.git
synced 2026-04-26 14:47:42 +00:00
Change times to Time instances, not Unix timestamps
This commit is contained in:
parent
a17773ee35
commit
3fda2e49a0
3 changed files with 15 additions and 3 deletions
|
|
@ -13,8 +13,8 @@ module Instapaper
|
||||||
attribute? :description, Types::String
|
attribute? :description, Types::String
|
||||||
attribute? :instapaper_hash, Types::String
|
attribute? :instapaper_hash, Types::String
|
||||||
attribute? :private_source, Types::String
|
attribute? :private_source, Types::String
|
||||||
attribute? :progress_timestamp, Types::Integer.optional
|
attribute? :progress_timestamp, Types::UnixTime
|
||||||
attribute? :time, Types::Integer.optional
|
attribute? :time, Types::UnixTime
|
||||||
attribute? :progress, Types::StringOrInteger
|
attribute? :progress, Types::StringOrInteger
|
||||||
attribute? :starred, Types::StringOrInteger
|
attribute? :starred, Types::StringOrInteger
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,6 @@ module Instapaper
|
||||||
attribute :bookmark_id, Types::Integer
|
attribute :bookmark_id, Types::Integer
|
||||||
attribute :text, Types::String
|
attribute :text, Types::String
|
||||||
attribute :position, Types::Integer
|
attribute :position, Types::Integer
|
||||||
attribute :time, Types::Integer.optional
|
attribute :time, Types::UnixTime
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -18,5 +18,17 @@ module Instapaper
|
||||||
!!value
|
!!value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Converts Unix timestamps to Time objects
|
||||||
|
UnixTime = Types::Time.constructor do |value|
|
||||||
|
case value
|
||||||
|
when ::Time
|
||||||
|
value
|
||||||
|
when nil
|
||||||
|
nil
|
||||||
|
else
|
||||||
|
::Time.at(value.to_i)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue