Class: Decidim::Etherpad::Pad

Inherits:
Object
  • Object
show all
Defined in:
lib/decidim/etherpad/pad.rb

Overview

This class allows you to interact with pad stored in an Etherpad Lite server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pad_id) ⇒ Pad

Returns a new instance of Pad.



7
8
9
10
11
12
# File 'lib/decidim/etherpad/pad.rb', line 7

def initialize(pad_id)
  @id = pad_id
  @api_key = Decidim.etherpad.fetch(:api_key)
  @api_version = Decidim.etherpad.fetch(:api_version, "1.2.1")
  @uri = URI.parse(Decidim.etherpad.fetch(:server))
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



14
15
16
# File 'lib/decidim/etherpad/pad.rb', line 14

def id
  @id
end

Instance Method Details

#read_only_idObject

Read only means that pad is not writable.



17
18
19
# File 'lib/decidim/etherpad/pad.rb', line 17

def read_only_id
  @read_only_id ||= resolve(:getReadOnlyID, { padID: id })[:readOnlyID]
end

#textObject



21
22
23
# File 'lib/decidim/etherpad/pad.rb', line 21

def text
  resolve(:getText, { padID: id })[:text]
end