delivery 0.4.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/delivery/client.rb +6 -0
- data/lib/delivery/version.rb +1 -1
- data/test/fixtures/hours.json +2 -0
- data/test/test_client.rb +8 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23dd2c7f5f14830e1aa6c57e2eb6712506a5f9d0
|
4
|
+
data.tar.gz: 586d902b380b7829c6269bf84d8d813b068881dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8f32b6abce56a22c92dd9dff07e27a6fef919379108278e3f833e752770d1e5a9a3531e0d36f4a255f9b66a0fa696b7bcc488af5bc140af5df63378696a8389
|
7
|
+
data.tar.gz: 3b2c7027f93d48c38171c2c2487d75426c6c09f1b44bbf51bc5c432ef4639561b8d9055710dd2297cdd13a37718daccc6d005a0e44180a03c28f5839ca06c14e
|
data/lib/delivery/client.rb
CHANGED
@@ -35,5 +35,11 @@ module Delivery
|
|
35
35
|
Hashie::Mash.new(JSON.parse(response.body))
|
36
36
|
end
|
37
37
|
alias_method :merchant_menu, :menu
|
38
|
+
|
39
|
+
def hours(id)
|
40
|
+
options = {query: {client_id: client_id}}
|
41
|
+
response = self.class.get("#{base_uri}/merchant/#{id}/hours", options)
|
42
|
+
Hashie::Mash.new(JSON.parse(response.body))
|
43
|
+
end
|
38
44
|
end
|
39
45
|
end
|
data/lib/delivery/version.rb
CHANGED
@@ -0,0 +1,2 @@
|
|
1
|
+
|
2
|
+
{"message":[],"merchant_id":"752","merchant_name":"Underground Pizza","standard_schedule":{"business":{"sunday":{"times_open":[]},"monday":{"times_open":[{"start":"10:00","end":"21:00"}]},"tuesday":{"times_open":[{"start":"10:00","end":"21:00"}]},"wednesday":{"times_open":[{"start":"10:00","end":"21:00"}]},"thursday":{"times_open":[{"start":"10:00","end":"21:00"}]},"friday":{"times_open":[{"start":"10:00","end":"21:00"}]},"saturday":{"times_open":[{"start":"10:00","end":"19:00"}]}},"delivery":{"sunday":{"times_open":[]},"monday":{"times_open":[{"start":"10:45","end":"20:45"}]},"tuesday":{"times_open":[{"start":"10:45","end":"20:45"}]},"wednesday":{"times_open":[{"start":"10:45","end":"20:45"}]},"thursday":{"times_open":[{"start":"10:45","end":"20:45"}]},"friday":{"times_open":[{"start":"10:45","end":"20:45"}]},"saturday":{"times_open":[{"start":"10:45","end":"18:45"}]}}},"current_schedule":{"business":{"friday":{"times_open":[{"start":"10:00","end":"21:00"}],"date":"2014-04-11"},"saturday":{"times_open":[{"start":"10:00","end":"19:00"}],"date":"2014-04-12"},"sunday":{"times_open":[],"date":"2014-04-13"},"monday":{"times_open":[{"start":"10:00","end":"21:00"}],"date":"2014-04-14"},"tuesday":{"times_open":[{"start":"10:00","end":"21:00"}],"date":"2014-04-15"},"wednesday":{"times_open":[{"start":"10:00","end":"21:00"}],"date":"2014-04-16"},"thursday":{"times_open":[{"start":"10:00","end":"21:00"}],"date":"2014-04-17"}},"delivery":{"friday":{"times_open":[{"start":"10:45","end":"20:45"}],"date":"2014-04-11"},"saturday":{"times_open":[{"start":"10:45","end":"18:45"}],"date":"2014-04-12"},"sunday":{"times_open":[],"date":"2014-04-13"},"monday":{"times_open":[{"start":"10:45","end":"20:45"}],"date":"2014-04-14"},"tuesday":{"times_open":[{"start":"10:45","end":"20:45"}],"date":"2014-04-15"},"wednesday":{"times_open":[{"start":"10:45","end":"20:45"}],"date":"2014-04-16"},"thursday":{"times_open":[{"start":"10:45","end":"20:45"}],"date":"2014-04-17"}},"availability":{"pickup":false,"delivery":false}}}
|
data/test/test_client.rb
CHANGED
@@ -28,4 +28,12 @@ class TestClient < Minitest::Test
|
|
28
28
|
menu = @client.menu 752
|
29
29
|
assert_equal 'Monday Lunch Specials', menu.menu.first.name
|
30
30
|
end
|
31
|
+
|
32
|
+
def test_hours
|
33
|
+
stub_request(:get, 'http://sandbox.delivery.com/merchant/752/hours?client_id=client_id').
|
34
|
+
to_return(body: fixture('hours.json'), headers: {content_type: 'application/json'})
|
35
|
+
|
36
|
+
hours = @client.hours 752
|
37
|
+
assert_equal 'Underground Pizza', hours.merchant_name
|
38
|
+
end
|
31
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delivery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James A. Anderson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- lib/delivery.rb
|
111
111
|
- lib/delivery/client.rb
|
112
112
|
- lib/delivery/version.rb
|
113
|
+
- test/fixtures/hours.json
|
113
114
|
- test/fixtures/info.json
|
114
115
|
- test/fixtures/menu.json
|
115
116
|
- test/fixtures/search.json
|
@@ -140,6 +141,7 @@ signing_key:
|
|
140
141
|
specification_version: 4
|
141
142
|
summary: A Ruby interface to the Delivery.com API
|
142
143
|
test_files:
|
144
|
+
- test/fixtures/hours.json
|
143
145
|
- test/fixtures/info.json
|
144
146
|
- test/fixtures/menu.json
|
145
147
|
- test/fixtures/search.json
|