lib/hungry/location.rb in hungry-0.0.1 vs lib/hungry/location.rb in hungry-0.1.0

- old
+ new

@@ -1,23 +1,28 @@ module Hungry class Location < Resource self.endpoint = '/locations' + ### RESOURCES: + + has_many :venues, 'Hungry::Venue' + + has_many :nearby_venues, 'Hungry::Venue' + + has_many :tags, 'Hungry::Tag' + ### ATTRIBUTES: ### Location: attr_accessor :id, :name, :type, :url, :geolocation, ### Utility: :resources, :counters - ### RESOURCES: - - has_many :venues, Venue - - has_many :nearby_venues, Venue - - has_many :tags, Tag - + def geolocation=(new_coordinates) + @geolocation = Geolocation.parse(new_coordinates).tap do |geo| + attributes[:geolocation] = geo + end + end end end