Class: Nicoalert::Live

Inherits:
Object
  • Object
show all
Defined in:
lib/nicoalert/live.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, community_id) ⇒ Live

Returns a new instance of Live.



10
11
12
13
# File 'lib/nicoalert/live.rb', line 10

def initialize(id, community_id)
  @id = id
  @community_id = community_id
end

Instance Attribute Details

#community_idObject (readonly)

Returns the value of attribute community_id.



8
9
10
# File 'lib/nicoalert/live.rb', line 8

def community_id
  @community_id
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/nicoalert/live.rb', line 8

def id
  @id
end

Instance Method Details

#communityObject



39
40
41
# File 'lib/nicoalert/live.rb', line 39

def community
  @community ||= Community.new(community_id, community_name, community_thumbnail)
end

#community_nameObject



31
32
33
# File 'lib/nicoalert/live.rb', line 31

def community_name
  @name ||= info.css('communityinfo name').text
end

#community_thumbnailObject



35
36
37
# File 'lib/nicoalert/live.rb', line 35

def community_thumbnail
  @thumbnail ||= URI.parse(info.css('communityinfo thumbnail').text)
end

#descriptionObject



19
20
21
# File 'lib/nicoalert/live.rb', line 19

def description
  @description ||= info.css('streaminfo description').text
end

#provider_typeObject



23
24
25
# File 'lib/nicoalert/live.rb', line 23

def provider_type
  @provider_type ||= info.css('streaminfo provider_type').text.to_sym
end

#titleObject



15
16
17
# File 'lib/nicoalert/live.rb', line 15

def title
  @title ||= info.css('streaminfo title').text
end

#uriObject



27
28
29
# File 'lib/nicoalert/live.rb', line 27

def uri
  @uri ||= "#{LIVE_URI}#@id"
end