Method: Program#populate

Defined in:
lib/data_services/program.rb

#populate(program_hash) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/data_services/program.rb', line 19

def populate program_hash
  @tms_guide_id = program_hash["tmsGuideId"]
  @tms_program_id = program_hash["tmsProgramId"]
  @call_sign = program_hash["callSign"]
  @vod_tms_guide_id = program_hash["vodTmsSeriesId"]
  @title = program_hash["title"]
  @short_desc = program_hash["shortDesc"]
  @icons = program_hash["icons"]

   = program_hash["metadata"]
  unless (.nil?)
    @tms_series_id = ["tmsSeriesId"]
    @season = ["season"]
    @episode = ["episode"]
    @episode_title = ["title"]
    @type = ["type"]
  end

  @start_time_sec = program_hash["startTimeSec"]
  @duration_min  = program_hash["durationMinutes"]
  if (! @start_time_sec.nil?  &&  ! @duration_min.nil?)
    sec = @duration_min.to_i * 60
    @end_time = @start_time_sec + sec
  end

  @genres = program_hash["genres"]
  @rating = program_hash["rating"]
  @ratings_blocked = program_hash["ratingsBlocked"]
end