Sha256: 548f43e3ae2c36d8834b25f313dddf326d442baa168e2be1f42bed60347844db
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
module CureLine class Post < Mash include TimeMethods include ResourceMethods # @return [String] def nickname dig("post", "userInfo", "nickname") end # @return [String] def picture_url dig("post", "userInfo", "pictureUrl") end # @return [String] def post_url home_id = dig("post", "postInfo", "homeId") post_id = dig("post", "postInfo", "postId") "https://timeline.line.me/post/#{home_id}/#{post_id}" end # @return [String] def text dig("post", "contents", "text") end # @return [ActiveSupport::TimeWithZone] When `Time.zone` is initialized # @return [Time] When `Time.zone` is not initialized or without activesupport def created_time millisec = dig("post", "postInfo", "createdTime") time_at(millisec / 1000) end # @return [ActiveSupport::TimeWithZone] When `Time.zone` is initialized # @return [Time] When `Time.zone` is not initialized or without activesupport def updated_time millisec = dig("post", "postInfo", "updatedTime") time_at(millisec / 1000) end # @return [Array<String>] def photo_urls medias.select { |media| media["type"] == "PHOTO" }.map { |media| resource_url(media["resourceId"]) } end # @return [Array<Hash>] def medias dig("post", "contents", "media") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cure_line-0.1.1 | lib/cure_line/post.rb |
cure_line-0.1.0 | lib/cure_line/post.rb |