Sha256: 1df2cf3449bfdb6cb907b94e65228a92be3a53a760493e852db266042e9a3c00

Contents?: true

Size: 596 Bytes

Versions: 38

Compression:

Stored size: 596 Bytes

Contents

class Tweet < ActiveRecord::Base
  belongs_to :account
  
  def self.create_from_tweet(account, s)
    tweet             = account.tweets.find_or_initialize_by_twitter_id(s.id)
    tweet.body        = s.text
    tweet.occurred_at = s.created_at
    
    %w[truncated favorited in_reply_to_status_id in_reply_to_user_id source].each do |m|
      tweet.send("#{m}=", s.send(m))
    end
    
    %w[id followers_count name screen_name location description 
      profile_image_url url protected].each do |m|
      tweet.send("user_#{m}=", s.user.send(m))
    end
    tweet.save!
    tweet
  end
end

Version data entries

38 entries across 38 versions & 15 rubygems

Version Path
anthonycrumley-twitter-0.3.8 lib/twitter/cli/models/tweet.rb
baron-twitter-0.4.2 lib/twitter/cli/models/tweet.rb
billymeltdown-twitter-0.3.8.1 lib/twitter/cli/models/tweet.rb
billymeltdown-twitter-0.4.2 lib/twitter/cli/models/tweet.rb
billymeltdown-twitter-0.4.3 lib/twitter/cli/models/tweet.rb
drnic-twitter-0.4.4.1 lib/twitter/cli/models/tweet.rb
dschn-twitter-0.3.7.1 lib/twitter/cli/models/tweet.rb
dschn-twitter-0.3.7.2 lib/twitter/cli/models/tweet.rb
dschn-twitter-0.4.1.1 lib/twitter/cli/models/tweet.rb
dschn-twitter-0.4.1.2 lib/twitter/cli/models/tweet.rb
dschn-twitter-0.4.1.3 lib/twitter/cli/models/tweet.rb
dschn-twitter-0.4.1 lib/twitter/cli/models/tweet.rb
dustin-twitter-0.3.2.1 lib/twitter/cli/models/tweet.rb
dustin-twitter-0.3.2.2 lib/twitter/cli/models/tweet.rb
dustin-twitter-0.3.7 lib/twitter/cli/models/tweet.rb
gilesbowkett-gilesbowkett-twitter-0.4.4 lib/twitter/cli/models/tweet.rb
gilesbowkett-twitter-0.4.3 lib/twitter/cli/models/tweet.rb
gilesbowkett-twitter-0.4.5 lib/twitter/cli/models/tweet.rb
handcrafted-twitter-0.4.0 lib/twitter/cli/models/tweet.rb
handcrafted-twitter-0.4.2 lib/twitter/cli/models/tweet.rb