Sha256: 914e51b1c793dc53e9aa12405697da4fc859e08c388b653eaf52d49928c4df9d

Contents?: true

Size: 596 Bytes

Versions: 1

Compression:

Stored size: 596 Bytes

Contents

module Hungry
  class Review < Resource

    ### RESOURCES:

    belongs_to :venue, 'Hungry::Venue'

    has_many :responses, 'Hungry::Response'

    ### ATTRIBUTES:

                  ### Review:
    attr_accessor :id, :body, :rating, :scores, :author,

                  ### Utility:
                  :created_at, :updated_at

    %w[created_at updated_at open_since].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/review.rb