Class: SfFilmLocations::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/sf_film_locations.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Location

Returns a new instance of Location.



9
10
11
12
13
14
# File 'lib/sf_film_locations.rb', line 9

def initialize(hash)
  @location = hash["locations"]
  @title = hash["title"]
  @actor_1 = hash["actor_1"]
  @actor_2 = hash["actor_2"]
end

Instance Attribute Details

#actor_1Object (readonly)

Returns the value of attribute actor_1.



7
8
9
# File 'lib/sf_film_locations.rb', line 7

def actor_1
  @actor_1
end

#actor_2Object (readonly)

Returns the value of attribute actor_2.



7
8
9
# File 'lib/sf_film_locations.rb', line 7

def actor_2
  @actor_2
end

#locationObject (readonly)

Returns the value of attribute location.



7
8
9
# File 'lib/sf_film_locations.rb', line 7

def location
  @location
end

#titleObject (readonly)

Returns the value of attribute title.



7
8
9
# File 'lib/sf_film_locations.rb', line 7

def title
  @title
end

Class Method Details

.allObject



16
17
18
19
20
21
22
23
# File 'lib/sf_film_locations.rb', line 16

def self.all
  locations_array = Unirest.get("https://data.sfgov.org/resource/wwmu-gmzc.json").body
  locations = []
  locations_array.each do |location_hash|
      locations << Location.new(location_hash)
  end
  return locations
end