Sha256: 6cdbd2dd0020efc481dacfa87b8219f2ebbf32bf179fbda2cfb21cae0d908d27

Contents?: true

Size: 304 Bytes

Versions: 3

Compression:

Stored size: 304 Bytes

Contents

module ActivityStreams
  class Object::Review < Object
    attr_optional :_rating_

    def validate_attributes!
      super
      to_float :_rating_, :precision => 1, :range => 1.0..5.0
    end

    def as_json
      hash = super
      hash[:rating] = hash.delete(:_rating_)
      hash
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activitystreams-0.0.4 lib/activitystreams/object/review.rb
activitystreams-0.0.3 lib/activitystreams/object/review.rb
activitystreams-0.0.2 lib/activitystreams/object/review.rb