Sha256: fe324eb03b5535ce6b76e7e93580905ef15b046df4aeea9e398afbf31033eb3a

Contents?: true

Size: 634 Bytes

Versions: 23

Compression:

Stored size: 634 Bytes

Contents

class Places
  API_KEY = ""
  #See google places documentation at https://developers.google.com/places/documentation/ to obtain a key

  def self.load(places_list_controller)
    BW::Location.get do |result|
      BW::Location.stop
      BubbleWrap::HTTP.get("https://maps.googleapis.com/maps/api/place/search/json?location=#{result[:to].latitude},#{result[:to].longitude}&radius=500&sensor=false&key=#{API_KEY}") do |response|
        names = BW::JSON.parse(response.body.to_str)["results"].map{|r| r["name"]}
        places_list_controller.places_list = names  
        places_list_controller.reloadData
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
bubble-wrap-1.9.7 samples/location/app/models/places.rb
bubble-wrap-1.9.6 samples/location/app/models/places.rb
bubble-wrap-1.9.5 samples/location/app/models/places.rb
bubble-wrap-1.9.4 samples/location/app/models/places.rb
bubble-wrap-1.9.3 samples/location/app/models/places.rb
bubble-wrap-1.9.2 samples/location/app/models/places.rb
bubble-wrap-1.9.1 samples/location/app/models/places.rb
bubble-wrap-1.9.0 samples/location/app/models/places.rb
bubble-wrap-1.8.0 samples/location/app/models/places.rb
bubble-wrap-1.7.1 samples/location/app/models/places.rb
bubble-wrap-1.7.0 samples/location/app/models/places.rb
bubble-wrap-1.6.0 samples/location/app/models/places.rb
bubble-wrap-1.6.0.rc1 samples/location/app/models/places.rb
bubble-wrap-1.5.0 samples/location/app/models/places.rb
bubble-wrap-1.5.0.rc1 samples/location/app/models/places.rb
bubble-wrap-1.4.0 samples/location/app/models/places.rb
bubble-wrap-1.3.0 samples/location/app/models/places.rb
bubble-wrap-1.3.0.osx samples/location/app/models/places.rb
bubble-wrap-1.2.0 samples/location/app/models/places.rb
bubble-wrap-1.2.0.pre samples/location/app/models/places.rb