lib/takuhai_status/kuronekoyamato.rb in takuhai_status-1.7.4 vs lib/takuhai_status/kuronekoyamato.rb in takuhai_status-1.8.1
- old
+ new
@@ -2,12 +2,14 @@
require 'nokogiri'
module TakuhaiStatus
class KuronekoYamato
attr_reader :key, :time, :state
+ TakuhaiStatus.add_service(self)
def initialize(key)
- @key = key.gsub(/[^0-9]/, '')
+ @key = key.strip
+ raise NotMyKey.new('invalid key format') unless @key =~ /\A[0-9]+\Z/
@time, @state = check
end
def finish?
return !!(@state =~ /^(お客様引渡|配達|投函)完了|返品/)