takuhai_status 1.5.5 → 1.6.0
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/kuronekoyamato.rb +26 -1
- data/lib/takuhai_status/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c630d804caccce7d61bcc24dacec718ab4f1227
|
4
|
+
data.tar.gz: 12a793692ca21e6029277ccf4e4af8de94d37b17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee46e621ff631421b75a7248357b5aea4be4b284944b18523a757360f3c6a0792aaa52969113b3e9eb3d7160231752378f5dadbcaf3fb5e1b46736ba617f277f
|
7
|
+
data.tar.gz: ce833d64e553e4e2baf3521663e62bcb8f752775104fb752e5b2b9a8f625c87ea25c089d4e28a5c1972e3b25dcad0df260b1154f7ee46836bc91176850c19fd2
|
@@ -11,7 +11,7 @@ module TakuhaiStatus
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def finish?
|
14
|
-
return !!(@state =~ /^(お客様引渡|配達|投函)
|
14
|
+
return !!(@state =~ /^(お客様引渡|配達|投函)完了|返品/)
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
@@ -27,6 +27,14 @@ module TakuhaiStatus
|
|
27
27
|
stime = tr.css('td')[3].text
|
28
28
|
time = Time.parse("#{sday} #{stime}")
|
29
29
|
|
30
|
+
if state == '国内到着'
|
31
|
+
begin
|
32
|
+
time, state = global_state(doc)
|
33
|
+
rescue
|
34
|
+
$stderr.puts "error in yamato global, about #{key}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
30
38
|
return time, state
|
31
39
|
rescue NoMethodError
|
32
40
|
raise NotMyKey
|
@@ -34,5 +42,22 @@ module TakuhaiStatus
|
|
34
42
|
return Time.now, state || ''
|
35
43
|
end
|
36
44
|
end
|
45
|
+
|
46
|
+
def global_state(doc)
|
47
|
+
form = doc.css('form[method=POST]')
|
48
|
+
values = form.css('input[type=hidden]').map{|x| [x[:name], x[:value]]}.flatten
|
49
|
+
params = Hash[*values]
|
50
|
+
|
51
|
+
res = Faraday.new.post(
|
52
|
+
'http://globaltoi.kuronekoyamato.co.jp/Global/outside',
|
53
|
+
params
|
54
|
+
)
|
55
|
+
html = res.body.force_encoding('Shift_JIS').encode('UTF-8')
|
56
|
+
tr = Nokogiri(html).css('table.detail tr')
|
57
|
+
state = tr[tr.size-1].css('td')[1].text
|
58
|
+
loc = tr[tr.size-1].css('td')[4].text.strip.chop.chop
|
59
|
+
stime = "#{tr[tr.size-1].css('td')[2].text} #{tr[tr.size-1].css('td')[3].text}"
|
60
|
+
return Time.parse(stime), "#{state}[#{loc}]"
|
61
|
+
end
|
37
62
|
end
|
38
63
|
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.
|
4
|
+
version: 1.6.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-09-14 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.13
|
158
158
|
signing_key:
|
159
159
|
specification_version: 4
|
160
160
|
summary: get delivery status of Takuhai-bin in Japan
|