Class: TakuhaiStatus::UPS

Inherits:
Object
  • Object
show all
Defined in:
lib/takuhai_status/ups.rb

Constant Summary collapse

@@conn =
nil

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ UPS

Returns a new instance of UPS.

Raises:



11
12
13
14
15
# File 'lib/takuhai_status/ups.rb', line 11

def initialize(key)
	@key = key.strip
	raise NotMyKey.new('invalid key format') unless @key =~ /\A[a-zA-Z0-9]+\Z/
	@time, @state = check
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



7
8
9
# File 'lib/takuhai_status/ups.rb', line 7

def key
  @key
end

#stateObject (readonly)

Returns the value of attribute state.



7
8
9
# File 'lib/takuhai_status/ups.rb', line 7

def state
  @state
end

#timeObject (readonly)

Returns the value of attribute time.



7
8
9
# File 'lib/takuhai_status/ups.rb', line 7

def time
  @time
end

Instance Method Details

#finish?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/takuhai_status/ups.rb', line 17

def finish?
	return !!(@state =~ /配達済み/)
end