dianping-api 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71f0df3df1c538b4da40ad6778af54a2ccc8f58a97de536fa820ce711fe6ee2d
4
- data.tar.gz: 2ea42eed408aca26191d5a87267908b223ac8ceed534320e04cb351ead5d17a7
3
+ metadata.gz: 9d999be27de932ac3ae044dc8d4c08c899635f87943ce3fc7b739cb3b2eb4d8d
4
+ data.tar.gz: '009a90b2734a3e30fd0ae2b77b1e5ab3a5938d2c256deb8e9effa4b6c3ccf24b'
5
5
  SHA512:
6
- metadata.gz: 2efe5dde5e3a84e6952a710fc461f5f6c3b7dcb35041047e6d179e694c6894ef4f85df5d00036725ea63d36e78ef049c447cf164fc06cd7c542fe5f3981ffbba
7
- data.tar.gz: 001b13240d3878018f409fc15331b0b4e80498dbda5511df43c06437921de051024a8613630a8ed515430bf761698e3c1d89e92fb3900707db9e9678ce1c881c
6
+ metadata.gz: 6f8ee2af9d86267855fd6e1d04efa89523332117674b86540fff847fdb740a9417b1f2fcad16577222b64875418729bc6d13fa45f18a20b53b7c96164884d2d3
7
+ data.tar.gz: 94756099193ad357b47a4ee524fb346d6a810c1391cfb14a76af04aa11c1ee0aa5f1e366a8c972cebab6e679c1065152055ad6c10c704715ccfc52aa0d643ab2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dianping-api (0.1.2)
4
+ dianping-api (0.1.3)
5
5
  faraday (~> 1.0)
6
6
  multi_json (~> 1.0)
7
7
 
@@ -13,7 +13,7 @@ GEM
13
13
  coderay (1.1.3)
14
14
  crack (0.4.4)
15
15
  diff-lcs (1.4.4)
16
- faraday (1.1.0)
16
+ faraday (1.2.0)
17
17
  multipart-post (>= 1.2, < 3)
18
18
  ruby2_keywords
19
19
  ffi (1.13.1)
@@ -0,0 +1 @@
1
+ require 'dianping/api'
@@ -105,4 +105,4 @@ module Dianping
105
105
  end
106
106
  end
107
107
  end
108
- end
108
+ end
@@ -32,6 +32,8 @@ module Dianping
32
32
 
33
33
  Api.logger.debug { { response: body, msg: msg } }
34
34
 
35
+ Api.logger.warn body unless code == 200
36
+
35
37
  raise TokenExpireError, msg if code == 608
36
38
  raise UsageError, msg if code >= 800
37
39
  raise Error, msg unless code == 200
@@ -9,8 +9,10 @@ module Dianping
9
9
  def receipt_consume(shop_uuid, code, request_id, count = 1, **params)
10
10
  params.merge! open_shop_uuid: shop_uuid,
11
11
  receipt_code: code,
12
- request_id: request_id,
12
+ requestid: request_id,
13
13
  count: count
14
+ keys = %i[requestid receipt_code count open_shop_uuid app_shop_account app_shop_accountname]
15
+ raise "missing keys #{keys - params.keys}" unless (keys - params.keys).empty?
14
16
 
15
17
  post '/router/tuangou/receipt/consume', params
16
18
  end
@@ -7,7 +7,7 @@ module Dianping
7
7
 
8
8
  def initialize(client)
9
9
  @client = client
10
- @token_file = File.join('/tmp', "dianping-api-#{client.app_key}")
10
+ @token_file = File.join(ENV['TOKEN_ROOT'] || '/tmp', "dianping-api-#{client.app_key}")
11
11
  end
12
12
 
13
13
  def access_hash
@@ -54,7 +54,7 @@ module Dianping
54
54
  end
55
55
 
56
56
  def updated_at
57
- Time.parse(access_hash[:updated_at])
57
+ DateTime.parse(access_hash[:updated_at]).to_time
58
58
  end
59
59
 
60
60
  def expires_at
@@ -1,5 +1,5 @@
1
1
  module Dianping
2
2
  module Api
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dianping-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Wong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-14 00:00:00.000000000 Z
11
+ date: 2021-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -156,6 +156,7 @@ files:
156
156
  - bin/console
157
157
  - bin/setup
158
158
  - dianping-api.gemspec
159
+ - lib/dianping-api.rb
159
160
  - lib/dianping/api.rb
160
161
  - lib/dianping/api/client.rb
161
162
  - lib/dianping/api/middle_ware.rb