xdelivery 1.0.0 → 1.0.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
- SHA1:
3
- metadata.gz: 32e729a05b87441921a17b67e77554b16d1115b0
4
- data.tar.gz: 9a1734fc97bb1424e72cbf0b637d2ca2996cb592
2
+ SHA256:
3
+ metadata.gz: 6ed303bad8a770ac7c39f31b93e5e5901d92faef2c8362304031f453e6630210
4
+ data.tar.gz: 204deb46037e44ba3e0a471e5b2f1b3faf8722907a8a4b694226abfbb205e614
5
5
  SHA512:
6
- metadata.gz: f66bfcdad33a55d88e597c722995ad7611a5efea9af5dadcc17c1fcbebecb374b2c203f4c7446aba88bf390efb6364296e6347d0e4f1f27a053fb7a6244bb0a3
7
- data.tar.gz: 8819f364dfa29f97ca66f4e44cc7cc0e76f71848b97a77d25e54ff3e0cde36a17701c9fda6182fd59ac28ecb5f948da25dda4267fdd7a607b91ab70e0778e435
6
+ metadata.gz: 95de1b1114ccae53265de8ebfcc2f3ad2d5c0cd539b6dcff73faf6584c02e6b0681c982ffda7f895af48ed2f8a9ff04dc4561bf8586de7979e5452f38ab24f25
7
+ data.tar.gz: 407f8bf9b6072a879730c66eb08d19e8c3a35a7cef93155ac8baf5abb0d8cc30d6e863faa0c129b36409dfc252958d6f27c53ae76774e3a116e7aad7043000b5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xdelivery (1.0.0)
4
+ xdelivery (1.0.1)
5
5
  rest-client
6
6
 
7
7
  GEM
@@ -50,4 +50,4 @@ DEPENDENCIES
50
50
  xdelivery!
51
51
 
52
52
  BUNDLED WITH
53
- 1.16.6
53
+ 1.17.3
@@ -17,6 +17,34 @@ require "xdelivery/api/response/shops"
17
17
 
18
18
 
19
19
  module Xdelivery
20
+
21
+ @@open_timeout = 5
22
+ @@read_timeout = 5
23
+
24
+ def self.open_timeout
25
+ @@open_timeout
26
+ end
27
+
28
+ def self.open_timeout=(timeout)
29
+ @@open_timeout = timeout
30
+ end
31
+
32
+ def self.read_timeout
33
+ @@read_timeout
34
+ end
35
+
36
+ def self.read_timeout=(timeout)
37
+ @@read_timeout = timeout
38
+ end
39
+
40
+ # Xdelivery.configure do |config|
41
+ # config.open_timeout = 5
42
+ # config.read_timeout = 5
43
+ # end
44
+ def self.configure
45
+ yield(self)
46
+ end
47
+
20
48
  def url
21
49
  API::Base::BASE_URL
22
50
  end
@@ -16,23 +16,31 @@ module Xdelivery
16
16
  protected
17
17
 
18
18
  def patch(path)
19
- RestClient.patch(uri(path).to_s, patch_data)
19
+ RestClient::Request.execute(method: :patch, url: uri(path).to_s, payload: patch_data, open_timeout: open_timeout, read_timeout: read_timeout)
20
20
  rescue RestClient::ExceptionWithResponse => e
21
21
  e.response
22
22
  end
23
23
 
24
24
  def post(path)
25
- RestClient.post(uri(path).to_s, post_data)
25
+ RestClient::Request.execute(method: :post, url: uri(path).to_s, payload: post_data, open_timeout: open_timeout, read_timeout: read_timeout)
26
26
  rescue RestClient::ExceptionWithResponse => e
27
27
  e.response
28
28
  end
29
29
 
30
30
  def get(path)
31
- RestClient.get(uri(path).to_s)
31
+ RestClient::Request.execute(method: :get, url: uri(path).to_s, open_timeout: open_timeout, read_timeout: read_timeout)
32
32
  rescue RestClient::ExceptionWithResponse => e
33
33
  e.response
34
34
  end
35
35
 
36
+ def open_timeout
37
+ Xdelivery.open_timeout
38
+ end
39
+
40
+ def read_timeout
41
+ Xdelivery.read_timeout
42
+ end
43
+
36
44
  # [GET] query string params
37
45
  def params
38
46
  {}
@@ -1,3 +1,3 @@
1
1
  module Xdelivery
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xdelivery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - eddie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-21 00:00:00.000000000 Z
11
+ date: 2020-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,9 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  requirements: []
134
- rubyforge_project:
135
- rubygems_version: 2.4.8
134
+ rubygems_version: 3.0.8
136
135
  signing_key:
137
136
  specification_version: 4
138
- summary: "火箭快遞 API 串接"
137
+ summary: 火箭快遞 API 串接
139
138
  test_files: []