Sha256: 93474a3315b7f72c157ad2a0462c9e8e8d8082d98e8fe6f7a26458a45551f845
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
# 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'], client_key: yaml['client_key'] ) json = JSON.parse(open(File.join(File.dirname(__FILE__), 'venues.json'), 'r').read) 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'] } } puts venues_class.post(params).body end params = {} params[:where] = { 'location' => { '$nearSphere' => { '__type' => 'GeoPoint', 'longitude' => 139.745433, 'latitude' => 35.691152 }, '$maxDistanceInKilometers' => 10 } } # puts venues_class.get params #puts venues_class.get queries
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ncmb-ruby-client-0.1.6 | examples/venue_search.rb |
ncmb-ruby-client-0.1.5 | examples/venue_search.rb |
ncmb-ruby-client-0.1.4 | examples/venue_search.rb |