Initial commit
This commit is contained in:
31
app/services/schedule_pipeline/models/schedule_item.rb
Normal file
31
app/services/schedule_pipeline/models/schedule_item.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user