Class: Geo

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

Class Method Summary collapse

Class Method Details

.exampleObject



9
10
11
# File 'lib/oii_twitter_goodies/model/geo.rb', line 9

def self.example
  {"type"=>"Point", "coordinates"=>[52.37051453, 4.8930892]}
end

.new_from_raw(geo, tweet_id) ⇒ Object



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

def self.new_from_raw(geo, tweet_id)
  return if geo.nil?
  geo = Hashie::Mash[geo.attrs]
  obj = self.new
  obj.type = geo["type"]
  obj.coordinates = geo["coordinates"]
  obj.tweet_id = tweet_id
  obj.save!
  obj
end