class DellinInfo::API::Order
Constants
- ATTRIBUTES
Attributes
city_receiver[RW]
city_sender[RW]
state[RW]
Public Class Methods
new(hash_track)
click to toggle source
# File lib/dellininfo/order.rb, line 48 def initialize(hash_track) data = parse_hash_response(hash_track, 'order') ATTRIBUTES.each do |attribute| self.send(set_attr_method(attribute), data[attribute]) end @state = 'не установлен' end
Public Instance Methods
to_s()
click to toggle source
# File lib/dellininfo/order.rb, line 34 def to_s estimated_delivery_date = Time.new(@estimatedDeliveryDate).strftime('%Y-%m-%d') year = Time.new(@estimatedDeliveryDate).strftime('%Y') estimated_delivery_date.clear unless year == Time.now().strftime('%Y') "накладная № #{@docNumber} от #{Date.parse docDate}\nОтправление из города #{@city_sender} в город #{@city_receiver}\nПредположительная дата прихода: #{estimated_delivery_date}\nстатус: #{@state}\n#{'-'*10}\n" end