Class: CineworldUk::Cinema
- Inherits:
-
Cinebase::Cinema
- Object
- Cinebase::Cinema
- CineworldUk::Cinema
- Defined in:
- lib/cineworld_uk/cinema.rb
Overview
The object representing a cinema on the Cineworld UK website
Instance Attribute Summary collapse
-
#id ⇒ Integer
readonly
The numeric id of the cinema on the Cineworld website.
Class Method Summary collapse
-
.all ⇒ Array<CineworldUk::Cinema>
Return basic cinema information for all cinemas.
-
.id_names_hash ⇒ Hash<Integer => String>
private
called from instance methods.
Instance Method Summary collapse
-
#address ⇒ Hash
Address of the cinema.
-
#adr ⇒ Hash
Address of the cinema.
-
#brand ⇒ String
Brand of the cinema.
-
#country_name ⇒ String
Country of the cinema.
-
#extended_address ⇒ String
The second address line of the cinema.
-
#full_name ⇒ String
The name of the cinema including the brand.
-
#initialize(id) ⇒ CineworldUk::Cinema
constructor
Constructor.
-
#locality ⇒ String
The locality (town) of the cinema.
-
#name ⇒ String
The name of the cinema.
-
#postal_code ⇒ String
Post code of the cinema.
-
#region ⇒ String
The region (county) of the cinema if provided.
-
#slug ⇒ String
The URL-able slug of the cinema.
-
#street_address ⇒ String
The street address of the cinema.
-
#url ⇒ String
The url of the cinema on the Cineworld website.
Constructor Details
#initialize(id) ⇒ CineworldUk::Cinema
Constructor
10 11 12 |
# File 'lib/cineworld_uk/cinema.rb', line 10 def initialize(id) @id = id.to_i end |
Instance Attribute Details
#id ⇒ Integer (readonly)
Returns the numeric id of the cinema on the Cineworld website.
|
# File 'lib/cineworld_uk/cinema.rb', line 4
|
Class Method Details
.all ⇒ Array<CineworldUk::Cinema>
Return basic cinema information for all cinemas
19 20 21 |
# File 'lib/cineworld_uk/cinema.rb', line 19 def self.all id_names_hash.map { |id, _| new id } end |
.id_names_hash ⇒ Hash<Integer => String>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
called from instance methods
26 27 28 29 30 31 |
# File 'lib/cineworld_uk/cinema.rb', line 26 def self.id_names_hash @id_names_hash ||= cinema_list_json.each_with_object({}) do |hash, result| result[hash['id']] = hash['name'].gsub('London - ', '').gsub(' - ', ': ') end end |
Instance Method Details
#address ⇒ Hash
Address of the cinema
|
# File 'lib/cineworld_uk/cinema.rb', line 33
|
#adr ⇒ Hash
Uses the standard method naming as at microformats.org/wiki/adr
Address of the cinema
51 52 53 |
# File 'lib/cineworld_uk/cinema.rb', line 51 def adr CineworldUk::Internal::Parser::Api::CinemaAddress.new(@id).to_hash end |
#brand ⇒ String
Brand of the cinema
61 62 63 |
# File 'lib/cineworld_uk/cinema.rb', line 61 def brand 'Cineworld'.freeze end |
#country_name ⇒ String
Country of the cinema
|
# File 'lib/cineworld_uk/cinema.rb', line 65
|
#extended_address ⇒ String
The second address line of the cinema
|
# File 'lib/cineworld_uk/cinema.rb', line 73
|
#full_name ⇒ String
The name of the cinema including the brand
|
# File 'lib/cineworld_uk/cinema.rb', line 85
|
#locality ⇒ String
The locality (town) of the cinema
|
# File 'lib/cineworld_uk/cinema.rb', line 93
|
#name ⇒ String
The name of the cinema
107 108 109 |
# File 'lib/cineworld_uk/cinema.rb', line 107 def name @name ||= self.class.id_names_hash[id] end |
#postal_code ⇒ String
Post code of the cinema
|
# File 'lib/cineworld_uk/cinema.rb', line 111
|
#region ⇒ String
The region (county) of the cinema if provided
|
# File 'lib/cineworld_uk/cinema.rb', line 119
|
#slug ⇒ String
The URL-able slug of the cinema
|
# File 'lib/cineworld_uk/cinema.rb', line 127
|
#street_address ⇒ String
Uses the standard method naming as at microformats.org/wiki/adr
The street address of the cinema
|
# File 'lib/cineworld_uk/cinema.rb', line 135
|
#url ⇒ String
The url of the cinema on the Cineworld website
146 147 148 |
# File 'lib/cineworld_uk/cinema.rb', line 146 def url "http://www.cineworld.co.uk/cinemas/#{@id}/information" end |