Class: FilmLocationsGem::FilmInSf
- Inherits:
-
Object
- Object
- FilmLocationsGem::FilmInSf
- Defined in:
- lib/film_locations_gem.rb
Instance Attribute Summary collapse
-
#actor_1 ⇒ Object
Returns the value of attribute actor_1.
-
#actor_2 ⇒ Object
Returns the value of attribute actor_2.
-
#actor_3 ⇒ Object
Returns the value of attribute actor_3.
-
#director ⇒ Object
Returns the value of attribute director.
-
#locations ⇒ Object
Returns the value of attribute locations.
-
#production_company ⇒ Object
Returns the value of attribute production_company.
-
#release_year ⇒ Object
Returns the value of attribute release_year.
-
#title ⇒ Object
Returns the value of attribute title.
-
#writer ⇒ Object
Returns the value of attribute writer.
Class Method Summary collapse
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(hash) ⇒ FilmInSf
constructor
A new instance of FilmInSf.
Constructor Details
#initialize(hash) ⇒ FilmInSf
Returns a new instance of FilmInSf.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/film_locations_gem.rb', line 8 def initialize(hash) @actor_1 = hash['actor_1'] @actor_2 = hash['actor_2'] @actor_3 = hash['actor_3'] @director = hash['director'] @locations = hash['locations'] @production_company = hash['production_company'] @release_year = hash['release_year'] @title = hash['title'] @writer = hash['writer'] end |
Instance Attribute Details
#actor_1 ⇒ Object
Returns the value of attribute actor_1.
6 7 8 |
# File 'lib/film_locations_gem.rb', line 6 def actor_1 @actor_1 end |
#actor_2 ⇒ Object
Returns the value of attribute actor_2.
6 7 8 |
# File 'lib/film_locations_gem.rb', line 6 def actor_2 @actor_2 end |
#actor_3 ⇒ Object
Returns the value of attribute actor_3.
6 7 8 |
# File 'lib/film_locations_gem.rb', line 6 def actor_3 @actor_3 end |
#director ⇒ Object
Returns the value of attribute director.
6 7 8 |
# File 'lib/film_locations_gem.rb', line 6 def director @director end |
#locations ⇒ Object
Returns the value of attribute locations.
6 7 8 |
# File 'lib/film_locations_gem.rb', line 6 def locations @locations end |
#production_company ⇒ Object
Returns the value of attribute production_company.
6 7 8 |
# File 'lib/film_locations_gem.rb', line 6 def production_company @production_company end |
#release_year ⇒ Object
Returns the value of attribute release_year.
6 7 8 |
# File 'lib/film_locations_gem.rb', line 6 def release_year @release_year end |
#title ⇒ Object
Returns the value of attribute title.
6 7 8 |
# File 'lib/film_locations_gem.rb', line 6 def title @title end |
#writer ⇒ Object
Returns the value of attribute writer.
6 7 8 |
# File 'lib/film_locations_gem.rb', line 6 def writer @writer end |
Class Method Details
.all ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/film_locations_gem.rb', line 20 def self.all # film_locations = [] film_locations_array = Unirest.get("https://data.sfgov.org/resource/wwmu-gmzc.json").body # film_locations_array.each do |film_location| # film_locations << film_location # end # film_locations_array create(film_locations_array) end |
.create(film_locations_array) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/film_locations_gem.rb', line 34 def self.create(film_locations_array) film_locations = [] film_locations_array.each do |film_location| film_locations << FilmLocation.new(film_location) end return film_locations end |
.find(search_term) ⇒ Object
30 31 32 |
# File 'lib/film_locations_gem.rb', line 30 def self.find(search_term) film_locations_array = Unirest.get("https://data.sfgov.org/resource/wwmu-gmzc.json?$q=#{search_term}").body end |
Instance Method Details
#destroy ⇒ Object
42 43 44 |
# File 'lib/film_locations_gem.rb', line 42 def destroy Unirest.delete("https://data.sfgov.org/resource/wwmu-gmzc.json").body end |