class Page

Constants

REPRESENTATION
TYPE

Attributes

page_id[R]
revision[W]
space_key[R]
title[R]

Public Class Methods

new(space_key, title, document, page_id) click to toggle source
# File lib/asciidoctor/page.rb, line 10
def initialize(space_key, title, document, page_id)
  @space_key = space_key
  @title = title
  @document = document
  @page_id = page_id
  @revision = nil
end

Public Instance Methods

to_json() click to toggle source
# File lib/asciidoctor/page.rb, line 18
def to_json
  page = {
      :type => TYPE,
      :title => @title,
      :space => {
          :key => @space_key
      },
      :body => {
          :storage => {
              :value => @document,
              :representation => REPRESENTATION
          }
      }
  }

  page[:version] = {:number => @revision} unless @revision.nil?
  page[:id] = @page_id unless @page_id.nil?

  JSON.generate page
end