class Jani::FromJson::Builder
Attributes
json_data[RW]
Public Class Methods
new(json_data: {}.to_s)
click to toggle source
# File lib/jani/from_json/builder.rb, line 10 def initialize(json_data: {}.to_s) @json_data = json_data end
Public Instance Methods
new_movie()
click to toggle source
# File lib/jani/from_json/builder.rb, line 14 def new_movie Jani::FromJson::Movie.new.tap do |m| m.uuid = hashed_data["uuid"] m.frame_width = hashed_data["frame_width"] m.frame_height = hashed_data["frame_height"] m.fps = hashed_data["fps"] m.pixel_ratio = hashed_data["pixel_ratio"] m.loading_banner = new_loading_banner m.postroll_banner = new_postroll_banner m.strips = new_strips m.tracking_events = new_tracking_events m.conversion_status = hashed_data["conversion_status"] end end
new_strips()
click to toggle source
# File lib/jani/from_json/builder.rb, line 42 def new_strips return [] unless hashed_data["strips"] hashed_data["strips"].map do |strip_data| Jani::FromJson::Strip.new.tap do |s| s.index = strip_data["index"] s.image_url = strip_data["image_url"] s.frames_count = strip_data["frames_count"] end end end
new_tracking_events()
click to toggle source
# File lib/jani/from_json/builder.rb, line 53 def new_tracking_events return [] unless hashed_data["tracking_events"] hashed_data["tracking_events"].map do |strip_data| Jani::FromJson::TrackingEvent.new.tap do |t| t.label = strip_data["label"] t.url = strip_data["url"] t.track_on = strip_data["track_on"] t.request_type = strip_data["request_type"] end end end
Private Instance Methods
hashed_data()
click to toggle source
# File lib/jani/from_json/builder.rb, line 67 def hashed_data @hashed_data ||= JSON.parse(@json_data) end