Sha256: e5d545c33a0387bc305083c0c3d4d65921d15c6d0b6521650ffdba4930e7dea1

Contents?: true

Size: 837 Bytes

Versions: 13

Compression:

Stored size: 837 Bytes

Contents

module MeducationSDK

  class CollectionTopic < Resource

    self.path = "/collection_topics"

    def collection 
      @collection ||= Collection.find(collection_id)
    end

    def authors
      @authors ||= Author.where(id: author_ids)
    end

    def users
      @users ||= User.where(id: authors.map(&:user_id))
    end

    def comments
      @comments ||= Comment.where(id: comment_ids)
    end
  end

  class CollectionTopicMock < CollectionTopic
    extend Loquor::ResourceMock

    self.attributes = {
      id: 728463,
      title: 'This is a mock collection topic',
      description: 'This is a sample description',
      collection_id: 1,
      section_id: 17,
      resource_ids: [3, 4, 5],
      views_in_last_30_days: 1,
      views_in_last_60_days: 2,
      rating: 123,
      author_ids: [7,12,54]
    }
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
meducation_sdk-2.1.4 lib/meducation_sdk/resources/collection_topic.rb
meducation_sdk-2.1.3 lib/meducation_sdk/resources/collection_topic.rb
meducation_sdk-2.1.2 lib/meducation_sdk/resources/collection_topic.rb
meducation_sdk-2.1.1 lib/meducation_sdk/resources/collection_topic.rb
meducation_sdk-2.1.0 lib/meducation_sdk/resources/collection_topic.rb
meducation_sdk-2.0.5 lib/meducation_sdk/resources/collection_topic.rb
meducation_sdk-2.0.4 lib/meducation_sdk/resources/collection_topic.rb
meducation_sdk-2.0.3 lib/meducation_sdk/resources/collection_topic.rb
meducation_sdk-2.0.2 lib/meducation_sdk/resources/collection_topic.rb
meducation_sdk-2.0.1 lib/meducation_sdk/resources/collection_topic.rb
meducation_sdk-2.0.0 lib/meducation_sdk/resources/collection_topic.rb
meducation_sdk-1.6.16 lib/meducation_sdk/resources/collection_topic.rb
meducation_sdk-1.6.15 lib/meducation_sdk/resources/collection_topic.rb