diff options
author | Lars Henrik Mai <lars.mai@kontinui.de> | 2014-10-25 17:33:47 +0200 |
---|---|---|
committer | Lars Henrik Mai <lars.mai@kontinui.de> | 2014-10-25 17:33:47 +0200 |
commit | a1e8c6fc94297741b1ee00e821b3bf9d4d51e189 (patch) | |
tree | a9db9acb39726ed52d2f904dfbc2de56b18655c9 /helpers/twitter_helpers.rb | |
parent | 90c0d3659850d71119a2825cfedc85f18e9c768f (diff) |
use data for tweets and wiki changes
Diffstat (limited to 'helpers/twitter_helpers.rb')
-rw-r--r-- | helpers/twitter_helpers.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/helpers/twitter_helpers.rb b/helpers/twitter_helpers.rb new file mode 100644 index 0000000..1a3850c --- /dev/null +++ b/helpers/twitter_helpers.rb @@ -0,0 +1,27 @@ +require 'date' + +module TwitterHelpers + + class Tweet + + attr_reader :tweet_id, :text, :user_name + + def initialize(atts={}) + @tweet_id = atts.fetch("id") + @created_at = DateTime.parse(atts.fetch("created_at")) + @text = atts.fetch("text") + @user_name = atts.fetch("user").fetch("name") + @user_screen_name = atts.fetch("user").fetch("screen_name") + end + + def created_at + @created_at.strftime(CalendarHelpers::FORMATS[:date_string_short]) + end + + def user_screen_name + "@#{@user_screen_name}" + end + + end + +end |