Class: SfFilmLocationApiWrapper::FilmLocation
- Inherits:
-
Object
- Object
- SfFilmLocationApiWrapper::FilmLocation
- Defined in:
- lib/sf_film_location_api_wrapper.rb
Instance Attribute Summary collapse
-
#director ⇒ Object
readonly
Returns the value of attribute director.
-
#distributor ⇒ Object
readonly
Returns the value of attribute distributor.
-
#fun_facts ⇒ Object
readonly
Returns the value of attribute fun_facts.
-
#locations ⇒ Object
readonly
Returns the value of attribute locations.
-
#production_company ⇒ Object
readonly
Returns the value of attribute production_company.
-
#release_year ⇒ Object
readonly
Returns the value of attribute release_year.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#writer ⇒ Object
readonly
Returns the value of attribute writer.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ FilmLocation
constructor
A new instance of FilmLocation.
Constructor Details
#initialize(hash) ⇒ FilmLocation
Returns a new instance of FilmLocation.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/sf_film_location_api_wrapper.rb', line 8 def initialize(hash) @title = hash["title"] @release_year = hash["release_year"] @locations = hash["locations"] @fun_facts = hash["fun_facts"] @production_company = hash["production_company"] @distributor = hash["distributor"] @director = hash["director"] @writer = hash["writer"] end |
Instance Attribute Details
#director ⇒ Object (readonly)
Returns the value of attribute director.
6 7 8 |
# File 'lib/sf_film_location_api_wrapper.rb', line 6 def director @director end |
#distributor ⇒ Object (readonly)
Returns the value of attribute distributor.
6 7 8 |
# File 'lib/sf_film_location_api_wrapper.rb', line 6 def distributor @distributor end |
#fun_facts ⇒ Object (readonly)
Returns the value of attribute fun_facts.
6 7 8 |
# File 'lib/sf_film_location_api_wrapper.rb', line 6 def fun_facts @fun_facts end |
#locations ⇒ Object (readonly)
Returns the value of attribute locations.
6 7 8 |
# File 'lib/sf_film_location_api_wrapper.rb', line 6 def locations @locations end |
#production_company ⇒ Object (readonly)
Returns the value of attribute production_company.
6 7 8 |
# File 'lib/sf_film_location_api_wrapper.rb', line 6 def production_company @production_company end |
#release_year ⇒ Object (readonly)
Returns the value of attribute release_year.
6 7 8 |
# File 'lib/sf_film_location_api_wrapper.rb', line 6 def release_year @release_year end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/sf_film_location_api_wrapper.rb', line 6 def title @title end |
#writer ⇒ Object (readonly)
Returns the value of attribute writer.
6 7 8 |
# File 'lib/sf_film_location_api_wrapper.rb', line 6 def writer @writer end |
Class Method Details
.all ⇒ Object
19 20 21 22 |
# File 'lib/sf_film_location_api_wrapper.rb', line 19 def self.all array = Unirest.get("https://data.sfgov.org/resource/wwmu-gmzc.json").body create(array) end |
.create(array) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/sf_film_location_api_wrapper.rb', line 24 def self.create(array) @film_locations = [] array.each do |hash| @film_locations << FilmLocation.new(hash) end return @film_locations end |
.search(string) ⇒ Object
32 33 34 35 |
# File 'lib/sf_film_location_api_wrapper.rb', line 32 def self.search(string) array = Unirest.get("https://data.sfgov.org/resource/wwmu-gmzc.json?$q=#{string}").body create(array) end |