lib/twitter/tweet.rb in twitter_anonymous_client-0.0.1 vs lib/twitter/tweet.rb in twitter_anonymous_client-1.0.0.0

- old
+ new

@@ -1,14 +1,23 @@ require 'strongly_typed' require 'date' module Twitter - # @note Inspired from gems\twitter-4.5.0\lib\twitter\api\timelines.rb + # @note Inspired from twitter-4.5.0/lib/twitter/api/timelines.rb class Tweet # Class Methods class << self - # Transform json array into a collection of tweets + # Transform a json array into a collection of tweets + # + # @param [Array<Hash>] ary the json twitter results turned into an array of hashes + # + # @return [Array<Tweet>] the array of Tweets normalized objects + # + # @example + # ary = [{'created_at'=>'2013-02-28', 'id'=>3, 'text'=>'hello world'}] + # Twitter::Tweet.build_tweets(ary) + # #=> [#<Twitter::Tweet:0x07.. @id="3", @text="hello world", @created_at=#<DateTime: 2013-02-27>>] def build_tweets(ary) tweets = ary.map do |tweet| args = { id: tweet['id'], text: tweet['text'], created_at: tweet['created_at'] }