ncmb-ruby-client 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +17 -0
- data/Rakefile +9 -0
- data/examples/venue_search.rb +55 -0
- data/examples/venues.json +1 -0
- data/lib/ncmb.rb +5 -0
- data/lib/ncmb/client.rb +90 -0
- data/lib/ncmb/data_store.rb +19 -0
- data/lib/ncmb/version.rb +3 -0
- data/ncmb-ruby-client.gemspec +24 -0
- data/setting_default.yml +2 -0
- data/spec/get_spec.rb +42 -0
- data/spec/post_spec.rb +21 -0
- data/spec/spec_helper.rb +6 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6e7f0e9ef529e5930000b966931ba6522e661aaf
|
4
|
+
data.tar.gz: 673f21de25458af52ba1b9521f9fdfd77851967b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 282a25d8c282a343e01b912548e95e9f8dd7611de0505760f77ab2227eeeee77e5df51a95e35b1e2652e345abae7824c04a3d917e593839d8c7ccf4151815e24
|
7
|
+
data.tar.gz: 69b1587e7fae7f688dba7a3d50a647e34fec746d421d5abbfaf00b112280fe577ede38046f6f84f4885f7de131bee6a18e18f131120c5d6c7f23daba90f20c5f
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Atsushi Nakatsugawa
|
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,17 @@
|
|
1
|
+
ncmb-ruby-client
|
2
|
+
================
|
3
|
+
|
4
|
+
A simple Ruby client for the nifty cloud mobile backend REST API
|
5
|
+
|
6
|
+
|
7
|
+
Basic Usage
|
8
|
+
-----------
|
9
|
+
|
10
|
+
```
|
11
|
+
@ncmb = NCMB.init(application_key: application_key,
|
12
|
+
client_key: client_key
|
13
|
+
)
|
14
|
+
queries = {:count => "1", :limit => "20", :order => "-createDate", :skip => "0"}
|
15
|
+
todo_class = @ncmb.data_store 'TODO'
|
16
|
+
todo_class.get queries
|
17
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
$:.unshift(File.dirname(__FILE__))
|
4
|
+
require 'rubygems'
|
5
|
+
require 'ncmb'
|
6
|
+
require 'yaml'
|
7
|
+
yaml = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'setting.yml'))
|
8
|
+
@ncmb = NCMB.init(application_key: yaml['application_key'],
|
9
|
+
client_key: yaml['client_key']
|
10
|
+
)
|
11
|
+
json = JSON.parse(open(File.join(File.dirname(__FILE__), 'venues.json'), 'r').read)
|
12
|
+
venues_class = @ncmb.data_store 'Venues'
|
13
|
+
json['response']['venues'].each do |venue|
|
14
|
+
params = {
|
15
|
+
name: venue['name'],
|
16
|
+
location: {
|
17
|
+
"__type" => "GeoPoint",
|
18
|
+
"latitude" => venue['location']['lat'],
|
19
|
+
"longitude" => venue['location']['lng']
|
20
|
+
}
|
21
|
+
}
|
22
|
+
puts venues_class.post(params).body
|
23
|
+
end
|
24
|
+
params = {}
|
25
|
+
params[:where] = {
|
26
|
+
"point" => {
|
27
|
+
"$within" => {
|
28
|
+
"$box" => [
|
29
|
+
{
|
30
|
+
"__type" => "GeoPoint",
|
31
|
+
"latitude" => 35.690921,
|
32
|
+
"longitude" => 139.700258
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"__type" => "GeoPoint",
|
36
|
+
"latitude" => 35.728926,
|
37
|
+
"longitude" => 139.71038
|
38
|
+
}
|
39
|
+
]
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
params[:where] = {
|
44
|
+
"location" => {
|
45
|
+
"$nearSphere" => {
|
46
|
+
"__type" => "GeoPoint",
|
47
|
+
"longitude" => 139.745433,
|
48
|
+
"latitude" => 35.691152
|
49
|
+
},
|
50
|
+
"$maxDistanceInKilometers" => 10
|
51
|
+
}
|
52
|
+
}
|
53
|
+
#
|
54
|
+
puts venues_class.get params
|
55
|
+
#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}}
|
data/lib/ncmb.rb
ADDED
data/lib/ncmb/client.rb
ADDED
@@ -0,0 +1,90 @@
|
|
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
|
+
class Client
|
11
|
+
attr_accessor :application_key, :client_key, :domain, :api_version
|
12
|
+
def initialize(params = {})
|
13
|
+
@domain = NCMB::DOMAIN
|
14
|
+
@api_version = NCMB::API_VERSION
|
15
|
+
@application_key = params[:application_key]
|
16
|
+
@client_key = params[:client_key]
|
17
|
+
end
|
18
|
+
|
19
|
+
def data_store(name)
|
20
|
+
NCMB::DataStore.new self, name
|
21
|
+
end
|
22
|
+
|
23
|
+
def get(path, params)
|
24
|
+
request :get, path, params
|
25
|
+
end
|
26
|
+
|
27
|
+
def post(path, params)
|
28
|
+
request :post, path, params
|
29
|
+
end
|
30
|
+
|
31
|
+
def encode_query(queries = {})
|
32
|
+
queries.each do |k, v|
|
33
|
+
if v.is_a? Hash
|
34
|
+
queries[k] = URI.escape(v.to_json.to_s, /[^-_.!~*'()a-zA-Z\d;\/?:@&=+$,#]/)
|
35
|
+
else
|
36
|
+
queries[k] = URI.escape(v.to_s, /[^-_.!~*'()a-zA-Z\d;\/?:@&=+$,#]/)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
queries
|
40
|
+
end
|
41
|
+
|
42
|
+
def generate_signature(method, path, now = nil, queries = {})
|
43
|
+
params_base = {
|
44
|
+
"SignatureMethod" => "HmacSHA256",
|
45
|
+
"SignatureVersion" => "2",
|
46
|
+
"X-NCMB-Application-Key" => @application_key
|
47
|
+
}
|
48
|
+
params = method == :get ? params_base.merge(encode_query(queries)) : params_base
|
49
|
+
now ||= Time.now.utc.iso8601
|
50
|
+
params = params.merge "X-NCMB-Timestamp" => now
|
51
|
+
params = Hash[params.sort{|a, b| a[0].to_s <=> b[0].to_s}]
|
52
|
+
signature_base = []
|
53
|
+
signature_base << method.upcase
|
54
|
+
signature_base << @domain
|
55
|
+
signature_base << path
|
56
|
+
signature_base << params.collect{|k,v| "#{k}=#{v}"}.join("&")
|
57
|
+
signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), @client_key, signature_base.join("\n"))).strip()
|
58
|
+
end
|
59
|
+
|
60
|
+
def request(method, path, queries = {})
|
61
|
+
now = Time.now.utc.iso8601
|
62
|
+
signature = generate_signature(method, path, now, queries)
|
63
|
+
query = queries.collect{|k,v| "#{k}=#{v.is_a?(Hash) ? v.to_json.to_s : v}"}.join("&")
|
64
|
+
http = Net::HTTP.new(@domain, 443)
|
65
|
+
http.use_ssl=true
|
66
|
+
headers = {
|
67
|
+
"X-NCMB-Application-Key" => @application_key,
|
68
|
+
"X-NCMB-Signature" => signature,
|
69
|
+
"X-NCMB-Timestamp" => now,
|
70
|
+
"Content-Type" => 'application/json'
|
71
|
+
}
|
72
|
+
if method == :get
|
73
|
+
path = path + (query == '' ? "" : "?"+query)
|
74
|
+
return http.get(path, headers).body
|
75
|
+
else
|
76
|
+
return http.post(path, queries.to_json, headers)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
@@client = nil
|
82
|
+
def NCMB.init(params = {})
|
83
|
+
defaulted = {
|
84
|
+
application_key: ENV["NCMB_APPLICATION_KEY"],
|
85
|
+
client_key: ENV["NCMB_CLIENT_KEY"]
|
86
|
+
}
|
87
|
+
defaulted.merge!(params)
|
88
|
+
@@client = Client.new(defaulted)
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module NCMB
|
2
|
+
class DataStore
|
3
|
+
attr_accessor :client, :name
|
4
|
+
def initialize(client, name)
|
5
|
+
@client = client
|
6
|
+
@name = name
|
7
|
+
end
|
8
|
+
|
9
|
+
def get(queries = {})
|
10
|
+
path = "/#{@client.api_version}/classes/#{@name}"
|
11
|
+
@client.get path, queries
|
12
|
+
end
|
13
|
+
|
14
|
+
def post(queries = {})
|
15
|
+
path = "/#{@client.api_version}/classes/#{@name}"
|
16
|
+
@client.post path, queries
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/ncmb/version.rb
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-client"
|
8
|
+
spec.version = Ncmb::VERSION
|
9
|
+
spec.authors = ["Atsushi Nakatsugawa"]
|
10
|
+
spec.email = ["atsushi@moongift.jp"]
|
11
|
+
spec.description = %q{A simple Ruby client for the nifty cloud mobile backend REST API}
|
12
|
+
spec.summary = %q{A simple Ruby client for the nifty cloud mobile backend REST API}
|
13
|
+
spec.homepage = "http://mb.cloud.nifty.com/"
|
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
|
data/setting_default.yml
ADDED
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", "2014-05-20T04:55:16.395Z", 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
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ncmb-ruby-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Atsushi Nakatsugawa
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-20 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: A simple Ruby client for the nifty cloud mobile backend REST API
|
56
|
+
email:
|
57
|
+
- atsushi@moongift.jp
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- examples/venue_search.rb
|
68
|
+
- examples/venues.json
|
69
|
+
- lib/ncmb.rb
|
70
|
+
- lib/ncmb/client.rb
|
71
|
+
- lib/ncmb/data_store.rb
|
72
|
+
- lib/ncmb/version.rb
|
73
|
+
- ncmb-ruby-client.gemspec
|
74
|
+
- setting_default.yml
|
75
|
+
- spec/get_spec.rb
|
76
|
+
- spec/post_spec.rb
|
77
|
+
- spec/spec_helper.rb
|
78
|
+
homepage: http://mb.cloud.nifty.com/
|
79
|
+
licenses:
|
80
|
+
- MIT License
|
81
|
+
metadata: {}
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 2.0.7
|
99
|
+
signing_key:
|
100
|
+
specification_version: 4
|
101
|
+
summary: A simple Ruby client for the nifty cloud mobile backend REST API
|
102
|
+
test_files:
|
103
|
+
- spec/get_spec.rb
|
104
|
+
- spec/post_spec.rb
|
105
|
+
- spec/spec_helper.rb
|