class PicturehouseUk::Cinema
The object representing a cinema on the Picturehouse UK website
Constants
- ADDRESS_CSS
address css
- CINEMA_LINKS_CSS
cinema link css
Public Class Methods
all()
click to toggle source
Return basic cinema information for all cinemas @return [Array<PicturehouseUk::Cinema>] @example
PicturehouseUk::Cinema.all #=> [<PicturehouseUk::Cinema>, <PicturehouseUk::Cinema>, ...]
# File lib/picturehouse_uk/cinema.rb, line 22 def self.all cinema_hash.keys.map { |id| new(id) } end
cinema_hash()
click to toggle source
@api private
# File lib/picturehouse_uk/cinema.rb, line 27 def self.cinema_hash @cinema_hash ||= ListParser.new(cinema_links).to_hash end
Private Class Methods
cinema_links()
click to toggle source
# File lib/picturehouse_uk/cinema.rb, line 149 def self.cinema_links home_doc.css(CINEMA_LINKS_CSS) end
home_doc()
click to toggle source
# File lib/picturehouse_uk/cinema.rb, line 154 def self.home_doc @home_doc ||= Nokogiri::HTML(PicturehouseUk::Internal::Website.new.home) end
Public Instance Methods
adr()
click to toggle source
Address of the cinema @return [Hash] contains :street_address, :extended_address, :locality, :postal_code, :country @example
cinema = PicturehouseUk::Cinema.new('Dukes_At_Komedia') cinema.adr #=> { street_address: '44-47 Gardner Street', extended_address: 'North Laine', locality: 'Brighton', region: 'East Sussex', postal_code: 'BN1 1UN', country_name: 'United Kingdom' }
@note Uses method naming as at microformats.org/wiki/adr
# File lib/picturehouse_uk/cinema.rb, line 51 def adr PicturehouseUk::Internal::Parser::Address.new(address_node.to_s).address end
brand()
click to toggle source
Brand of the cinema @return [String] which will always be 'Picturehouse' @example
cinema = PicturehouseUk::Cinema.new('Dukes_At_Komedia') cinema.brand #=> 'Picturehouse'
# File lib/picturehouse_uk/cinema.rb, line 61 def brand 'Picturehouse'.freeze end
full_name()
click to toggle source
The name of the cinema (might include brand) @return [String] @example
cinema = PicturehouseUk::Cinema.new('Dukes_At_Komedia') cinema.full_name #=> "Duke's At Komedia"
# File lib/picturehouse_uk/cinema.rb, line 87 def full_name name end
name()
click to toggle source
The name of the cinema @return [String] @example
cinema = PicturehouseUk::Cinema.new('Dukes_At_Komedia') cinema.name #=> "Duke's At Komedia"
# File lib/picturehouse_uk/cinema.rb, line 105 def name self.class.cinema_hash.fetch(id, {})[:name] end
url()
click to toggle source
The url of the cinema on the Picturehouse website @return [String]
# File lib/picturehouse_uk/cinema.rb, line 143 def url "http://www.picturehouses.com#/cinema/#{id}" end
Private Instance Methods
address_node()
click to toggle source
# File lib/picturehouse_uk/cinema.rb, line 160 def address_node @address_node ||= info_doc.css(ADDRESS_CSS) end
info_doc()
click to toggle source
# File lib/picturehouse_uk/cinema.rb, line 164 def info_doc @info_doc ||= Nokogiri::HTML(PicturehouseUk::Internal::Website.new.info(id)) end