Sha256: f5f3204d620759770a7ff1dcf9eee457db47f0f482ee36c9be5c154428bbac36
Contents?: true
Size: 819 Bytes
Versions: 1
Compression:
Stored size: 819 Bytes
Contents
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 def geolocation=(new_coordinates) @geolocation = Geolocation.parse(new_coordinates).tap do |geo| attributes[:geolocation] = geo end end %w[created_at updated_at].each do |method| define_method("#{method}=") do |new_value| parsed_value = new_value.present? ? Time.parse(new_value) : nil instance_variable_set("@#{method}", parsed_value) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hungry-0.2.0 | lib/hungry/location.rb |