31 lines
650 B
Ruby
31 lines
650 B
Ruby
# frozen_string_literal: true
|
|
|
|
module SchedulePipeline
|
|
module Models
|
|
class ScheduleItem
|
|
attr_reader :duration, :content_key, :pop_data
|
|
|
|
def initialize(duration, content_key, pop_data)
|
|
@duration = duration
|
|
@content_key = content_key
|
|
@pop_data = pop_data
|
|
end
|
|
|
|
def to_hash
|
|
{
|
|
duration: @duration,
|
|
content_key: @content_key,
|
|
pop_data: @pop_data
|
|
}.with_indifferent_access
|
|
end
|
|
|
|
def self.from_hash(input)
|
|
self.new(
|
|
input[:duration],
|
|
input[:content_key],
|
|
input[:pop_data]
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end |