class FilmLocationsGem::FilmInSf
Attributes
actor_1[RW]
actor_2[RW]
actor_3[RW]
director[RW]
locations[RW]
production_company[RW]
release_year[RW]
title[RW]
writer[RW]
Public Class Methods
all()
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# 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
new(hash)
click to toggle source
# 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
Public Instance Methods
destroy()
click to toggle source
# File lib/film_locations_gem.rb, line 42 def destroy Unirest.delete("https://data.sfgov.org/resource/wwmu-gmzc.json").body end