Class: Url

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

Class Method Summary collapse

Class Method Details

.exampleObject



10
11
12
# File 'lib/oii_twitter_goodies/model/url.rb', line 10

def self.example
  {"display_url"=>"bit.ly/SKHqYj", "expanded_url"=>"http://bit.ly/SKHqYj", "url"=>"http://t.co/ZDfXBGCk", "indices"=>[97, 117]}
end

.new_from_raw(url, tweet_id) ⇒ Object



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

def self.new_from_raw(url, tweet_id)
  url = Hashie::Mash[url]
  obj = self.new
  obj.url          = url["url"]
  obj.expanded_url = url["expanded_url"]
  obj.display_url  = url["display_url"]
  obj.indices      = url["indices"]
  obj.tweet_id     = tweet_id
  obj.save!
  obj
end