Class: Deliveries::Delivery
- Inherits:
-
Object
- Object
- Deliveries::Delivery
- Defined in:
- lib/deliveries/delivery.rb
Constant Summary collapse
- ATTRIBUTES =
%i[courier_id sender receiver parcels reference_code tracking_code label].freeze
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(**attributes) ⇒ Delivery
constructor
A new instance of Delivery.
Constructor Details
#initialize(**attributes) ⇒ Delivery
Returns a new instance of Delivery.
6 7 8 9 10 11 12 13 14 |
# File 'lib/deliveries/delivery.rb', line 6 def initialize(**attributes) self.courier_id = attributes[:courier_id] self.sender = attributes[:sender] self.receiver = attributes[:receiver] self.parcels = attributes[:parcels] self.reference_code = attributes[:reference_code] self.tracking_code = attributes[:tracking_code] self.label = attributes[:label] end |
Instance Method Details
#attributes ⇒ Object
16 17 18 |
# File 'lib/deliveries/delivery.rb', line 16 def attributes ATTRIBUTES.map { |attr| { attr => send(attr) } }.inject(&:merge) end |