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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48c22b9804a015f984b5895c9db5ec4dc33439bd
4
- data.tar.gz: c9338153fe7e7c6bcd8ce2250a51d7e1d6687d48
3
+ metadata.gz: 8c09cce28f0a9b2ba0fece397339539cc0c994e4
4
+ data.tar.gz: d65ebd378fc6f38ec081ce3d378182ae8be23224
5
5
  SHA512:
6
- metadata.gz: 7a1bf11d93ee2af759030bbe06f59ec7d07ca49ce3bd24f79398cd039fb38a5821ef44066b71f4baf7bd48c52fac22017cb81b3297a4ad70ced48fb265568f09
7
- data.tar.gz: 94ec00bda7253a1c1137241027e3d76ba9df6d45714d9ff92f2afc6c6424a346d7f8f89817bb122da4172ff5b69fe35d4d8db47117e7e9005037128acd9d8c8b
6
+ metadata.gz: 4dc112ad3e71eab478c27976924b27ff264f7e1208ecd359a58a9e3c732d990ab285299aa1032b1fc223bf1272dc4774a1600f34ba8fe271b575ece240e4ea2e
7
+ data.tar.gz: f212690a98f92c2b79dcc243e9a94b45431a56453754d16105b5b8521da0dad1d9de60b7c9073684c93130361cd2ffef91553ff501c4ea321e2c34b2e2b0ea31
data/README.md CHANGED
@@ -18,7 +18,10 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ ```ruby
22
+ client = Delivery::Client.new 'client_id'
23
+ client.search '199 Water St 10038'
24
+ ```
22
25
 
23
26
  ## Contributing
24
27
 
@@ -17,8 +17,14 @@ module Delivery
17
17
 
18
18
  def search address
19
19
  options = {query: {client_id: client_id, address: address}}
20
- r = self.class.get("#{base_uri}/merchant/search/delivery", options)
21
- Hashie::Mash.new(JSON.parse(r.body))
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
@@ -1,3 +1,3 @@
1
1
  module Delivery
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -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.1.1
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