examples/venue_search.rb in ncmb-ruby-client-0.1.3 vs examples/venue_search.rb in ncmb-ruby-client-0.1.4

- old
+ new

@@ -1,7 +1,10 @@ -$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) -$:.unshift(File.dirname(__FILE__)) +# frozen_string_literal: true + +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) +$LOAD_PATH.unshift(File.dirname(__FILE__)) + require 'rubygems' require 'ncmb' require 'yaml' yaml = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'setting.yml')) @ncmb = NCMB.init(application_key: yaml['application_key'], @@ -11,25 +14,25 @@ venues_class = @ncmb.data_store 'Venues' json['response']['venues'].each do |venue| params = { name: venue['name'], location: { - "__type" => "GeoPoint", - "latitude" => venue['location']['lat'], - "longitude" => venue['location']['lng'] + '__type' => 'GeoPoint', + 'latitude' => venue['location']['lat'], + 'longitude' => venue['location']['lng'] } } puts venues_class.post(params).body end params = {} params[:where] = { - "location" => { - "$nearSphere" => { - "__type" => "GeoPoint", - "longitude" => 139.745433, - "latitude" => 35.691152 + 'location' => { + '$nearSphere' => { + '__type' => 'GeoPoint', + 'longitude' => 139.745433, + 'latitude' => 35.691152 }, - "$maxDistanceInKilometers" => 10 + '$maxDistanceInKilometers' => 10 } } # puts venues_class.get params #puts venues_class.get queries