Class: FriendlyShipping::Timing

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly_shipping/timing.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shipping_method:, pickup:, delivery:, guaranteed: false, properties: {}) ⇒ Timing

Returns a new instance of Timing.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/friendly_shipping/timing.rb', line 11

def initialize(
  shipping_method:,
  pickup:,
  delivery:,
  guaranteed: false,
  properties: {}
)
  @shipping_method = shipping_method
  @pickup = pickup
  @delivery = delivery
  @guaranteed = guaranteed
  @properties = properties
end

Instance Attribute Details

#deliveryObject (readonly)

Returns the value of attribute delivery.



5
6
7
# File 'lib/friendly_shipping/timing.rb', line 5

def delivery
  @delivery
end

#guaranteedObject (readonly)

Returns the value of attribute guaranteed.



5
6
7
# File 'lib/friendly_shipping/timing.rb', line 5

def guaranteed
  @guaranteed
end

#pickupObject (readonly)

Returns the value of attribute pickup.



5
6
7
# File 'lib/friendly_shipping/timing.rb', line 5

def pickup
  @pickup
end

#propertiesObject (readonly)

Returns the value of attribute properties.



5
6
7
# File 'lib/friendly_shipping/timing.rb', line 5

def properties
  @properties
end

#shipping_methodObject (readonly)

Returns the value of attribute shipping_method.



5
6
7
# File 'lib/friendly_shipping/timing.rb', line 5

def shipping_method
  @shipping_method
end

Instance Method Details

#time_in_transitObject



25
26
27
# File 'lib/friendly_shipping/timing.rb', line 25

def time_in_transit
  delivery - pickup
end