Sha256: 69f5161e0369ad5c683b0ec436189a950288d9b3941753fb4cc4224182b05b6f

Contents?: true

Size: 447 Bytes

Versions: 9

Compression:

Stored size: 447 Bytes

Contents

module MeducationSDK
  class Vote < Loquor::Resource
    self.path = "/votes"

    def item
      @item ||= "MeducationSDK::#{item_type.gsub("::", "")}".constantize.find(item_id)
    end

    def user
      @user ||= User.find(user_id)
    end
  end

  class VoteMock < Vote
    extend Loquor::ResourceMock

    self.attributes = {
      id: 1,
      user_id: 8,
      item_id: 5, 
      item_type: "MediaFile",
      liked: true
    }
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
meducation_sdk-1.4.3 lib/meducation_sdk/resources/vote.rb
meducation_sdk-1.4.2 lib/meducation_sdk/resources/vote.rb
meducation_sdk-1.4.1 lib/meducation_sdk/resources/vote.rb
meducation_sdk-1.4.0 lib/meducation_sdk/resources/vote.rb
meducation_sdk-1.3.0 lib/meducation_sdk/resources/vote.rb
meducation_sdk-1.2.6 lib/meducation_sdk/resources/vote.rb
meducation_sdk-1.2.5 lib/meducation_sdk/resources/vote.rb
meducation_sdk-1.2.4 lib/meducation_sdk/resources/vote.rb
meducation_sdk-1.2.3 lib/meducation_sdk/resources/vote.rb