delivery_state_jp 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c40b5a235bb1e45de559ee17cae583d4a7c87edc
4
- data.tar.gz: 2504198e0e661289e1fc8c17a43f3e011174c677
3
+ metadata.gz: c5d8121a36e1e1602ec9beb341ab63a19caf780d
4
+ data.tar.gz: ce25cc41307a5b603ee46857bbf292a5a18425d9
5
5
  SHA512:
6
- metadata.gz: df2a18cefc73aa7be4e9bb35000ea4037bdf305ae6a7c4a456c008e0f5817b86311bb030af60844f930d2a3d4d7b6fcf3dd9f7eb57242ff342a05033e82f10c0
7
- data.tar.gz: 13f21912158a8a62f4b1a245847210085ba201bd04e08f6f50a6d623b5ee43d64d8ccc20fd2e396b4d6381e278793bcae2075cd382cf4ef0de08d358920dc32d
6
+ metadata.gz: 89386ee8a695fb75ef89f241aa40640997a18f2c8b35eadcad5fd5c9587e44b6285b68aeb3c9fcf3c6c714090595e33206bb6879a47a1e6f07766e0a17da3729
7
+ data.tar.gz: 28eb181f819afdfd88138ee4ecf19c2355784a93517e4c2eead8838b20e2b1b8f2722b59d6d394a43ee3b678e915795ca4743d9aec895f13362d1e993fca9920
@@ -11,6 +11,11 @@ module DeliveryStateJp
11
11
  statuses.last
12
12
  end
13
13
 
14
+ def self.tracking_error_message(args)
15
+ doc = Nokogiri::HTML.parse(response_body(args), nil, charset)
16
+ error_messages.map { |error_message| (doc.search "[text() *= '#{error_message}']").last }.compact.map(&:text).map(&:strip).join('、')
17
+ end
18
+
14
19
  def self.response_body(args)
15
20
  number = args.fetch(:number)
16
21
  uri = URI.parse(action_url)
@@ -38,5 +43,9 @@ module DeliveryStateJp
38
43
  def self.xpath(_index)
39
44
  fail NotImplementedError
40
45
  end
46
+
47
+ def self.error_messages
48
+ fail NotImplementedError
49
+ end
41
50
  end
42
51
  end
@@ -15,5 +15,9 @@ module DeliveryStateJp
15
15
  def self.charset
16
16
  'shift-jis'
17
17
  end
18
+
19
+ def self.error_messages
20
+ %w(恐れ入りますが、お問い合せ送り状NOをお確かめください。)
21
+ end
18
22
  end
19
23
  end
@@ -15,5 +15,9 @@ module DeliveryStateJp
15
15
  def self.charset
16
16
  'shift-jis'
17
17
  end
18
+
19
+ def self.error_messages
20
+ %w(入力されたお問合せ番号が見当りません お問合せ番号:桁数が不足しています お問合せ番号:数字のみを入力してください お問合せ番号:桁数がオーバーしています)
21
+ end
18
22
  end
19
23
  end
@@ -1,3 +1,3 @@
1
1
  module DeliveryStateJp
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
@@ -15,5 +15,9 @@ module DeliveryStateJp
15
15
  def self.charset
16
16
  'shift-jis'
17
17
  end
18
+
19
+ def self.error_messages
20
+ %w(伝票番号誤り)
21
+ end
18
22
  end
19
23
  end
@@ -14,5 +14,9 @@ module DeliveryStateJp
14
14
  def self.charset
15
15
  'utf-8'
16
16
  end
17
+
18
+ def self.error_messages
19
+ %w(お問い合わせ番号の入力桁数に誤りがあります。 お問い合わせ番号が見つかりません。)
20
+ end
17
21
  end
18
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delivery_state_jp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - nyaahara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-03 00:00:00.000000000 Z
11
+ date: 2017-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri