Class: Plex::Library

Inherits:
Object
  • Object
show all
Defined in:
lib/plex-ruby/library.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server) ⇒ Library

Returns a new instance of Library.

Parameters:

  • server (Server)

    this libary belongs to



7
8
9
# File 'lib/plex-ruby/library.rb', line 7

def initialize(server)
  @server = server
end

Instance Attribute Details

#serverObject (readonly)

Returns the value of attribute server.



4
5
6
# File 'lib/plex-ruby/library.rb', line 4

def server
  @server
end

Instance Method Details

#==(other) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/plex-ruby/library.rb', line 47

def ==(other) #:nodoc:
  if other.is_a? Library
    server == other.server
  else
    super
  end
end

#inspectObject



56
57
58
# File 'lib/plex-ruby/library.rb', line 56

def inspect #:nodoc:
  "#<Plex::Libary: server=#{server.inspect}>"
end

#keyObject



37
38
39
# File 'lib/plex-ruby/library.rb', line 37

def key #:nodoc:
  "/library/sections"
end

#section(id) ⇒ Section

Grab a specific section

Parameters:

  • key (String, Fixnum)

    of the section we want

Returns:

  • (Section)

    section with that key



15
16
17
# File 'lib/plex-ruby/library.rb', line 15

def section(id)
  search_sections(xml_doc, id).first
end

#section!(id) ⇒ Object

Cache busting version of #section



20
21
22
# File 'lib/plex-ruby/library.rb', line 20

def section!(id)
  search_sections(xml_doc!, id).first
end

#sectionsArray

A list of sections that are located in this library

Returns:

  • (Array)

    list of sections



27
28
29
# File 'lib/plex-ruby/library.rb', line 27

def sections
  @sections ||= search_sections(xml_doc)
end

#sections!Object

Cache busting version of #sections



32
33
34
# File 'lib/plex-ruby/library.rb', line 32

def sections!
  @sections = search_sections(xml_doc!)
end

#urlObject



42
43
44
# File 'lib/plex-ruby/library.rb', line 42

def url #:nodoc:
  server.url
end