Sha256: 3f03dfb3ef98e94deb999f21623ffd3422c41754193be1e471304b487b1cc648

Contents?: true

Size: 773 Bytes

Versions: 1

Compression:

Stored size: 773 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],
      rating: 123,
      author_ids: [7,12,54]
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
meducation_sdk-2.2.0 lib/meducation_sdk/resources/collection_topic.rb