class CureLine::Post

Public Instance Methods

created_time() click to toggle source

@return [ActiveSupport::TimeWithZone] When `Time.zone` is initialized @return [Time] When `Time.zone` is not initialized or without activesupport

# File lib/cure_line/post.rb, line 30
def created_time
  millisec = dig("post", "postInfo", "createdTime")
  time_at(millisec / 1000)
end
medias() click to toggle source

@return [Array<Hash>]

# File lib/cure_line/post.rb, line 48
def medias
  dig("post", "contents", "media") || []
end
nickname() click to toggle source

@return [String]

# File lib/cure_line/post.rb, line 7
def nickname
  dig("post", "userInfo", "nickname")
end
photo_urls() click to toggle source

@return [Array<String>]

# File lib/cure_line/post.rb, line 43
def photo_urls
  medias.select { |media| media["type"] == "PHOTO" }.map { |media| resource_url(media["resourceId"]) }
end
picture_url() click to toggle source

@return [String]

# File lib/cure_line/post.rb, line 12
def picture_url
  dig("post", "userInfo", "pictureUrl")
end
post_url() click to toggle source

@return [String]

# File lib/cure_line/post.rb, line 17
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
text() click to toggle source

@return [String]

# File lib/cure_line/post.rb, line 24
def text
  dig("post", "contents", "text")
end
updated_time() click to toggle source

@return [ActiveSupport::TimeWithZone] When `Time.zone` is initialized @return [Time] When `Time.zone` is not initialized or without activesupport

# File lib/cure_line/post.rb, line 37
def updated_time
  millisec = dig("post", "postInfo", "updatedTime")
  time_at(millisec / 1000)
end