Class: DeliveryStateJp::Yuusei
- Inherits:
-
Base
- Object
- Base
- DeliveryStateJp::Yuusei
show all
- Defined in:
- lib/delivery_state_jp/yuusei.rb
Class Method Summary
collapse
Methods inherited from Base
action_url, delivery_state, post_params, tracking_error_message
Class Method Details
.charset ⇒ Object
14
15
16
|
# File 'lib/delivery_state_jp/yuusei.rb', line 14
def self.charset
'utf-8'
end
|
.error_messages ⇒ Object
18
19
20
|
# File 'lib/delivery_state_jp/yuusei.rb', line 18
def self.error_messages
%w(お問い合わせ番号の入力桁数に誤りがあります。 お問い合わせ番号が見つかりません。)
end
|
.response_body(args) ⇒ Object
7
8
9
10
11
12
|
# File 'lib/delivery_state_jp/yuusei.rb', line 7
def self.response_body(args)
number = args.fetch(:number)
uri = URI.parse("https://trackings.post.japanpost.jp/services/srv/search/?requestNo1=#{number}&search=%E8%BF%BD%E8%B7%A1%E3%82%B9%E3%82%BF%E3%83%BC%E3%83%88&startingUrlPatten=&locale=ja")
response = Net::HTTP.get_response(uri)
response.body
end
|
.xpath(index) ⇒ Object
3
4
5
|
# File 'lib/delivery_state_jp/yuusei.rb', line 3
def self.xpath(index)
"//*[@id=\"content\"]/form/div/table[2]/tr[#{(index * 2) + 1}]/td[2]"
end
|