Sha256: 2a9741945756366b50a433fe4005d33fdb309f86f576092dc549a9bc2a88c07f

Contents?: true

Size: 601 Bytes

Versions: 28

Compression:

Stored size: 601 Bytes

Contents

module MeducationSDK
  class BlogPost < Resource
    self.path = "/blog_posts"

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

    def blogger
      @blogger ||= Blogger.find(blogger_id)
    end

    def comments
      @comments ||= Comment.where(item_id: id, item_type: "BlogPost")
    end
  end

  class BlogPostMock < BlogPost
    extend Loquor::ResourceMock

    self.attributes = {
      id: 1,
      blogger_id: 8,
      user_id: 14,
      title: "My First Blog Post",
      slug: "my-first-blog-post",
      header_url: '/defaults/blog_posts/headers/missing_card.png'
    }
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
meducation_sdk-1.6.5 lib/meducation_sdk/resources/blog_post.rb
meducation_sdk-1.6.4 lib/meducation_sdk/resources/blog_post.rb
meducation_sdk-1.6.3 lib/meducation_sdk/resources/blog_post.rb
meducation_sdk-1.6.2 lib/meducation_sdk/resources/blog_post.rb
meducation_sdk-1.6.1 lib/meducation_sdk/resources/blog_post.rb
meducation_sdk-1.6.0 lib/meducation_sdk/resources/blog_post.rb
meducation_sdk-1.5.7 lib/meducation_sdk/resources/blog_post.rb
meducation_sdk-1.5.6 lib/meducation_sdk/resources/blog_post.rb