Class: BoundingBox

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

Class Method Summary collapse

Class Method Details

.exampleObject



8
9
10
# File 'lib/oii_twitter_goodies/model/bounding_box.rb', line 8

def self.example
  {"type"=>"Polygon", "coordinates"=>[[[4.7289, 52.278227], [5.079207, 52.278227], [5.079207, 52.431229], [4.7289, 52.431229]]]}
end

.new_from_raw(bounding_box, place_id) ⇒ Object



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

def self.new_from_raw(bounding_box, place_id)
  return nil if bounding_box.nil?
  bounding_box = Hashie::Mash[bounding_box]
  obj = self.new
  obj.type = bounding_box["type"] || "Not Specified"
  obj.coordinates = bounding_box["coordinates"]
  obj.place_id = place_id
  obj.save!
  obj
end