ncmb-ruby 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a5d0e29e311cc0919ebab769a836bfedfa8cc266
4
+ data.tar.gz: 226c595010babc8b27b7b537dd5a24434eb03c18
5
+ SHA512:
6
+ metadata.gz: 1c780ca670f81b18628df65e1239aac39e1a9dc26920889e38cabe77e44df4c69fbae53bef0025dd6cc6931853584cd132006c16738c6cc9cddba1feb12690dc
7
+ data.tar.gz: 5b1ab1704c2bd74cd1f61050ab5a8c57ad8d231303df4b3992032a2305ad2a95de02446326f84169d778bc3596ea0de2849f4c351ee9fea8c2b090304258aa01
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ setting.yml
19
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ncmb-ruby-client.gemspec
4
+ gemspec
5
+
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 John K.S. Lau
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ ncmb-ruby
2
+ ================
3
+
4
+ Forked version of [ncmb-ruby-client](https://github.com/moongift/ncmb-ruby-client), a simple Ruby client for the nifty cloud mobile backend REST API.
5
+
6
+ Changes Made
7
+ ------------
8
+ * 03/03/2015 - Added PUT and DELETE
9
+
10
+ Installation
11
+ ------------
12
+ ``` ruby
13
+ gem 'ncmb-ruby'
14
+ ```
15
+
16
+ Basic Usage
17
+ -----------
18
+
19
+ ```
20
+ NCMB.initialize application_key: application_key, client_key: client_key
21
+
22
+ @todo = NCMB::DataStore.new 'Todo'
23
+ @todo = @todo.limit(20).count(1).skip(0)
24
+ puts "@todo[0].name #{@todo[0].name}"
25
+ ```
26
+
27
+ ### Register push notification
28
+
29
+ ```
30
+ NCMB.initialize application_key: application_key, client_key: client_key
31
+
32
+ @push = NCMB::Push.new
33
+ @push.immediateDeliveryFlag = true
34
+ @push.target = ['ios']
35
+ @push.message = "This is test message"
36
+ @push.deliveryExpirationTime = "3 day"
37
+ if @push.save
38
+ puts "Push save successful."
39
+ else
40
+ puts "Push save faild."
41
+ end
42
+ ```
43
+
44
+ [ニフティクラウド mobile backend](http://mb.cloud.nifty.com/)
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ Bundler.setup
4
+ require 'rspec/core/rake_task'
5
+
6
+ desc "run spec"
7
+ RSpec::Core::RakeTask.new(:spec) do |t|
8
+ t.rspec_opts = ["-c", "-fs"]
9
+ end
@@ -0,0 +1,25 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $:.unshift(File.dirname(__FILE__))
3
+ require 'rubygems'
4
+ require 'ncmb'
5
+ require 'yaml'
6
+ require 'csv'
7
+
8
+ yaml = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'setting.yml'))
9
+ NCMB.initialize application_key: yaml['application_key'], client_key: yaml['client_key']
10
+ @todo = NCMB::DataStore.new 'TestClass'
11
+ @todos = @todo.limit(20).count(1).skip(0)
12
+
13
+ csv_string = CSV.generate do |csv|
14
+ csv << @todos.first.columns
15
+ @todos.each_with_index do |todo, i|
16
+ params = []
17
+ todo.columns.each do |name|
18
+ params << todo.call(name)
19
+ end
20
+ csv << params
21
+ end
22
+ end
23
+
24
+ puts csv_string
25
+
@@ -0,0 +1,13 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $:.unshift(File.dirname(__FILE__))
3
+ require 'rubygems'
4
+ require 'ncmb'
5
+ require 'yaml'
6
+ yaml = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'setting.yml'))
7
+ NCMB.initialize application_key: yaml['application_key'], client_key: yaml['client_key']
8
+ @todo = NCMB::DataStore.new 'TestClass'
9
+ @todo = @todo.limit(20).count(1).skip(0)
10
+ # @todo = @todo.where(testKey: "testValue")
11
+ # puts "@todo[0] #{@todo[0]}"
12
+ puts "@todo[0].name #{@todo[0].message}"
13
+
data/examples/push.rb ADDED
@@ -0,0 +1,18 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $:.unshift(File.dirname(__FILE__))
3
+ require 'rubygems'
4
+ require 'ncmb'
5
+ require 'yaml'
6
+ yaml = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'setting.yml'))
7
+ NCMB.initialize application_key: yaml['application_key'], client_key: yaml['client_key']
8
+
9
+ @push = NCMB::Push.new
10
+ @push.immediateDeliveryFlag = true
11
+ @push.target = ['ios']
12
+ @push.message = "This is test message"
13
+ @push.deliveryExpirationTime = "3 day"
14
+ if @push.save
15
+ puts "Push save successful."
16
+ else
17
+ puts "Push save faild."
18
+ end
@@ -0,0 +1,11 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $:.unshift(File.dirname(__FILE__))
3
+ require 'rubygems'
4
+ require 'ncmb'
5
+ require 'yaml'
6
+ yaml = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'setting.yml'))
7
+ @client = NCMB.initialize application_key: "6145f91061916580c742f806bab67649d10f45920246ff459404c46f00ff3e56", client_key: "1343d198b510a0315db1c03f3aa0e32418b7a743f8e4b47cbff670601345cf75"
8
+
9
+ # puts @client.application_key
10
+ puts @client.generate_signature :get, "/2013-09-01/classes/TestClass", "2013-12-02T02:44:35.452Z", {where: {testKey: "testValue"}}
11
+
@@ -0,0 +1,36 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $:.unshift(File.dirname(__FILE__))
3
+ require 'rubygems'
4
+ require 'ncmb'
5
+ require 'yaml'
6
+ yaml = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'setting.yml'))
7
+ @ncmb = NCMB.init(application_key: yaml['application_key'],
8
+ client_key: yaml['client_key']
9
+ )
10
+ json = JSON.parse(open(File.join(File.dirname(__FILE__), 'venues.json'), 'r').read)
11
+ venues_class = @ncmb.data_store 'Venues'
12
+ json['response']['venues'].each do |venue|
13
+ params = {
14
+ name: venue['name'],
15
+ location: {
16
+ "__type" => "GeoPoint",
17
+ "latitude" => venue['location']['lat'],
18
+ "longitude" => venue['location']['lng']
19
+ }
20
+ }
21
+ puts venues_class.post(params).body
22
+ end
23
+ params = {}
24
+ params[:where] = {
25
+ "location" => {
26
+ "$nearSphere" => {
27
+ "__type" => "GeoPoint",
28
+ "longitude" => 139.745433,
29
+ "latitude" => 35.691152
30
+ },
31
+ "$maxDistanceInKilometers" => 10
32
+ }
33
+ }
34
+ #
35
+ puts venues_class.get params
36
+ #puts venues_class.get queries
@@ -0,0 +1 @@
1
+ {"meta":{"code":200},"notifications":[{"type":"notificationTray","item":{"unreadCount":3}}],"response":{"venues":[{"id":"4b56a5e8f964a5208e1728e3","name":"東京タワー (Tokyo Tower)","contact":{"phone":"0334335111","formattedPhone":"03-3433-5111"},"location":{"address":"芝公園4-2-8","lat":35.65856461606471,"lng":139.74547684192657,"distance":4,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d12d941735","name":"Monument \/ Landmark","pluralName":"Monuments \/ Landmarks","shortName":"Landmark","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/building\/government_monument_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":30225,"usersCount":20042,"tipCount":98},"url":"http:\/\/www.tokyotower.co.jp","specials":{"count":0,"items":[]},"hereNow":{"count":1,"summary":"1 people here","groups":[{"type":"others","name":"Other people here","count":1,"items":[]}]},"referralId":"v-1400551483"},{"id":"4be0feaac1732d7f67115b9a","name":"東京タワー 大展望台","contact":{},"location":{"address":"芝公園4-2-8","crossStreet":"150m","lat":35.65855936339402,"lng":139.74547867327624,"distance":4,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d165941735","name":"Scenic Lookout","pluralName":"Scenic Lookouts","shortName":"Scenic Lookout","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/parks_outdoors\/sceniclookout_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":2335,"usersCount":2123,"tipCount":8},"url":"http:\/\/www.tokyotower.co.jp\/observatory\/","specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4c6cbde046353704936907bc","name":"東京タワー 特別展望台","contact":{"phone":"0334335111","formattedPhone":"03-3433-5111"},"location":{"address":"芝公園4-2-8","crossStreet":"250m","lat":35.65856025744641,"lng":139.74547684192657,"distance":4,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d165941735","name":"Scenic Lookout","pluralName":"Scenic Lookouts","shortName":"Scenic Lookout","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/parks_outdoors\/sceniclookout_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":961,"usersCount":882,"tipCount":3},"url":"http:\/\/www.tokyotower.co.jp\/observatory\/index_03.html","specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4d33c8d2306160fc44ae6a88","name":"ピザーラエクスプレス 東京タワー店","contact":{"phone":"0357331600","formattedPhone":"03-5733-1600"},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワー 2F","lat":35.658596776761065,"lng":139.74543164450907,"distance":1,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d1ca941735","name":"Pizza Place","pluralName":"Pizza Places","shortName":"Pizza","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/pizza_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":100,"usersCount":60,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4b835cb0f964a520e60331e3","name":"珈琲館 CAFE DI ESPRESSO 東京タワー店","contact":{"phone":"0357762646","formattedPhone":"03-5776-2646"},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワー2F","lat":35.65836847800488,"lng":139.74550902843475,"distance":24,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d1e0931735","name":"Coffee Shop","pluralName":"Coffee Shops","shortName":"Coffee Shop","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/coffeeshop_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":487,"usersCount":145,"tipCount":4},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"5013740ce4b0c3d5914cfc1a","name":"The Place of Tokyo","contact":{"phone":"0357336788","formattedPhone":"03-5733-6788"},"location":{"address":"芝公園3-5-4","lat":35.65890762998164,"lng":139.7455214653257,"distance":37,"postalCode":"105-0011","cc":"JP","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d171941735","name":"Event Space","pluralName":"Event Spaces","shortName":"Event Space","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/building\/eventspace_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":245,"usersCount":201,"tipCount":4},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4b934800f964a5206b3e34e3","name":"東京タワー水族館 (Tokyo Tower Aquarium)","contact":{"phone":"0334335111","formattedPhone":"03-3433-5111"},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワー 1F","lat":35.65867137834208,"lng":139.74565120674544,"distance":22,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4fceea171983d5d06c3e9823","name":"Aquarium","pluralName":"Aquariums","shortName":"Aquarium","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/arts_entertainment\/aquarium_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":198,"usersCount":186,"tipCount":1},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4e82849bd22dc33e80e21919","name":"東京タワー フードコート","contact":{},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワーフットタウン2F","lat":35.65851667125014,"lng":139.74520325660706,"distance":21,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d120951735","name":"Food Court","pluralName":"Food Courts","shortName":"Food Court","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/shops\/food_foodcourt_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":197,"usersCount":148,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"51c42b39498e2a060888338d","name":"東京タワー フットタウン","contact":{},"location":{"address":"芝公園4-2-8","crossStreet":"1F-4F\/RF","lat":35.658735641146826,"lng":139.7455214653257,"distance":19,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d1ff941735","name":"Miscellaneous Shop","pluralName":"Miscellaneous Shops","shortName":"Shop","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/shops\/default_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":55,"usersCount":53,"tipCount":0},"url":"http:\/\/www.tokyotower.co.jp\/foottown\/","specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4be8bae1fbbb9c74bf2c1e8e","name":"東京カレーラボ (TOKYO CURRY LAB.)","contact":{"phone":"0354252900","formattedPhone":"03-5425-2900","twitter":"tokyocurrylab"},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワー2階","lat":35.658847,"lng":139.745594,"distance":33,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d10f941735","name":"Indian Restaurant","pluralName":"Indian Restaurants","shortName":"Indian","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/indian_","suffix":".png"},"primary":true}],"verified":true,"stats":{"checkinsCount":469,"usersCount":361,"tipCount":10},"url":"http:\/\/www.orange-p.co.jp\/currylab\/","specials":{"count":1,"items":[{"id":"4be8bb4386ba62b5a67c88b3","type":"frequency","message":"Dear Foursquare users, \r\nWelcome to Tokyo's #1 curry house, TOKYO CURRY LAB.\r\nWe offer you \"FREE Fried-Egg for your FIRST check-in!\" \r\nCome and check our shop in Tokyo Tower's 2nd floor!","description":"Unlocked every check-in","icon":"check-in","title":"Check-in Special","provider":"foursquare","redemption":"standard"}]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4b9c9c8cf964a520bc7236e3","name":"サーティワン アイスクリーム 東京タワー店","contact":{"phone":"0334320531","formattedPhone":"03-3432-0531"},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワービル2F","lat":35.65846436778322,"lng":139.7456431388855,"distance":22,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d1c9941735","name":"Ice Cream Shop","pluralName":"Ice Cream Shops","shortName":"Ice Cream","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/icecream_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":124,"usersCount":94,"tipCount":0},"url":"http:\/\/www.31ice.co.jp","specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"502b0991e4b0a87aac1de640","name":"タワー大神宮","contact":{},"location":{"address":"芝公園4丁目2-8","crossStreet":"東京タワー 大展望台2階","lat":35.65863871253972,"lng":139.7454285621643,"distance":6,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4eb1d80a4b900d56c88a45ff","name":"Shrine","pluralName":"Shrines","shortName":"Shrine","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/building\/religious_shrine_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":15,"usersCount":15,"tipCount":1},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4e7be447b61c3834b8dc72aa","name":"マザー牧場カフェ 東京タワー店","contact":{"phone":"0366660333","formattedPhone":"03-6666-0333"},"location":{"address":"芝公園4丁目2-8","crossStreet":"東京タワーフットタウン3階","lat":35.658555898827835,"lng":139.74547684192657,"distance":4,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d16d941735","name":"Café","pluralName":"Cafés","shortName":"Café","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/cafe_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":70,"usersCount":67,"tipCount":2},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4ecb546499119fe1aded44fc","name":"rrrr","contact":{},"location":{"lat":35.658625,"lng":139.745415,"distance":5,"cc":"JP","country":"Japan"},"categories":[],"verified":false,"stats":{"checkinsCount":0,"usersCount":0,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4ee70b70490141636c3dd522","name":"Nannbyou","contact":{},"location":{"lat":35.65863205970822,"lng":139.74542166442671,"distance":5,"cc":"JP","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d104941735","name":"Medical Center","pluralName":"Medical Centers","shortName":"Medical","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/building\/medical_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":2,"usersCount":2,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4c330c17ed37a59312ab6c03","name":"タワシタ","contact":{"phone":"0335606649","formattedPhone":"03-3560-6649"},"location":{"address":"東麻布1-9-3","crossStreet":"赤石ビル 2階","lat":35.65849335183288,"lng":139.74531188363176,"distance":14,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d10c941735","name":"French Restaurant","pluralName":"French Restaurants","shortName":"French","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/french_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":110,"usersCount":97,"tipCount":2},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"51e39635498eb5941bc93d51","name":"丹波屋 東京タワー店","contact":{},"location":{"address":"芝公園4-2-8","lat":35.658556,"lng":139.745234,"distance":18,"cc":"JP","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d1df931735","name":"BBQ Joint","pluralName":"BBQ Joints","shortName":"BBQ","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/bbq_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":12,"usersCount":11,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4b9b6e69f964a520e80636e3","name":"Pink dot. 東京タワー店","contact":{"phone":"0357761845","formattedPhone":"03-5776-1845"},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワーフットタウン2F","lat":35.65851973394507,"lng":139.74528693347943,"distance":14,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d1d0941735","name":"Dessert Shop","pluralName":"Dessert Shops","shortName":"Desserts","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/dessert_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":83,"usersCount":46,"tipCount":3},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"51f4e41e498e8ac8c0c64778","name":"カフェ ラ・トゥール(CAFÉ la TOUR)","contact":{},"location":{"address":"芝公園4丁目2−8","crossStreet":"東京タワー 大展望台1階","lat":35.65848734821138,"lng":139.74547655490036,"distance":11,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d16d941735","name":"Café","pluralName":"Cafés","shortName":"Café","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/cafe_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":8,"usersCount":8,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4fe3167ee4b0675f958af230","name":"Dining&TerraceBar Hotel TANGO","contact":{},"location":{"address":"芝公園3-5-4","lat":35.65879960915436,"lng":139.74557635589173,"distance":27,"cc":"JP","city":"東京都港区","state":"日本","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d157941735","name":"New American Restaurant","pluralName":"New American Restaurants","shortName":"New American","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/default_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":168,"usersCount":134,"tipCount":1},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4d898e3cbc848cfac599c52b","name":"太陽楼 東京タワーフットタウン店","contact":{"phone":"0357774850","formattedPhone":"03-5777-4850"},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワー 2F","lat":35.65863871253972,"lng":139.74536418914795,"distance":9,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d145941735","name":"Chinese Restaurant","pluralName":"Chinese Restaurants","shortName":"Chinese","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/chinese_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":27,"usersCount":26,"tipCount":2},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4b5a721ef964a5209ac528e3","name":"マクドナルド 東京タワー店","contact":{"phone":"0334598246","formattedPhone":"03-3459-8246"},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワー 2F","lat":35.65869973311459,"lng":139.7451227903366,"distance":31,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d16e941735","name":"Fast Food Restaurant","pluralName":"Fast Food Restaurants","shortName":"Fast Food","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/fastfood_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":482,"usersCount":234,"tipCount":3},"url":"http:\/\/www.mcdonalds.co.jp\/shop\/map\/map.php?strcode=13877","specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"506530a3e4b0bd91dfe0951c","name":"東京タワーフットタウン 屋上","contact":{},"location":{"address":"芝公園4-2-8","lat":35.658661,"lng":139.745455,"distance":9,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d171941735","name":"Event Space","pluralName":"Event Spaces","shortName":"Event Space","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/building\/eventspace_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":31,"usersCount":30,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4db41e4f0cb6729b6a8d4729","name":"ヨカヨカカフェ","contact":{},"location":{"lat":35.65867137834208,"lng":139.7453967142282,"distance":10,"cc":"JP","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d116941735","name":"Bar","pluralName":"Bars","shortName":"Bar","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/nightlife\/bar_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":2,"usersCount":2,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"506e5aa1e4b0a9ca4c0f4ce9","name":"club333","contact":{},"location":{"address":"芝公園4\u20102\u20108","crossStreet":"東京タワー 大展望台 1F 特設ステージ","lat":35.658467,"lng":139.745578,"distance":18,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d11f941735","name":"Nightclub","pluralName":"Nightclubs","shortName":"Nightclub","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/nightlife\/nightclub_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":81,"usersCount":48,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"50d2e1d7498ebcf927cb7c0e","name":"LOVESPO TOKYO","contact":{},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワーフットタウンビル 3F","lat":35.658735932127634,"lng":139.74526697336512,"distance":22,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d176941735","name":"Gym","pluralName":"Gyms","shortName":"Gym","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/building\/gym_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":33,"usersCount":22,"tipCount":1},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4d731ce05f00370480cfeba0","name":"マリオンクレープ 東京タワー店","contact":{"phone":"0334381441","formattedPhone":"03-3438-1441"},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワー内正面入口横","lat":35.65844693328663,"lng":139.74562168121338,"distance":22,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"52e81612bcbc57f1066b79f2","name":"Creperie","pluralName":"Creperies","shortName":"Creperie","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/default_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":55,"usersCount":53,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4f926222e4b08038d71454a7","name":"ノッポンのマジカルダンジョン","contact":{},"location":{"address":"港区","lat":35.658587,"lng":139.745567,"distance":12,"cc":"JP","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d1f1931735","name":"General Entertainment","pluralName":"General Entertainment","shortName":"Entertainment","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/arts_entertainment\/default_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":3,"usersCount":3,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"502b6b47e4b0e9c18084b476","name":"Tokyo Tower Gift Shop","contact":{},"location":{"lat":35.658532,"lng":139.745638,"distance":19,"cc":"JP","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d128951735","name":"Gift Shop","pluralName":"Gift Shops","shortName":"Gift Shop","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/shops\/giftshop_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":43,"usersCount":41,"tipCount":1},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4e828a3d9adfb3b097fdc9ba","name":"UMEIYA (宇明屋) 東京タワー店","contact":{"phone":"0354037800","formattedPhone":"03-5403-7800"},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワー2F","lat":35.65848180227598,"lng":139.74523544311523,"distance":20,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d1d1941735","name":"Ramen \/ Noodle House","pluralName":"Ramen \/ Noodle House","shortName":"Ramen \/ Noodles","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/ramen_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":28,"usersCount":21,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4c425fc5d7fad13a561d09da","name":"Noppon Land","contact":{},"location":{"address":"Tokyo Tower 4fl.","lat":35.658630173574835,"lng":139.74559631611015,"distance":15,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d1f1931735","name":"General Entertainment","pluralName":"General Entertainment","shortName":"Entertainment","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/arts_entertainment\/default_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":22,"usersCount":10,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4dd2056c1838a7519651d673","name":"そば処 さつま","contact":{},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワー","lat":35.65820344034991,"lng":139.74524701325754,"distance":45,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d111941735","name":"Japanese Restaurant","pluralName":"Japanese Restaurants","shortName":"Japanese","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/japanese_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":236,"usersCount":65,"tipCount":1},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4b5936a5f964a5209b8128e3","name":"機械振興会館","contact":{"phone":"0334348211","formattedPhone":"03-3434-8211"},"location":{"address":"芝公園 3-5-8","lat":35.65964990462143,"lng":139.7453212738037,"distance":119,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d124941735","name":"Office","pluralName":"Offices","shortName":"Office","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/building\/default_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":1410,"usersCount":563,"tipCount":4},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4e82ed535503bf4b0e90ffe5","name":"洋食デミランチ","contact":{"phone":"0357761845","formattedPhone":"03-5776-1845"},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワーフットタウン2F","lat":35.65851667125014,"lng":139.74528908729553,"distance":14,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d1c4941735","name":"Restaurant","pluralName":"Restaurants","shortName":"Restaurant","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/default_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":10,"usersCount":10,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"50cd3d1de4b05a3b9d702331","name":"東京タワー喫煙所","contact":{},"location":{"lat":35.658805,"lng":139.745412,"distance":25,"cc":"JP","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d164941735","name":"Plaza","pluralName":"Plazas","shortName":"Plaza","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/parks_outdoors\/plaza_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":3,"usersCount":2,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4b5a50d8f964a52096bc28e3","name":"東京芝 とうふ屋うかい","contact":{"phone":"0334361028","formattedPhone":"03-3436-1028"},"location":{"address":"芝公園4-4-13","lat":35.65739626288928,"lng":139.74523703320625,"distance":132,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d111941735","name":"Japanese Restaurant","pluralName":"Japanese Restaurants","shortName":"Japanese","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/japanese_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":1193,"usersCount":972,"tipCount":17},"url":"http:\/\/www.ukai.co.jp\/shiba\/","specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"52023469498e4b6fd73b3632","name":"藤子\u2022F\u2022不二雄展","contact":{},"location":{"address":"東京タワー","lat":35.65871284758714,"lng":139.74549651508522,"distance":15,"cc":"JP","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d1f1931735","name":"General Entertainment","pluralName":"General Entertainment","shortName":"Entertainment","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/arts_entertainment\/default_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":233,"usersCount":226,"tipCount":3},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4ca04e3d0df79c744ee22a1a","name":"クリスタルプラネット 東京タワー店","contact":{"phone":"0357762437","formattedPhone":"03-5776-2437"},"location":{"address":"芝公園4-2-8","crossStreet":"日本電波塔ビルディング 2F","lat":35.65872789404995,"lng":139.74552645537506,"distance":18,"postalCode":"105\u20100011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d111951735","name":"Jewelry Store","pluralName":"Jewelry Stores","shortName":"Jewelry","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/shops\/jewelry_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":5,"usersCount":4,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4f7bc959e4b04f0337e64667","name":"東京タワーフットタウン3階イベントスペース","contact":{},"location":{"lat":35.65864036310063,"lng":139.74562126639262,"distance":18,"cc":"JP","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d135941735","name":"Indie Theater","pluralName":"Indie Theaters","shortName":"Indie","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/arts_entertainment\/performingarts_indieoffbroadway_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":7,"usersCount":6,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"52482ac111d21ab059ecf123","name":"tomori","contact":{},"location":{"address":"芝公園3-5-4","lat":35.65873904614206,"lng":139.74534182382843,"distance":19,"postalCode":"150-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d116941735","name":"Bar","pluralName":"Bars","shortName":"Bar","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/nightlife\/bar_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":1,"usersCount":1,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4d7311f1946b6dcb5d32477a","name":"ノッポンスクエア","contact":{},"location":{"lat":35.658603527170804,"lng":139.74564122662616,"distance":19,"cc":"JP","country":"Japan"},"categories":[],"verified":false,"stats":{"checkinsCount":11,"usersCount":11,"tipCount":1},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4f2a1be1e4b0a328b721848e","name":"TOKIO 333","contact":{"phone":"0357334781","formattedPhone":"03-5733-4781"},"location":{"lat":35.65856461606471,"lng":139.74567532539368,"distance":21,"cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d128951735","name":"Gift Shop","pluralName":"Gift Shops","shortName":"Gift Shop","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/shops\/giftshop_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":6,"usersCount":6,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4bf9dbfb5317a593d1ff017f","name":"Tokyo Medical and Surgical Clinic","contact":{"phone":"0334363028","formattedPhone":"03-3436-3028"},"location":{"address":"芝公園3-4-30","crossStreet":"第32森ビル2F","lat":35.65889587036083,"lng":139.74639415740967,"distance":93,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d104941735","name":"Medical Center","pluralName":"Medical Centers","shortName":"Medical","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/building\/medical_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":160,"usersCount":74,"tipCount":1},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4b9ca65cf964a520877436e3","name":"東京タワースタジオ","contact":{},"location":{"address":"芝公園4-4-7","lat":35.65802976848252,"lng":139.74560130616578,"distance":63,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d124941735","name":"Office","pluralName":"Offices","shortName":"Office","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/building\/default_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":159,"usersCount":99,"tipCount":1},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"500b9befe4b05322f1b9a5fd","name":"Crystal Planet","contact":{},"location":{"lat":35.65836901888962,"lng":139.74543663455086,"distance":23,"cc":"JP","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d111951735","name":"Jewelry Store","pluralName":"Jewelry Stores","shortName":"Jewelry","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/shops\/jewelry_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":8,"usersCount":8,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4c19fc05834e2d7fba252b80","name":"九四","contact":{},"location":{"lat":35.658793,"lng":139.745583,"distance":27,"cc":"JP","country":"Japan"},"categories":[],"verified":false,"stats":{"checkinsCount":3,"usersCount":3,"tipCount":1},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"506530eee4b0cda932346cf5","name":"東京タワーフットタウン ガラスの広場","contact":{},"location":{"address":"芝公園4-2-8","crossStreet":"東京タワーフットタウン屋上","lat":35.65880164030493,"lng":139.74556637578505,"distance":27,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d171941735","name":"Event Space","pluralName":"Event Spaces","shortName":"Event Space","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/building\/eventspace_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":4,"usersCount":3,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"51653028e4b0e029c94485f3","name":"日本聖公会 東京教区事務所","contact":{"phone":"0334330987","formattedPhone":"03-3433-0987"},"location":{"address":"芝公園3-6-1","lat":35.65878896835895,"lng":139.74570110736704,"distance":33,"postalCode":"105-0011","cc":"JP","city":"Minato","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d124941735","name":"Office","pluralName":"Offices","shortName":"Office","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/building\/default_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":9,"usersCount":1,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"4cdca4b04006a1432f5fe0b2","name":"Cafe La Tour","contact":{},"location":{"address":"Tokyo Tower","lat":35.658234272715205,"lng":139.74521208308542,"distance":43,"cc":"JP","country":"Japan"},"categories":[{"id":"4bf58dd8d48988d16d941735","name":"Café","pluralName":"Cafés","shortName":"Café","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/cafe_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":70,"usersCount":70,"tipCount":3},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"},{"id":"5344d059498e9846ac6cd9fe","name":"Patisserie Marion Crepes","contact":{},"location":{"lat":35.6582999322563,"lng":139.745696112514,"distance":39,"cc":"JP","city":"Tokyo","state":"Tōkyō-to","country":"Japan"},"categories":[{"id":"52e81612bcbc57f1066b79f2","name":"Creperie","pluralName":"Creperies","shortName":"Creperie","icon":{"prefix":"https:\/\/ss1.4sqi.net\/img\/categories_v2\/food\/default_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":1,"usersCount":1,"tipCount":0},"specials":{"count":0,"items":[]},"hereNow":{"count":0,"summary":"0 people here","groups":[]},"referralId":"v-1400551483"}],"neighborhoods":[],"confident":true}}
@@ -0,0 +1,137 @@
1
+ require 'time'
2
+ require 'openssl'
3
+ require 'base64'
4
+ require "net/http"
5
+ require "uri"
6
+ require 'json'
7
+ module NCMB
8
+ DOMAIN = 'mb.api.cloud.nifty.com'
9
+ API_VERSION = '2013-09-01'
10
+ @application_key = nil
11
+ @client_key = nil
12
+ @@client = nil
13
+
14
+ class Client
15
+ include NCMB
16
+ attr_accessor :application_key, :client_key, :domain, :api_version
17
+ def initialize(params = {})
18
+ @domain = NCMB::DOMAIN
19
+ @api_version = NCMB::API_VERSION
20
+ @application_key = params[:application_key]
21
+ @client_key = params[:client_key]
22
+ end
23
+
24
+ def get(path, params)
25
+ request :get, path, params
26
+ end
27
+
28
+ def post(path, params)
29
+ request :post, path, params
30
+ end
31
+
32
+ def put(path, params)
33
+ request :put, path, params
34
+ end
35
+
36
+ def delete(path, params)
37
+ request :delete, path, params
38
+ end
39
+
40
+ def array2hash(ary)
41
+ new_v = {}
42
+ ary.each do |hash|
43
+ if hash.is_a? Hash
44
+ key = hash.keys[0]
45
+ new_v[key] = hash[key]
46
+ else
47
+ new_v = [hash]
48
+ end
49
+ end
50
+ new_v
51
+ end
52
+
53
+ def encode_query(queries = {})
54
+ results = {}
55
+ queries.each do |k, v|
56
+ v = array2hash(v) if v.is_a? Array
57
+ if v.is_a? Hash
58
+ results[k.to_s] = URI.escape(v.to_json.to_s, /[^-_.!~*'()a-zA-Z\d;\/?@&=+$,#]/)
59
+ else
60
+ results[k.to_s] = URI.escape(v.to_s, /[^-_.!~*'()a-zA-Z\d;\/?@&=+$,#]/)
61
+ end
62
+ end
63
+ results
64
+ end
65
+
66
+ def hash2query(queries = {})
67
+ results = {}
68
+ queries.each do |k, v|
69
+ v = array2hash(v) if v.is_a? Array
70
+ if v.is_a? Hash
71
+ results[k.to_s] = v.to_json.to_s
72
+ else
73
+ results[k.to_s] = v.to_s
74
+ end
75
+ end
76
+ results.collect do |key, value|
77
+ "#{key}=#{value}"
78
+ end
79
+ end
80
+
81
+ def generate_signature(method, path, now = nil, queries = {})
82
+ params_base = {
83
+ "SignatureMethod" => "HmacSHA256",
84
+ "SignatureVersion" => "2",
85
+ "X-NCMB-Application-Key" => @application_key
86
+ }
87
+ params = method == :get ? params_base.merge(encode_query(queries)) : params_base
88
+ now ||= Time.now.utc.iso8601
89
+ params = params.merge "X-NCMB-Timestamp" => now
90
+ params = params.sort_by{|a, b| a.to_s}.to_h
91
+ signature_base = []
92
+ signature_base << method.upcase
93
+ signature_base << @domain
94
+ signature_base << path
95
+ signature_base << params.collect{|k,v| "#{k}=#{v}"}.join("&")
96
+ signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), @client_key, signature_base.join("\n"))).strip()
97
+ end
98
+
99
+ def request(method, path, queries = {})
100
+ now = Time.now.utc.iso8601
101
+ signature = generate_signature(method, path, now, queries)
102
+ query = hash2query(queries).join("&")
103
+ http = Net::HTTP.new(@domain, 443)
104
+ http.use_ssl=true
105
+ headers = {
106
+ "X-NCMB-Application-Key" => @application_key,
107
+ "X-NCMB-Signature" => signature,
108
+ "X-NCMB-Timestamp" => now,
109
+ "Content-Type" => 'application/json'
110
+ }
111
+ if method == :get
112
+ path = path + URI.escape((query == '' ? "" : "?"+query), /[^-_.!~*'()a-zA-Z\d;\/?@&=+$,#]/)
113
+ return JSON.parse(http.get(path, headers).body, symbolize_names: true)
114
+ elsif method == :post
115
+ return JSON.parse(http.post(path, queries.to_json, headers).body, symbolize_names: true)
116
+ elsif method == :put
117
+ return JSON.parse(http.put(path, queries.to_json, headers).body, symbolize_names: true)
118
+ elsif method == :delete
119
+ response = http.delete(path, headers).body
120
+ if response && response.length >= 2
121
+ return JSON.parse(response, symbolize_names: true)
122
+ else
123
+ return response
124
+ end
125
+ end
126
+ end
127
+ end
128
+
129
+ def NCMB.initialize(params = {})
130
+ defaulted = {
131
+ application_key: ENV["NCMB_APPLICATION_KEY"],
132
+ client_key: ENV["NCMB_CLIENT_KEY"]
133
+ }
134
+ defaulted.merge!(params)
135
+ @@client = Client.new(defaulted)
136
+ end
137
+ end
@@ -0,0 +1,102 @@
1
+ module NCMB
2
+ class DataStore
3
+ include NCMB
4
+
5
+ def initialize(name, fields = {}, alc = "")
6
+ @@name = name
7
+ @@alc = alc
8
+ @@fields = fields
9
+ @@queries = {}
10
+ @@items = nil
11
+ end
12
+
13
+ def columns
14
+ @@fields.keys
15
+ end
16
+
17
+ def method_missing(name)
18
+ if @@fields[name.to_sym]
19
+ return @@fields[name.to_sym]
20
+ else
21
+ raise NoMethod, "#{name} is not found"
22
+ end
23
+ end
24
+
25
+ def call(name)
26
+ @@fields[name.to_sym] || NoMethod
27
+ end
28
+
29
+ def each(&block)
30
+ @@items.each(&block)
31
+ end
32
+
33
+ def each_with_index(&block)
34
+ @@items.each_with_index(&block)
35
+ end
36
+
37
+ def order(field)
38
+ @@queries[:order] = field
39
+ self
40
+ end
41
+
42
+ def first
43
+ return @@items.first unless @@items.nil?
44
+ get(@@queries).first
45
+ end
46
+
47
+ def limit(count)
48
+ @@queries[:limit] = count
49
+ self
50
+ end
51
+
52
+ def count(count)
53
+ @@queries[:count] = count
54
+ self
55
+ end
56
+
57
+ def skip(count)
58
+ @@queries[:skip] = count
59
+ self
60
+ end
61
+
62
+ def where(params = {})
63
+ @@queries[:where] = [] unless @@queries[:where]
64
+ if params.size == 1
65
+ @@queries[:where] << params
66
+ else
67
+ params.each do |hash|
68
+ @@queries[:where] << hash
69
+ end
70
+ end
71
+ self
72
+ end
73
+
74
+ def [](count)
75
+ return @@items[count] unless @@items.nil?
76
+ get(@@queries)[count]
77
+ end
78
+
79
+ def get(queries = {})
80
+ path = "/#{@@client.api_version}/classes/#{@@name}"
81
+ results = @@client.get path, queries
82
+ return [] unless results
83
+ if results[:error] && results[:error] != ""
84
+ @@error = results
85
+ raise 'error'
86
+ end
87
+ items = []
88
+ results[:results].each do |result|
89
+ alc = result[:acl]
90
+ result.delete(:acl)
91
+ items << NCMB::DataStore.new(@@name, result, alc)
92
+ end
93
+ @@items = items
94
+ end
95
+
96
+ def post(queries = {})
97
+ path = "/#{@client.api_version}/classes/#{@@name}"
98
+ result = @client.post path, queries
99
+ NCMB::DataStore.new(client, name, result)
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,13 @@
1
+ module NCMB
2
+ class Devise < NCMB::DataStore
3
+ attr_accessor :client, :name
4
+ def initialize(client)
5
+ @client = client
6
+ @name = "Instration"
7
+ end
8
+
9
+ def push
10
+ return NCMB::Push.new(client
11
+ end
12
+ end
13
+ end
data/lib/ncmb/push.rb ADDED
@@ -0,0 +1,26 @@
1
+ module NCMB
2
+ class Push
3
+ include NCMB
4
+ attr_accessor :deliveryTime, :immediateDeliveryFlag, :target, :searchCondition, :message,
5
+ :userSettingValue, :deliveryExpirationDate, :deliveryExpirationTime, :action, :title, :dialog,
6
+ :badgeIncrementFlag, :badgeSetting, :sound, :contentAvailable, :richUrl, :acl, :objectId, :createDate, :errors
7
+
8
+ def save
9
+ path = "/#{@@client.api_version}/push"
10
+ queries = {}
11
+ [:deliveryTime, :immediateDeliveryFlag, :target, :searchCondition, :message,
12
+ :userSettingValue, :deliveryExpirationDate, :deliveryExpirationTime, :action, :title, :dialog,
13
+ :badgeIncrementFlag, :badgeSetting, :sound, :contentAvailable, :richUrl, :acl].each do |name|
14
+ queries[name] = send(name) unless send(name).nil?
15
+ end
16
+ results = @@client.post path, queries
17
+ if results[:objectId].nil?
18
+ self.errors = results
19
+ return false
20
+ end
21
+ self.objectId = results[:objectId]
22
+ self.createDate = results[:createDate]
23
+ return true
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module Ncmb
2
+ VERSION = "0.0.8"
3
+ end
data/lib/ncmb.rb ADDED
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $:.unshift(File.dirname(__FILE__))
3
+ require "ncmb/version"
4
+ require "ncmb/client"
5
+ require "ncmb/data_store"
6
+ require "ncmb/push"
data/ncmb-ruby.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ncmb/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ncmb-ruby"
8
+ spec.version = Ncmb::VERSION
9
+ spec.authors = ["John Lau"]
10
+ spec.email = ["jolks@outlook.com"]
11
+ spec.description = %q{Forked version of ncmb-ruby-client, a simple Ruby client for the nifty cloud mobile backend REST API}
12
+ spec.summary = %q{Forked version of ncmb-ruby-client, a simple Ruby client for the nifty cloud mobile backend REST API}
13
+ spec.homepage = "https://github.com/jolks/ncmb-ruby"
14
+ spec.license = "MIT License"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ end
@@ -0,0 +1,2 @@
1
+ application_key: application_key
2
+ client_key: client_key
data/spec/get_spec.rb ADDED
@@ -0,0 +1,42 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "spec_helper"
3
+ describe NCMB do
4
+ before do
5
+ yaml = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'setting.yml'))
6
+ @ncmb = NCMB.init(application_key: yaml['application_key'],
7
+ client_key: yaml['client_key']
8
+ )
9
+ end
10
+
11
+ it "Get #1" do
12
+ queries = {:count => "1", :limit => "20", :order => "-createDate", :skip => "0"}
13
+ todo_class = @ncmb.data_store 'TODO'
14
+ # {"count":5,"results":[{"objectId":"VwswoCe7PEuSbGEU","createDate":"2014-05-07T12:03:37.428Z","updateDate":"2014-05-07T12:03:37.428Z","acl":{"*":{"read":true,"write":true}},"todo":"タスクの追加"},{"objectId":"pj9scMgCGQ3wyd5m","createDate":"2014-05-07T08:03:56.268Z","updateDate":"2014-05-07T08:03:56.268Z","acl":{"*":{"read":true,"write":true}},"todo":"タスクを追加"},{"objectId":"lq3CIoaSAcM5Du6I","createDate":"2014-05-07T08:03:44.181Z","updateDate":"2014-05-07T08:03:44.181Z","acl":{"*":{"read":true,"write":true}},"todo":"テストのタスク"},{"objectId":"jln8aWojgUDUnCYo","createDate":"2014-05-07T08:02:23.104Z","updateDate":"2014-05-07T08:02:23.104Z","acl":{"*":{"read":true,"write":true}},"todo":"レビューします"},{"objectId":"zhRGEjECBdaUBLLn","createDate":"2014-05-07T08:02:10.573Z","updateDate":"2014-05-07T08:02:10.573Z","acl":{"*":{"read":true,"write":true}},"todo":"記事を書きます"}]}
15
+ #puts todo_class.get queries
16
+ end
17
+
18
+ it "Generate signature #3" do
19
+ params = {
20
+ :where => {
21
+ "point" => {
22
+ "$within" => {
23
+ "$box" => [
24
+ {
25
+ "__type" => "GeoPoint",
26
+ "latitude" => 35.690921,
27
+ "longitude" => 139.700258
28
+ },
29
+ {
30
+ "__type" => "GeoPoint",
31
+ "latitude" => 35.728926,
32
+ "longitude" => 139.71038
33
+ }
34
+ ]
35
+ }
36
+ }
37
+ }
38
+ }
39
+ signature = @ncmb.generate_signature :get, "/#{@ncmb.api_version}/classes/Venue", URI.escape("2014-05-20T04:55:16.395Z", /[^-_.!~*'()a-zA-Z\d]/u), params
40
+ expect(signature).to eq("sqlhM3xxNPUxFWDHQ5CdDqBp6dInU/YkO2PzuY31Pbk=")
41
+ end
42
+ end
data/spec/post_spec.rb ADDED
@@ -0,0 +1,21 @@
1
+ require "spec_helper"
2
+ describe NCMB do
3
+ before do
4
+ yaml = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'setting.yml'))
5
+ @ncmb = NCMB.init(application_key: yaml['application_key'],
6
+ client_key: yaml['client_key']
7
+ )
8
+ end
9
+
10
+ it "Post #1" do
11
+ queries = {todo: "Test task"}
12
+ todo_class = @ncmb.data_store 'TODO'
13
+ response = todo_class.post queries
14
+ # {"createDate":"2014-05-20T01:53:25.280Z","objectId":"rEDC6P4EgfiBf0AZ"}
15
+ puts response.body
16
+ end
17
+
18
+ it "Post with location #1" do
19
+
20
+ end
21
+ end
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $:.unshift(File.dirname(__FILE__))
3
+ %w(rubygems rspec yaml).each do |f|
4
+ require f
5
+ end
6
+ require "ncmb"
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ncmb-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8
5
+ platform: ruby
6
+ authors:
7
+ - John Lau
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Forked version of ncmb-ruby-client, a simple Ruby client for the nifty
56
+ cloud mobile backend REST API
57
+ email:
58
+ - jolks@outlook.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - examples/csv_test.rb
69
+ - examples/data_store.rb
70
+ - examples/push.rb
71
+ - examples/signature.rb
72
+ - examples/venue_search.rb
73
+ - examples/venues.json
74
+ - lib/ncmb.rb
75
+ - lib/ncmb/client.rb
76
+ - lib/ncmb/data_store.rb
77
+ - lib/ncmb/device.rb
78
+ - lib/ncmb/push.rb
79
+ - lib/ncmb/version.rb
80
+ - ncmb-ruby.gemspec
81
+ - setting_default.yml
82
+ - spec/get_spec.rb
83
+ - spec/post_spec.rb
84
+ - spec/spec_helper.rb
85
+ homepage: https://github.com/jolks/ncmb-ruby
86
+ licenses:
87
+ - MIT License
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.4.5
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Forked version of ncmb-ruby-client, a simple Ruby client for the nifty cloud
109
+ mobile backend REST API
110
+ test_files:
111
+ - spec/get_spec.rb
112
+ - spec/post_spec.rb
113
+ - spec/spec_helper.rb