delivery 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/delivery/client.rb +8 -2
- data/lib/delivery/version.rb +1 -1
- data/test/fixtures/info.json +2 -0
- data/test/test_client.rb +8 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c09cce28f0a9b2ba0fece397339539cc0c994e4
|
4
|
+
data.tar.gz: d65ebd378fc6f38ec081ce3d378182ae8be23224
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dc112ad3e71eab478c27976924b27ff264f7e1208ecd359a58a9e3c732d990ab285299aa1032b1fc223bf1272dc4774a1600f34ba8fe271b575ece240e4ea2e
|
7
|
+
data.tar.gz: f212690a98f92c2b79dcc243e9a94b45431a56453754d16105b5b8521da0dad1d9de60b7c9073684c93130361cd2ffef91553ff501c4ea321e2c34b2e2b0ea31
|
data/README.md
CHANGED
data/lib/delivery/client.rb
CHANGED
@@ -17,8 +17,14 @@ module Delivery
|
|
17
17
|
|
18
18
|
def search address
|
19
19
|
options = {query: {client_id: client_id, address: address}}
|
20
|
-
|
21
|
-
Hashie::Mash.new(JSON.parse(
|
20
|
+
response = self.class.get("#{base_uri}/merchant/search/delivery", options)
|
21
|
+
Hashie::Mash.new(JSON.parse(response.body))
|
22
|
+
end
|
23
|
+
|
24
|
+
def info id
|
25
|
+
options = {query: {client_id: client_id}}
|
26
|
+
response = self.class.get("#{base_uri}/merchant/#{id}", options)
|
27
|
+
Hashie::Mash.new(JSON.parse(response.body))
|
22
28
|
end
|
23
29
|
end
|
24
30
|
end
|
data/lib/delivery/version.rb
CHANGED
@@ -0,0 +1,2 @@
|
|
1
|
+
|
2
|
+
{"message":[],"merchant":{"id":"752","location":{"street":"3 HANOVER SQ","city":"NEW YORK","state":"NY","zip":"10004","longitude":-74.009519,"latitude":40.70479,"landmark":""},"summary":{"name":"Underground Pizza","phone":"555-555-5555","description":"Not your typical New York style pizza, but the pies are plentiful and with lots of fresh toppings. Stop here for a quick slice during the busy lunch hour.","overall_rating":87,"num_ratings":15,"type":"R","notes":"","cuisines":["Pizza"],"url":{"geo_tag":"nyc","short_tag":"underground-pizza","complete":"https:\/\/staging.delivery.com\/nyc\/underground-pizza"},"activation_date":"2000-11-01"},"ordering":{"availability":{"pickup":false,"delivery":false,"last_pickup_time":null,"last_delivery_time":null,"next_pickup_time":"2014-04-11T10:00:00-0400","next_delivery_time":"2014-04-11T10:45:00-0400"},"payment_types":["credit","gift card","promotions","cash"],"time_needed":"30","specials":null,"order_type":"delivery","minimum":{"delivery":{"lowest":10,"highest":10},"pickup":5}}}}
|
data/test/test_client.rb
CHANGED
@@ -12,4 +12,12 @@ class TestClient < Minitest::Test
|
|
12
12
|
search = @client.search '199 Water St 10038'
|
13
13
|
assert_equal 40.706888574096, search.search_address.latitude
|
14
14
|
end
|
15
|
+
|
16
|
+
def test_info
|
17
|
+
stub_request(:get, 'http://sandbox.delivery.com/merchant/752?client_id=client_id').
|
18
|
+
to_return(body: fixture('info.json'), headers: {content_type: 'application/json'})
|
19
|
+
|
20
|
+
info = @client.info 752
|
21
|
+
assert_equal 40.70479, info.merchant.location.latitude
|
22
|
+
end
|
15
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delivery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James A. Anderson
|
@@ -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/info.json
|
113
114
|
- test/fixtures/search.json
|
114
115
|
- test/test_client.rb
|
115
116
|
- test/test_helper.rb
|
@@ -138,6 +139,7 @@ signing_key:
|
|
138
139
|
specification_version: 4
|
139
140
|
summary: A Ruby interface to the Delivery.com API
|
140
141
|
test_files:
|
142
|
+
- test/fixtures/info.json
|
141
143
|
- test/fixtures/search.json
|
142
144
|
- test/test_client.rb
|
143
145
|
- test/test_helper.rb
|