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 +5 -5
- data/Gemfile.lock +2 -2
- data/lib/xdelivery.rb +28 -0
- data/lib/xdelivery/api/base.rb +11 -3
- data/lib/xdelivery/version.rb +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6ed303bad8a770ac7c39f31b93e5e5901d92faef2c8362304031f453e6630210
|
4
|
+
data.tar.gz: 204deb46037e44ba3e0a471e5b2f1b3faf8722907a8a4b694226abfbb205e614
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95de1b1114ccae53265de8ebfcc2f3ad2d5c0cd539b6dcff73faf6584c02e6b0681c982ffda7f895af48ed2f8a9ff04dc4561bf8586de7979e5452f38ab24f25
|
7
|
+
data.tar.gz: 407f8bf9b6072a879730c66eb08d19e8c3a35a7cef93155ac8baf5abb0d8cc30d6e863faa0c129b36409dfc252958d6f27c53ae76774e3a116e7aad7043000b5
|
data/Gemfile.lock
CHANGED
data/lib/xdelivery.rb
CHANGED
@@ -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
|
data/lib/xdelivery/api/base.rb
CHANGED
@@ -16,23 +16,31 @@ module Xdelivery
|
|
16
16
|
protected
|
17
17
|
|
18
18
|
def patch(path)
|
19
|
-
RestClient.patch
|
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
|
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
|
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
|
{}
|
data/lib/xdelivery/version.rb
CHANGED
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.
|
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:
|
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
|
-
|
135
|
-
rubygems_version: 2.4.8
|
134
|
+
rubygems_version: 3.0.8
|
136
135
|
signing_key:
|
137
136
|
specification_version: 4
|
138
|
-
summary:
|
137
|
+
summary: 火箭快遞 API 串接
|
139
138
|
test_files: []
|