takuhai_status 1.2.0 → 1.3.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/sagawa.rb +14 -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: 41c1c118ffc27f4ee1d7d49d814d1c32bd1b8918
|
4
|
+
data.tar.gz: 5e0cb11bb1733ef54ea1bb49705d185f1ad45011
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bc7dc093158478be889ce62bad9a50d401521376a47c87893382b9200d3eca907dcffa6d83c870fe73e236b24930fd2e64e97f64c1dd4909d1ad148bc4dee9b
|
7
|
+
data.tar.gz: da5240397fc3f8833e58abb7358b06b0eb0c633dae14600b0bdec90543f6705565288f6a8284e96e0cc2494ac9ed76f2dbb2c3ba34812425d6c8a1a24e560752
|
@@ -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
|
@@ -21,28 +21,21 @@ module TakuhaiStatus
|
|
21
21
|
doc = Nokogiri(res.body)
|
22
22
|
|
23
23
|
begin
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
raise NotMyKey.new('invalid key')
|
28
|
-
end
|
29
|
-
if state_line == 'お問い合わせのデータは登録されておりません。'
|
30
|
-
raise NotMyKey.new('not entry yet')
|
31
|
-
end
|
32
|
-
|
33
|
-
state = state_line.split(/[ \u{a0}]+/).last
|
34
|
-
|
35
|
-
begin
|
36
|
-
s = state_line.sub(/^[^0-9]+/, '')
|
37
|
-
s = state_line if s.empty?
|
38
|
-
time = Time.parse(s.gsub(/[^0-9 :]/, '-'))
|
39
|
-
rescue ArgumentError
|
40
|
-
ship = table.css('tr td')[1].text.strip.gsub(/[^0-9]/, '-')
|
41
|
-
time = Time.parse(ship) rescue Time.now
|
42
|
-
end
|
24
|
+
cells = doc.css('.table_okurijo_detail2').css('tr').last.css('td')
|
25
|
+
state = "#{cells[0].text.strip} [#{cells[2].text.strip}]".sub(/^./, '')
|
26
|
+
time = Time.parse(cells[1].text.strip)
|
43
27
|
return time, state
|
44
28
|
rescue NoMethodError
|
45
|
-
|
29
|
+
begin
|
30
|
+
time = Time.now
|
31
|
+
state = doc.css('.table_okurijo_detail').first.css('tr').last.css('td').text.strip
|
32
|
+
if state == '恐れ入りますが、お問い合せ送り状NOをお確かめください。'
|
33
|
+
raise NotMyKey.new('invalid key')
|
34
|
+
end
|
35
|
+
return time, state
|
36
|
+
rescue NoMethodError
|
37
|
+
raise NotMyKey.new('invalid response')
|
38
|
+
end
|
46
39
|
rescue ArgumentError
|
47
40
|
return Time.now, ''
|
48
41
|
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.3.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: 2015-11-
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|