Sha256: 7c67f35b79c52f5c595b224b57a0d14fecbbf469d2c0ac7b2e89ccfcf97e5710

Contents?: true

Size: 640 Bytes

Versions: 5

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

module GhostRb
  module Resources
    # @author Rene Hernandez
    # @since 0.1
    class Post < BaseResource
      attr_accessor :id, :title, :slug, :html, :page,
                    :status, :published_at, :created_at, :author,
                    :visibility, :featured, :plaintext, :tags

      alias page? page

      alias featured? featured

      def self.generate(data)
        inst = super(data)
        inst.author = User.generate(data[:author]) if hash_value?(data, :author)
        inst.tags = data[:tags].map { |t| Tag.generate(t) } if data.key?(:tags)

        inst
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ghost_rb-0.3.0 lib/ghost_rb/resources/post.rb
ghost_rb-0.2.8 lib/ghost_rb/resources/post.rb
ghost_rb-0.2.7 lib/ghost_rb/resources/post.rb
ghost_rb-0.2.6 lib/ghost_rb/resources/post.rb
ghost_rb-0.2.5 lib/ghost_rb/resources/post.rb