xdelivery 1.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/xdelivery/api/base.rb +11 -2
- data/lib/xdelivery/version.rb +1 -1
- data/lib/xdelivery.rb +16 -2
- data/xdelivery-ruby.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4132949513399d9773c0021150b37da3380276ad4b9903a35fe06dba6885bc7
|
4
|
+
data.tar.gz: 69cda66c0ef6bb3f3ec0224657f3343b6fc1d9cabe5727377305e29f4f6ee5db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 268ce156a1867e4502ddcb6644160723c2e10901dbae8c78cdb1d45421945c00f4735936fd94a210189f5c2e24c605586329c1919422b1359ac617fe73deab59
|
7
|
+
data.tar.gz: 0cd32c3cc6faed133b8fe5d5aea7e09bbe7d7f4887b0ca5e91a950c01a9940e09125a26bba9c2eec1ece435896ba17119ec2def6d3698e9a7ec7f22ad0604b08
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
xdelivery (
|
4
|
+
xdelivery (2.0.0)
|
5
5
|
rest-client
|
6
6
|
|
7
7
|
GEM
|
@@ -41,7 +41,7 @@ PLATFORMS
|
|
41
41
|
ruby
|
42
42
|
|
43
43
|
DEPENDENCIES
|
44
|
-
bundler (~>
|
44
|
+
bundler (~> 2.3.14)
|
45
45
|
minitest (~> 5.0)
|
46
46
|
minitest-stub-const
|
47
47
|
rake (~> 10.0)
|
@@ -50,4 +50,4 @@ DEPENDENCIES
|
|
50
50
|
xdelivery!
|
51
51
|
|
52
52
|
BUNDLED WITH
|
53
|
-
|
53
|
+
2.3.14
|
data/lib/xdelivery/api/base.rb
CHANGED
@@ -6,13 +6,22 @@ module Xdelivery
|
|
6
6
|
class Base
|
7
7
|
attr_accessor :merchant_no, :access_key
|
8
8
|
|
9
|
-
|
9
|
+
PRODUCTION_BASE_URL = 'https://api.xdelivery.io'
|
10
|
+
TEST_BASE_URL = 'https://api.staging.xdelivery.io'
|
10
11
|
|
11
12
|
def initialize(merchant_no='', access_key='')
|
12
13
|
self.merchant_no = merchant_no
|
13
14
|
self.access_key = access_key
|
14
15
|
end
|
15
16
|
|
17
|
+
def base_url
|
18
|
+
@base_url = if ::Xdelivery.production?
|
19
|
+
PRODUCTION_BASE_URL
|
20
|
+
else
|
21
|
+
TEST_BASE_URL
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
16
25
|
protected
|
17
26
|
|
18
27
|
def patch(path)
|
@@ -59,7 +68,7 @@ module Xdelivery
|
|
59
68
|
private
|
60
69
|
|
61
70
|
def uri(path)
|
62
|
-
uri = URI.parse("#{
|
71
|
+
uri = URI.parse("#{base_url}#{path}").tap { |u| u.query = query_auth_params }
|
63
72
|
end
|
64
73
|
|
65
74
|
def query_auth_params
|
data/lib/xdelivery/version.rb
CHANGED
data/lib/xdelivery.rb
CHANGED
@@ -22,6 +22,16 @@ module Xdelivery
|
|
22
22
|
@@open_timeout = 5
|
23
23
|
@@read_timeout = 5
|
24
24
|
|
25
|
+
@@env = :production
|
26
|
+
|
27
|
+
def self.env
|
28
|
+
@@env
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.env=(env)
|
32
|
+
@@env = env
|
33
|
+
end
|
34
|
+
|
25
35
|
def self.open_timeout
|
26
36
|
@@open_timeout
|
27
37
|
end
|
@@ -46,7 +56,11 @@ module Xdelivery
|
|
46
56
|
yield(self)
|
47
57
|
end
|
48
58
|
|
49
|
-
def
|
50
|
-
|
59
|
+
def self.production?
|
60
|
+
@@env.to_s == "production"
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.test?
|
64
|
+
@@env.to_s == "test"
|
51
65
|
end
|
52
66
|
end
|
data/xdelivery-ruby.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
-
spec.add_development_dependency "bundler", "~>
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.3.14"
|
27
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
28
28
|
spec.add_development_dependency "minitest", "~> 5.0"
|
29
29
|
spec.add_development_dependency "minitest-stub-const"
|
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:
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- eddie
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.3.14
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.3.14
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
135
|
+
rubygems_version: 3.1.6
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: 火箭快遞 API 串接
|