Class: Deliveries::TrackingInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/deliveries/tracking_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(courier_id:, tracking_code:, status: nil, checkpoints: nil, url: nil) ⇒ TrackingInfo

Returns a new instance of TrackingInfo.



5
6
7
8
9
10
11
# File 'lib/deliveries/tracking_info.rb', line 5

def initialize(courier_id:, tracking_code:, status: nil, checkpoints: nil, url: nil)
  self.courier_id = courier_id
  self.tracking_code = tracking_code
  self.status = status
  self.checkpoints = checkpoints
  self.url = url
end

Instance Attribute Details

#checkpointsObject

Returns the value of attribute checkpoints.



3
4
5
# File 'lib/deliveries/tracking_info.rb', line 3

def checkpoints
  @checkpoints
end

#courier_idObject

Returns the value of attribute courier_id.



3
4
5
# File 'lib/deliveries/tracking_info.rb', line 3

def courier_id
  @courier_id
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/deliveries/tracking_info.rb', line 3

def status
  @status
end

#tracking_codeObject

Returns the value of attribute tracking_code.



3
4
5
# File 'lib/deliveries/tracking_info.rb', line 3

def tracking_code
  @tracking_code
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/deliveries/tracking_info.rb', line 3

def url
  @url
end

Instance Method Details

#delivered?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/deliveries/tracking_info.rb', line 25

def delivered?
  status == :delivered
end

#in_collection_point?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/deliveries/tracking_info.rb', line 21

def in_collection_point?
  status == :in_collection_point
end

#in_transit?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/deliveries/tracking_info.rb', line 17

def in_transit?
  status == :in_transit
end

#registered?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/deliveries/tracking_info.rb', line 13

def registered?
  status == :registered
end