module CarrierBotAPI class Fulfillment attr_reader :ordered_at, :fulfilled_at, :total_price, :service_code, :order_id, :fulfillment_id, :items def initialize(data) @ordered_at = data[:ordered_at] @fulfilled_at = data[:fulfilled_at] @total_price = data[:total_price] @service_code = data[:service_code] @order_id = data[:order_id] @fulfillment_id = data[:fulfillment_id] @items = data[:items] end def to_json { 'ordered_at': self.ordered_at, 'fulfilled_at': self.fulfilled_at, 'total_price': self.total_price, 'service_code': self.service_code, 'order_id': self.order_id, 'fulfillment_id': self.fulfillment_id, 'items': self.items.map(&:to_json) } end end end # module CarrierBotAPI