Sha256: ca9e96eb63fcbee21228947c687359ddf3826c40d43f223cd8e57447e5817500

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

require 'strongly_typed'

require 'date'

module Twitter
  # @note Inspired from gems\twitter-4.5.0\lib\twitter\api\timelines.rb
  class Tweet
    # Class Methods
    class << self
      # Transform json array into a collection of tweets
      def build_tweets(ary)
        tweets = ary.map do |tweet|
          args = { id:         tweet['id'],
                   text:       tweet['text'],
                   created_at: tweet['created_at'] }
          new(args)
        end
      end
    end

    # Instance Methods
    include StronglyTyped::Model

    attribute :id, String
    attribute :text, String
    attribute :created_at, DateTime
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter_anonymous_client-0.0.1 lib/twitter/tweet.rb