Class: UserMention

Inherits:
Object
  • Object
show all
Includes:
MongoMapper::Document
Defined in:
lib/oii_twitter_goodies/model/user_mention.rb

Class Method Summary collapse

Class Method Details

.exampleObject



11
12
13
# File 'lib/oii_twitter_goodies/model/user_mention.rb', line 11

def self.example
  {"name"=>"film.culture360", "id_str"=>"211760188", "id"=>211760188, "indices"=>[3, 19], "screen_name"=>"film_culture360"}
end

.new_from_raw(entity, tweet_id) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/oii_twitter_goodies/model/user_mention.rb', line 15

def self.new_from_raw(entity, tweet_id)
  entity = Hashie::Mash[entity]
  obj                = self.new
  obj.screen_name    = entity["screen_name"]
  obj.name           = entity["name"]
  obj.twitter_id     = entity["id"]
  obj.twitter_id_str = entity["id_str"]
  obj.indices        = entity["indices"]
  obj.tweet_id = tweet_id
  obj.save!
  obj
end