singleplatform 0.1.1 → 0.2.2
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 +4 -4
- data/.gitignore +2 -1
- data/Gemfile +3 -1
- data/Gemfile.lock +20 -5
- data/LICENSE.txt +21 -0
- data/README.md +29 -14
- data/Rakefile +0 -9
- data/lib/singleplatform.rb +0 -3
- data/lib/singleplatform/client.rb +34 -5
- data/lib/singleplatform/client/locations.rb +16 -6
- data/lib/singleplatform/client/menus.rb +1 -0
- data/lib/singleplatform/client/photos.rb +9 -2
- data/lib/singleplatform/error.rb +39 -0
- data/lib/singleplatform/request.rb +44 -0
- data/lib/singleplatform/response.rb +65 -0
- data/lib/singleplatform/version.rb +1 -1
- data/spec/singleplatform/client/locations_spec.rb +87 -0
- data/spec/singleplatform/client/menus_spec.rb +41 -0
- data/spec/singleplatform/client/photos_spec.rb +41 -0
- data/spec/singleplatform/client_spec.rb +37 -0
- data/spec/singleplatform_spec.rb +27 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/support/fixtures/location.json +114 -0
- data/spec/support/fixtures/menus.json +374 -0
- data/spec/support/fixtures/photos.json +76 -0
- data/spec/support/fixtures/updated_since.json +233 -0
- metadata +17 -6
- data/lib/singleplatform/client/request.rb +0 -24
- data/test/singleplatform/test_client.rb +0 -15
- data/test/test_singleplatform.rb +0 -12
@@ -0,0 +1,76 @@
|
|
1
|
+
{
|
2
|
+
"code" : 200,
|
3
|
+
"data" : [
|
4
|
+
{
|
5
|
+
"size" : 68727,
|
6
|
+
"url" : "http://d3lawkbdj6aabd.cloudfront.net/singleplatform/image/upload/c_fit/e8adb3eebbdfd228adddde03d20eac16cda3b253.jpg",
|
7
|
+
"items" : [
|
8
|
+
38071828
|
9
|
+
],
|
10
|
+
"main_image" : false,
|
11
|
+
"type" : "unclassified",
|
12
|
+
"photo_id" : "e8adb3eebbdfd228adddde03d20eac16cda3b253",
|
13
|
+
"title" : "Key Lime Pie",
|
14
|
+
"original_height" : 672,
|
15
|
+
"location_id" : "island-prime",
|
16
|
+
"source" : "singleplatform",
|
17
|
+
"original_width" : 1000
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"main_image" : false,
|
21
|
+
"items" : [
|
22
|
+
25766102
|
23
|
+
],
|
24
|
+
"url" : "http://d3lawkbdj6aabd.cloudfront.net/singleplatform/image/upload/c_fit/0cec0bda6bcf6cd598e5a98856decf0473e1040c.jpg",
|
25
|
+
"size" : 74119,
|
26
|
+
"location_id" : "island-prime",
|
27
|
+
"source" : "singleplatform",
|
28
|
+
"original_width" : 1000,
|
29
|
+
"title" : "Indigo Grill's Cedar Plank Salmon",
|
30
|
+
"original_height" : 667,
|
31
|
+
"photo_id" : "0cec0bda6bcf6cd598e5a98856decf0473e1040c",
|
32
|
+
"type" : "unclassified"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"size" : 71897,
|
36
|
+
"url" : "http://d3lawkbdj6aabd.cloudfront.net/singleplatform/image/upload/c_fit/a3b8de0f48c57ea83c252c7e34f5f3cef919f2f1.jpg",
|
37
|
+
"main_image" : false,
|
38
|
+
"items" : [
|
39
|
+
25765874
|
40
|
+
],
|
41
|
+
"photo_id" : "a3b8de0f48c57ea83c252c7e34f5f3cef919f2f1",
|
42
|
+
"type" : "Product",
|
43
|
+
"source" : "singleplatform",
|
44
|
+
"location_id" : "island-prime",
|
45
|
+
"original_width" : 682,
|
46
|
+
"title" : "Seared Ahi Stack",
|
47
|
+
"original_height" : 960
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"url" : "http://d3lawkbdj6aabd.cloudfront.net/singleplatform/image/upload/c_fit/e07ae758f89643623eb485192b76e3caba119566.jpg",
|
51
|
+
"size" : 60647,
|
52
|
+
"main_image" : false,
|
53
|
+
"items" : [],
|
54
|
+
"photo_id" : "e07ae758f89643623eb485192b76e3caba119566",
|
55
|
+
"type" : "Product",
|
56
|
+
"original_width" : 730,
|
57
|
+
"source" : "singleplatform",
|
58
|
+
"location_id" : "island-prime",
|
59
|
+
"title" : "yt",
|
60
|
+
"original_height" : 960
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"source" : "singleplatform",
|
64
|
+
"original_width" : 960,
|
65
|
+
"location_id" : "island-prime",
|
66
|
+
"title" : "y7",
|
67
|
+
"original_height" : 672,
|
68
|
+
"photo_id" : "a27ca88722438dd0952f826c07867f4eda8f0b3c",
|
69
|
+
"type" : "Exterior",
|
70
|
+
"main_image" : true,
|
71
|
+
"items" : [],
|
72
|
+
"url" : "http://d3lawkbdj6aabd.cloudfront.net/singleplatform/image/upload/c_fit/a27ca88722438dd0952f826c07867f4eda8f0b3c.jpg",
|
73
|
+
"size" : 145895
|
74
|
+
}
|
75
|
+
]
|
76
|
+
}
|
@@ -0,0 +1,233 @@
|
|
1
|
+
{
|
2
|
+
"code" : 200,
|
3
|
+
"data" : {
|
4
|
+
"results" : [
|
5
|
+
{
|
6
|
+
"hours" : {
|
7
|
+
"wednesday" : [
|
8
|
+
{
|
9
|
+
"opening" : "09:00am",
|
10
|
+
"description" : "",
|
11
|
+
"closing" : "06:00pm"
|
12
|
+
}
|
13
|
+
],
|
14
|
+
"thursday" : [
|
15
|
+
{
|
16
|
+
"closing" : "05:00pm",
|
17
|
+
"description" : "",
|
18
|
+
"opening" : "09:00am"
|
19
|
+
}
|
20
|
+
],
|
21
|
+
"saturday" : [
|
22
|
+
{
|
23
|
+
"description" : "",
|
24
|
+
"closing" : "closed",
|
25
|
+
"opening" : "closed"
|
26
|
+
}
|
27
|
+
],
|
28
|
+
"monday" : [
|
29
|
+
{
|
30
|
+
"opening" : "09:00am",
|
31
|
+
"closing" : "05:00pm",
|
32
|
+
"description" : ""
|
33
|
+
}
|
34
|
+
],
|
35
|
+
"sunday" : [
|
36
|
+
{
|
37
|
+
"closing" : "closed",
|
38
|
+
"description" : "",
|
39
|
+
"opening" : "closed"
|
40
|
+
}
|
41
|
+
],
|
42
|
+
"friday" : [
|
43
|
+
{
|
44
|
+
"opening" : "09:00am",
|
45
|
+
"description" : "",
|
46
|
+
"closing" : "05:00pm"
|
47
|
+
}
|
48
|
+
],
|
49
|
+
"tuesday" : [
|
50
|
+
{
|
51
|
+
"description" : "",
|
52
|
+
"closing" : "05:00pm",
|
53
|
+
"opening" : "09:00am"
|
54
|
+
}
|
55
|
+
],
|
56
|
+
"holiday_schedule" : [
|
57
|
+
"Closed Christmas Day\r\nClosed New Year's Day\r\nClosed on Labor Day\r\nClosed on Memorial Day\r\nClosed on Thanksgiving and the day following Thanksgiving"
|
58
|
+
]
|
59
|
+
},
|
60
|
+
"is_published" : true,
|
61
|
+
"published_at" : "2013-09-06 12:13:47.408897",
|
62
|
+
"foreign_ids" : {
|
63
|
+
"yelp" : "fw71vSEdGCehdB61CwgqhA",
|
64
|
+
"salesforce-real" : "a0Cd000000BNh42EAD",
|
65
|
+
"foursquare" : "4d572d68cff7721ed570bff5"
|
66
|
+
},
|
67
|
+
"time_zone" : "PST",
|
68
|
+
"updated" : "2012-04-23T17:23:46.000000Z-0400",
|
69
|
+
"name" : "GT Recording",
|
70
|
+
"business_type" : "Business & Professional Services",
|
71
|
+
"created" : "2012-04-06T10:36:00.000000Z-0400",
|
72
|
+
"hasPhotos" : false,
|
73
|
+
"description" : "Blah",
|
74
|
+
"attributes" : {
|
75
|
+
"wheelchair_access" : "",
|
76
|
+
"average_price" : "None"
|
77
|
+
},
|
78
|
+
"out_of_business" : false,
|
79
|
+
"is_owner_verified" : true,
|
80
|
+
"phone" : "",
|
81
|
+
"location_id" : "gt-recording",
|
82
|
+
"website" : "http://gtrecording.com/",
|
83
|
+
"has_photos" : true,
|
84
|
+
"location" : {
|
85
|
+
"country" : "US",
|
86
|
+
"longitude" : -122.34453,
|
87
|
+
"postal_code" : "98103",
|
88
|
+
"latitude" : 47.70107,
|
89
|
+
"address1" : "9921 Aurora Ave N",
|
90
|
+
"cross_street" : "",
|
91
|
+
"city" : "Seattle",
|
92
|
+
"state" : "WA",
|
93
|
+
"directions" : "",
|
94
|
+
"address2" : "",
|
95
|
+
"neighborhood" : "Greenwood, Oaktree"
|
96
|
+
},
|
97
|
+
"email" : ""
|
98
|
+
},
|
99
|
+
{
|
100
|
+
"attributes" : {
|
101
|
+
"wheelchair_access" : true,
|
102
|
+
"average_price" : "2000"
|
103
|
+
},
|
104
|
+
"out_of_business" : false,
|
105
|
+
"hasPhotos" : false,
|
106
|
+
"description" : "",
|
107
|
+
"location_id" : "robbins-law-office",
|
108
|
+
"is_owner_verified" : true,
|
109
|
+
"phone" : "",
|
110
|
+
"has_photos" : true,
|
111
|
+
"website" : "http://lawyerinpuyallup.com/",
|
112
|
+
"email" : "cmrobbins@qwest.net",
|
113
|
+
"location" : {
|
114
|
+
"longitude" : -122.29293,
|
115
|
+
"country" : "US",
|
116
|
+
"latitude" : 47.19297,
|
117
|
+
"postal_code" : "98372",
|
118
|
+
"address1" : "122 E Stewart Ave",
|
119
|
+
"cross_street" : "",
|
120
|
+
"city" : "Puyallup",
|
121
|
+
"state" : "WA",
|
122
|
+
"directions" : "",
|
123
|
+
"neighborhood" : "",
|
124
|
+
"address2" : ""
|
125
|
+
},
|
126
|
+
"hours" : {
|
127
|
+
"thursday" : [
|
128
|
+
{
|
129
|
+
"opening" : "09:00am",
|
130
|
+
"closing" : "06:00pm",
|
131
|
+
"description" : ""
|
132
|
+
}
|
133
|
+
],
|
134
|
+
"tuesday" : [
|
135
|
+
{
|
136
|
+
"opening" : "09:00am",
|
137
|
+
"closing" : "06:00pm",
|
138
|
+
"description" : ""
|
139
|
+
}
|
140
|
+
],
|
141
|
+
"friday" : [
|
142
|
+
{
|
143
|
+
"closing" : "06:00pm",
|
144
|
+
"description" : "",
|
145
|
+
"opening" : "09:00am"
|
146
|
+
}
|
147
|
+
],
|
148
|
+
"saturday" : [
|
149
|
+
{
|
150
|
+
"closing" : "closed",
|
151
|
+
"description" : "",
|
152
|
+
"opening" : "closed"
|
153
|
+
}
|
154
|
+
],
|
155
|
+
"monday" : [
|
156
|
+
{
|
157
|
+
"description" : "",
|
158
|
+
"closing" : "06:00pm",
|
159
|
+
"opening" : "09:00am"
|
160
|
+
}
|
161
|
+
],
|
162
|
+
"wednesday" : [
|
163
|
+
{
|
164
|
+
"description" : "",
|
165
|
+
"closing" : "06:00pm",
|
166
|
+
"opening" : "09:00am"
|
167
|
+
}
|
168
|
+
],
|
169
|
+
"sunday" : [
|
170
|
+
{
|
171
|
+
"description" : "",
|
172
|
+
"closing" : "closed",
|
173
|
+
"opening" : "closed"
|
174
|
+
}
|
175
|
+
]
|
176
|
+
},
|
177
|
+
"foreign_ids" : {
|
178
|
+
"foursquare" : "4f96b5257b0c59c3dcd9c842",
|
179
|
+
"salesforce-real" : "a0Cd000000BNgHKEA1",
|
180
|
+
"yelp" : "zXTZ-ysNxkpirnVnMKiZ5w"
|
181
|
+
},
|
182
|
+
"published_at" : "2013-09-06 12:13:45.962863",
|
183
|
+
"is_published" : true,
|
184
|
+
"created" : "2012-03-19T13:45:39.000000Z-0400",
|
185
|
+
"name" : "Robbins Law Office",
|
186
|
+
"business_type" : "Legal & Financial Services",
|
187
|
+
"updated" : "2012-05-29T11:13:16.000000Z-0400",
|
188
|
+
"time_zone" : ""
|
189
|
+
},
|
190
|
+
{
|
191
|
+
"location" : {
|
192
|
+
"address2" : "",
|
193
|
+
"neighborhood" : "",
|
194
|
+
"directions" : "",
|
195
|
+
"state" : "IN",
|
196
|
+
"city" : "Kokomo",
|
197
|
+
"address1" : "1200 E Firmin St",
|
198
|
+
"cross_street" : "",
|
199
|
+
"postal_code" : "46902",
|
200
|
+
"latitude" : 40.46801,
|
201
|
+
"country" : "US",
|
202
|
+
"longitude" : -86.11673
|
203
|
+
},
|
204
|
+
"email" : "",
|
205
|
+
"has_photos" : true,
|
206
|
+
"website" : "http://bmwinvestproperties.com/default.aspx",
|
207
|
+
"is_owner_verified" : true,
|
208
|
+
"phone" : "",
|
209
|
+
"location_id" : "bmw-properties",
|
210
|
+
"description" : "Blah",
|
211
|
+
"hasPhotos" : false,
|
212
|
+
"attributes" : {
|
213
|
+
"wheelchair_access" : true
|
214
|
+
},
|
215
|
+
"out_of_business" : false,
|
216
|
+
"time_zone" : "",
|
217
|
+
"updated" : "2012-07-02T13:08:45.000000Z-0400",
|
218
|
+
"business_type" : "Non Food & Beverage Retail",
|
219
|
+
"name" : "Bmw Properties",
|
220
|
+
"created" : "2012-03-22T14:29:57.000000Z-0400",
|
221
|
+
"is_published" : true,
|
222
|
+
"published_at" : "2013-09-06 12:13:45.958872",
|
223
|
+
"foreign_ids" : {
|
224
|
+
"foursquare" : "4f95bc17754af8efd41a7704",
|
225
|
+
"salesforce-real" : "a0Cd000000BNguSEAT",
|
226
|
+
"yelp" : "ypV03hS8jFNrrnkVEWLfSQ"
|
227
|
+
},
|
228
|
+
"hours" : {}
|
229
|
+
}
|
230
|
+
],
|
231
|
+
"next" : "http://publishing-api.singleplatform.com/locations/updated_since?date=2012-11-16T18:34:04.000000Z-0500&limit=11"
|
232
|
+
}
|
233
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: singleplatform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Gharakhanian
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- ".gitignore"
|
49
49
|
- Gemfile
|
50
50
|
- Gemfile.lock
|
51
|
+
- LICENSE.txt
|
51
52
|
- README.md
|
52
53
|
- Rakefile
|
53
54
|
- lib/singleplatform.rb
|
@@ -55,11 +56,21 @@ files:
|
|
55
56
|
- lib/singleplatform/client/locations.rb
|
56
57
|
- lib/singleplatform/client/menus.rb
|
57
58
|
- lib/singleplatform/client/photos.rb
|
58
|
-
- lib/singleplatform/
|
59
|
+
- lib/singleplatform/error.rb
|
60
|
+
- lib/singleplatform/request.rb
|
61
|
+
- lib/singleplatform/response.rb
|
59
62
|
- lib/singleplatform/version.rb
|
60
63
|
- singleplatform.gemspec
|
61
|
-
-
|
62
|
-
-
|
64
|
+
- spec/singleplatform/client/locations_spec.rb
|
65
|
+
- spec/singleplatform/client/menus_spec.rb
|
66
|
+
- spec/singleplatform/client/photos_spec.rb
|
67
|
+
- spec/singleplatform/client_spec.rb
|
68
|
+
- spec/singleplatform_spec.rb
|
69
|
+
- spec/spec_helper.rb
|
70
|
+
- spec/support/fixtures/location.json
|
71
|
+
- spec/support/fixtures/menus.json
|
72
|
+
- spec/support/fixtures/photos.json
|
73
|
+
- spec/support/fixtures/updated_since.json
|
63
74
|
homepage: http://github.com/okayjeff/singleplatform
|
64
75
|
licenses:
|
65
76
|
- MIT
|
@@ -80,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
91
|
version: '0'
|
81
92
|
requirements: []
|
82
93
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
94
|
+
rubygems_version: 2.6.6
|
84
95
|
signing_key:
|
85
96
|
specification_version: 4
|
86
97
|
summary: A Ruby client library for accessing the SinglePlatform API.
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'httparty'
|
2
|
-
require 'hashie'
|
3
|
-
|
4
|
-
module Singleplatform
|
5
|
-
class Request
|
6
|
-
# Make an HTTP get request to given URL
|
7
|
-
#
|
8
|
-
# @param url [String]
|
9
|
-
# @return [Hashie::Mash]
|
10
|
-
def self.get(url)
|
11
|
-
tries ||= 3
|
12
|
-
response = HTTParty.get(url)
|
13
|
-
rescue
|
14
|
-
sleep 3
|
15
|
-
if tries -= 1 > 0
|
16
|
-
retry
|
17
|
-
else
|
18
|
-
nil
|
19
|
-
end
|
20
|
-
else
|
21
|
-
Hashie::Mash.new(JSON.parse(response.body)).data
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
require 'singleplatform'
|
3
|
-
|
4
|
-
class Singleplatform::ClientTest < Minitest::Test
|
5
|
-
def test_urls_generate_correctly
|
6
|
-
client = Singleplatform::Client.new(
|
7
|
-
client_id: 'purplespacesuitfrogboots1',
|
8
|
-
client_secret: 'yellowsubmarinesresonatewithmeandmybestbros'
|
9
|
-
)
|
10
|
-
path = '/locations/updated_since/'
|
11
|
-
params = { date: '2016-08-01', limit: 100 }
|
12
|
-
url = client.generate_url(path, params)
|
13
|
-
assert_equal('http://publishing-api.singleplatform.com/locations/updated_since/?date=2016-08-01&limit=100&client=purplespacesuitfrogboots1&signature=D4mf0vL2jwJKU02OawPlXFXQymg%3D', url)
|
14
|
-
end
|
15
|
-
end
|
data/test/test_singleplatform.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
require 'singleplatform'
|
3
|
-
|
4
|
-
class SingleplatformTest < Minitest::Test
|
5
|
-
def test_new_creates_new_client_object
|
6
|
-
client = Singleplatform.new(
|
7
|
-
client_id: 'purplespacesuitfrogboots1',
|
8
|
-
client_secret: 'yellowsubmarinesresonatewithmeandmybestbros'
|
9
|
-
)
|
10
|
-
assert_instance_of(Singleplatform::Client, client)
|
11
|
-
end
|
12
|
-
end
|