Class: Moodle2CC::CanvasCC::Models::Page

Inherits:
Resource
  • Object
show all
Defined in:
lib/moodle2cc/canvas_cc/models/page.rb

Constant Summary collapse

PAGE_ID_POSTFIX =
'_PAGE'
WIKI_CONTENT =
'wiki_content'
BOOK_PATH =
WIKI_CONTENT + '/books'
EDITING_ROLE_TEACHER =
'teachers'
MAX_URL_LENGTH =
80

Constants inherited from Resource

Resource::WEB_CONTENT_TYPE

Instance Attribute Summary collapse

Attributes inherited from Resource

#dependencies, #files, #href, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#attributes

Constructor Details

#initializePage

Returns a new instance of Page.



14
15
16
17
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 14

def initialize
  super
  @type = WEB_CONTENT_TYPE
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



12
13
14
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 12

def body
  @body
end

#editing_rolesObject

Returns the value of attribute editing_roles.



12
13
14
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 12

def editing_roles
  @editing_roles
end

#titleObject

Returns the value of attribute title.



12
13
14
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 12

def title
  @title
end

#workflow_stateObject

Returns the value of attribute workflow_state.



12
13
14
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 12

def workflow_state
  @workflow_state
end

Class Method Details

.convert_name_to_url(name) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 31

def self.convert_name_to_url(name)
  url = CGI::escape(name.downcase.gsub(/\s/, '-').gsub('.', 'dot'))
  if url.length > MAX_URL_LENGTH
    url = url[0,MAX_URL_LENGTH][/.{0,#{MAX_URL_LENGTH}}/mu]
  end
  url
end

Instance Method Details

#identifierObject



23
24
25
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 23

def identifier
  @identifier
end

#identifier=(identifier) ⇒ Object



19
20
21
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 19

def identifier=(identifier)
  @identifier = identifier
end

#page_name=(name) ⇒ Object



27
28
29
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 27

def page_name= name
  @title = name
end