takuhai_status 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/takuhai_status/fedex.rb +15 -21
- data/lib/takuhai_status/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf89da20e44e0e1a6bb3bd04a7ebb3a62262ad70
|
4
|
+
data.tar.gz: 395dfb1a24414c4314641277b8e1c24cf03f4c6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fadbc62d29de2b0706f31f5d19ff37f6c733c2b82b89308c6921498dd26f8a29fa728e30b7566dea8dbb1980b7418211b22de6ded730dfb5c4626f86e950adb
|
7
|
+
data.tar.gz: 99c99ef0b39a47403646d4a5beb75bc1e63b44a131d48abbb7f761d46715d283e9eadea62df3d093e433856ba7ea16b914419b597bfa541faaad4dbbb99f17e8
|
data/lib/takuhai_status/fedex.rb
CHANGED
@@ -6,12 +6,12 @@ module TakuhaiStatus
|
|
6
6
|
attr_reader :key, :time, :state
|
7
7
|
|
8
8
|
def initialize(key)
|
9
|
-
@key = key
|
9
|
+
@key = key
|
10
10
|
@time, @state = check
|
11
11
|
end
|
12
12
|
|
13
13
|
def finish?
|
14
|
-
return !!(@state =~
|
14
|
+
return !!(@state =~ /認可済み業者に委託|配達完了/)
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
@@ -43,29 +43,23 @@ module TakuhaiStatus
|
|
43
43
|
version: '1',
|
44
44
|
format: 'json'
|
45
45
|
})
|
46
|
-
begin
|
47
|
-
data = JSON.parse(res.body)
|
48
|
-
raise unless data["TrackPackagesResponse"]["successful"]
|
49
46
|
|
50
|
-
|
51
|
-
|
47
|
+
package = JSON.parse(res.body)["TrackPackagesResponse"]
|
48
|
+
unless package["successful"]
|
49
|
+
raise NotMyKey.new(package["errorList"].first["message"])
|
50
|
+
end
|
52
51
|
|
53
|
-
|
54
|
-
time = Time.parse("#{current['date']} #{current['time']}#{current['+09:00']}")
|
55
|
-
rescue ArgumentError
|
56
|
-
raise NotMyKey.new('no time status in the package');
|
57
|
-
end
|
52
|
+
current = package["packageList"].first["scanEventList"].first
|
58
53
|
|
59
|
-
|
60
|
-
|
61
|
-
|
54
|
+
t_str = "#{current['date']} #{current['time']}"
|
55
|
+
raise NotMyKey.new('no time status in the package') if t_str.size == 1
|
56
|
+
time = Time.parse("#{t_str}+09:00")
|
62
57
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
end
|
58
|
+
state = "#{current['status']}"
|
59
|
+
state = "#{state}(#{current['scanDetails']})" if current['scanDetails'].size > 0
|
60
|
+
state = "#{state} - #{current['scanLocation']}" if current['scanLocation'].size > 0
|
61
|
+
|
62
|
+
return time, state
|
69
63
|
end
|
70
64
|
end
|
71
65
|
end
|
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.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TADA Tadashi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|