Module: PanoramioRb
- Defined in:
- lib/panoramio-rb.rb,
lib/panoramio-rb/version.rb
Constant Summary collapse
- URL =
'http://www.panoramio.com/map/get_panoramas.php'
- DEFAULT_OPTIONS =
{ :set => :public, # Cant be :public, :full, or a USER ID number :size => :medium, # Cant be :original, :medium (default value), :small, :thumbnail, :square, :mini_square :from => 0, :to => 20, :mapfilter => true }
- VERSION =
"1.1.2"
Class Method Summary collapse
- .get_panoramas(options = {}) ⇒ Object
- .get_panoramas_from_point(point, radius = 10, unit = :mi, options = {}) ⇒ Object
Class Method Details
.get_panoramas(options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/panoramio-rb.rb', line 18 def self.get_panoramas( = {}) = DEFAULT_OPTIONS = .merge() response = RestClient.get URL, :params => if response.code == 200 parse_data = JSON.parse(response.to_str) Hashie::Mash.new(parse_data) else raise "Panoramio API error: #{response.code}. Response #{response.to_str}" end end |
.get_panoramas_from_point(point, radius = 10, unit = :mi, options = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/panoramio-rb.rb', line 30 def self.get_panoramas_from_point(point, radius = 10, unit = :mi, = {}) points = Geocoder::Calculations.bounding_box(point, radius, { :units => unit }) .merge!({ :miny => points[0], :minx => points[1], :maxy => points[2], :maxx => points[3] }) self.get_panoramas() end |