Module: EtherpadLite
- Defined in:
- lib/etherpad-lite/client.rb,
lib/etherpad-lite/version.rb,
lib/etherpad-lite/models/pad.rb,
lib/etherpad-lite/models/diff.rb,
lib/etherpad-lite/models/group.rb,
lib/etherpad-lite/models/author.rb,
lib/etherpad-lite/models/padded.rb,
lib/etherpad-lite/models/session.rb,
lib/etherpad-lite/models/instance.rb,
lib/etherpad-lite/models/chat_message.rb
Overview
A client library for Etherpad Lite’s JSON API.
A thin wrapper around the HTTP API. See the API documentation at etherpad.org/doc/v1.2.0/#index_api_methods.
client = EtherpadLite.client('http://localhost:9001', 'api key', '1.1')
client.getText(:padID => 'foo')
=> {:text => "Pad text"}
client.setText(:padID => 'padID', :text => 'new pad text')
A higher-level interface to the API:
ether = EtherpadLite.connect('http://localhost:9001', 'api key', '1.1')
pad = ether.pad('padID')
puts pad.text
=> 'Pad text'
pad.text = 'new pad text'
Defined Under Namespace
Modules: Padded Classes: Author, ChatMessage, Client, Diff, Group, Instance, Pad, Session
Constant Summary collapse
- Error =
An error returned by the server
Class.new(StandardError)
- VERSION =
Library version
'0.3.1'
- API_VERSION =
API target version
'1.2.8'
Class Method Summary collapse
-
.client(url_or_port, api_key_or_file, api_version = nil) ⇒ Object
Returns a new EtherpadLite::Client.
-
.connect(url_or_port, api_key_or_file, api_version = nil) ⇒ Object
Returns an EtherpadLite::Instance object.
Class Method Details
.client(url_or_port, api_key_or_file, api_version = nil) ⇒ Object
Returns a new EtherpadLite::Client.
client = EtherpadLite.client('https://etherpad.yoursite.com', 'your api key', '1.1')
client = EtherpadLite.client(9001, 'your api key', '1.1') # Alias to http://localhost:9001
30 31 32 |
# File 'lib/etherpad-lite/client.rb', line 30 def self.client(url_or_port, api_key_or_file, api_version=nil) Client.new(url_or_port, api_key_or_file, api_version) end |
.connect(url_or_port, api_key_or_file, api_version = nil) ⇒ Object
Returns an EtherpadLite::Instance object.
ether = EtherpadLite.client('https://etherpad.yoursite.com', 'your api key', '1.1')
ether = EtherpadLite.client(9001, 'your api key', '1.1') # Alias to http://localhost:9001
7 8 9 |
# File 'lib/etherpad-lite/models/instance.rb', line 7 def self.connect(url_or_port, api_key_or_file, api_version=nil) Instance.new(url_or_port, api_key_or_file, api_version) end |