module PanoramioRb

Constants

DEFAULT_OPTIONS
URL
VERSION

Public Class Methods

get_panoramas(options = {}) click to toggle source
# File lib/panoramio-rb.rb, line 18
def self.get_panoramas(options = {})
  panoramio_options = DEFAULT_OPTIONS
  panoramio_options = panoramio_options.merge(options)
  response = RestClient.get URL, :params => panoramio_options
  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 = {}) click to toggle source
# File lib/panoramio-rb.rb, line 30
def self.get_panoramas_from_point(point, radius = 10, unit = :mi, options = {})
  points = Geocoder::Calculations.bounding_box(point, radius, { :units => unit })
  options.merge!({
    :miny => points[0],
    :minx => points[1],
    :maxy => points[2],
    :maxx => points[3] 
  })
  self.get_panoramas(options)
end