takuhai_status 1.6.0 → 1.7.0
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 +5 -5
- data/lib/takuhai_status.rb +15 -2
- data/lib/takuhai_status/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 94819f602a3689e653e35416adc771c0f4af070edac50ab4656a2f87352ca575
|
4
|
+
data.tar.gz: 2d285e5b188cbc32c3fd8791d7d7ccc111329d35ed4dd260a3d9bd45e81a3af5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49e18a982e1ae00d8d08e25029eed7d6fbb828fc989e7beb0ec909e67d42bfc557de8a64092797d54bdc71bc4f54320fe817ff195b311d02063f35a0fa1bd9f0
|
7
|
+
data.tar.gz: e45694dd0bd3cf5ed03b9f9b989e41f888dee830b29bfdc4066a1231ad4e463e9abff6150a455ee25ca9b62e10f3b0d8a50734ab8a41aefc08c1b2ba24b711a8
|
data/lib/takuhai_status.rb
CHANGED
@@ -6,6 +6,9 @@ require "takuhai_status/tmg_cargo"
|
|
6
6
|
require "takuhai_status/ups"
|
7
7
|
require "takuhai_status/fedex"
|
8
8
|
|
9
|
+
require "logger"
|
10
|
+
require "timeout"
|
11
|
+
|
9
12
|
module TakuhaiStatus
|
10
13
|
class NotFound < StandardError; end
|
11
14
|
class NotMyKey < StandardError; end
|
@@ -17,11 +20,21 @@ module TakuhaiStatus
|
|
17
20
|
end
|
18
21
|
end
|
19
22
|
|
20
|
-
def self.scan(key)
|
23
|
+
def self.scan(key, timeout: 10, logger: Logger.new(nil))
|
21
24
|
services = []
|
22
25
|
[].tap{|threads|
|
23
26
|
[Sagawa, JapanPost, KuronekoYamato, TMGCargo, UPS, FedEx].each do |service|
|
24
|
-
threads.push(Thread.new{
|
27
|
+
threads.push(Thread.new{
|
28
|
+
name = service.to_s.sub(/^.*::/, '')
|
29
|
+
begin
|
30
|
+
Timeout.timeout(timeout, Timeout::Error, "Timeout in #{name}(#{key})") do
|
31
|
+
service.new(key)
|
32
|
+
end
|
33
|
+
rescue Timeout::Error, Faraday::TimeoutError => e
|
34
|
+
logger.error e.message
|
35
|
+
raise NotMyKey.new(e.message)
|
36
|
+
end
|
37
|
+
})
|
25
38
|
end
|
26
39
|
}.each{|thread|
|
27
40
|
begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: takuhai_status
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TADA Tadashi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
156
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.6.
|
157
|
+
rubygems_version: 2.6.14
|
158
158
|
signing_key:
|
159
159
|
specification_version: 4
|
160
160
|
summary: get delivery status of Takuhai-bin in Japan
|