etherpad-lite 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,7 @@
1
+ ** RELEASE 0.0.2 (09/05/2011) **
2
+
3
+ * Bugfix to Pad#private=, documentation updates
4
+
5
+ ** RELEASE 0.0.1 (08/30/2011) **
6
+
7
+ * Initial release
data/README.rdoc CHANGED
@@ -10,8 +10,8 @@ See https://github.com/Pita/etherpad-lite for information on how to install and
10
10
  == 2 Basic usage
11
11
  require 'etherpad-lite'
12
12
 
13
- # Connect to your Etherpad Lite instance (passing no arguments will connect you to beta.etherpad.org)
14
- ether = EtherpadLite.connect('http://etherpad-lite.example.com', 'your api key')
13
+ # Connect to your Etherpad Lite instance
14
+ ether = EtherpadLite.connect('http://etherpad-lite.example.com', 'the api key')
15
15
 
16
16
  # Get a Pad (or create one if it doesn't exist)
17
17
  pad = ether.pad('my first etherpad lite pad')
@@ -35,7 +35,7 @@ See https://github.com/Pita/etherpad-lite for information on how to install and
35
35
  For advanced functionality (i.e. Groups, Authors, Sessions), read the full docs at http://jordanhollinger.com/docs/ruby-etherpad-lite/. Also, the RSpec tests under /spec may provide some pointers.
36
36
 
37
37
  == 3 Why is the Ruby client so different from the others? What gives you the right?!?
38
- The PHP and Python clients are extremely thin wrappers of the HTTP API; their method names map directly to urls. The Ruby client offers a slightly higher level of abstration,
38
+ The PHP and Python clients are extremely thin wrappers around the HTTP API; their method names map directly to urls. The Ruby client offers a slightly higher level of abstration,
39
39
  with the goal of making Etherpad Lite integration in Ruby projects as simple, poweful, and dare I say fun, as possible.
40
40
 
41
41
  That said, there is certainly value in supporting the defacto standard set by the PHP and Python clients. With that in mind, the Ruby client is written in two layers,
@@ -4,7 +4,7 @@ require 'net/https'
4
4
  require 'json'
5
5
 
6
6
  module EtherpadLite
7
- # A thin wrapper over Etherpad Lite's HTTP JSON API
7
+ # A thin wrapper around Etherpad Lite's HTTP JSON API
8
8
  class Client
9
9
  API_VERSION = 1
10
10
 
@@ -25,7 +25,7 @@ module EtherpadLite
25
25
  # Manually set path to the system's CA certs. Use this if the location couldn't be determined automatically.
26
26
  def self.ca_path=(path); @@ca_path = path; end
27
27
 
28
- # Instantiate a new Etherpad Lite Instance. The url should include the protocol (i.e. http or https).
28
+ # Instantiate a new Etherpad Lite Client. The url should include the protocol (i.e. http or https).
29
29
  def initialize(api_key, url='http://localhost:9001/api')
30
30
  @uri = URI.parse(url)
31
31
  raise ArgumentError, "#{url} is not a valid url" unless @uri.host and @uri.port
@@ -33,7 +33,7 @@ module EtherpadLite
33
33
  connect!
34
34
  end
35
35
 
36
- # Pad, Group, etc. all use this to send the HTTP API requests.
36
+ # Calls the EtherpadLite API and returns the :data portion of the response Hash.
37
37
  def call(method, params={})
38
38
  # Build path
39
39
  params[:apikey] = @api_key
@@ -226,4 +226,4 @@ end
226
226
  %w{/etc/ssl/certs /etc/ssl /usr/share/ssl /usr/lib/ssl /System/Library/OpenSSL /usr/local/ssl}.each do |path|
227
227
  EtherpadLite::Client.ca_path = path and break if File.exists? path
228
228
  end
229
- $stderr.puts %q|WARNING Unable to find your CA Certificates; HTTPS connections will *not* be verified! You may remedy this with "EtherpadLite::Instance.ca_path = '/path/to/certs'"| unless EtherpadLite::Client.ca_path
229
+ $stderr.puts %q|WARNING Ruby etherpad-lite client was unable to find your CA Certificates; HTTPS connections will *not* be verified! You may remedy this with "EtherpadLite::Client.ca_path = '/path/to/certs'"| unless EtherpadLite::Client.ca_path
@@ -8,8 +8,6 @@ module EtherpadLite
8
8
  # ether1 = EtherpadLite.connect('https://etherpad.yoursite.com[https://etherpad.yoursite.com]', 'your api key')
9
9
  #
10
10
  # ether2 = EtherpadLite.connect(:local, File.new('/file/path/to/APIKEY.txt'))
11
- #
12
- # ether3 = EtherpadLite.connect(:public, "beta.etherpad.org's api key")
13
11
  def self.connect(host_or_alias, api_key_or_file)
14
12
  # Parse the host
15
13
  host = if host_or_alias.is_a? Symbol
@@ -75,7 +75,7 @@ module EtherpadLite
75
75
  @instance.client.setText(@id, txt)
76
76
  end
77
77
 
78
- # Returns a Range of all this Pad's revision numbers
78
+ # Returns an Array of all this Pad's revision numbers
79
79
  def revision_numbers
80
80
  max = @instance.client.getRevisionsCount(@id)[:revisions]
81
81
  (0..max).to_a
@@ -91,7 +91,7 @@ module EtherpadLite
91
91
  @read_only_id ||= @instance.client.getReadOnlyID(@id)[:readOnlyID]
92
92
  end
93
93
 
94
- # Returns true if this is a public Pad (opposite of private).
94
+ # Returns true if this is a public Pad (opposite of private?).
95
95
  # This only applies to Pads belonging to a Group.
96
96
  def public?
97
97
  @instance.client.getPublicStatus(@id)[:publicStatus]
@@ -103,16 +103,16 @@ module EtherpadLite
103
103
  @instance.client.setPublicStatus(@id, status)
104
104
  end
105
105
 
106
- # Returns true if this is a private Pad (opposite of public)
106
+ # Returns true if this is a private Pad (opposite of public?)
107
107
  # This only applies to Pads belonging to a Group.
108
108
  def private?
109
- not public?
109
+ not self.public?
110
110
  end
111
111
 
112
112
  # Set the pad's private status to true or false (opposite of public=)
113
113
  # This only applies to Pads belonging to a Group.
114
114
  def private=(status)
115
- public = !status
115
+ self.public = !status
116
116
  end
117
117
 
118
118
  # Returns true if this Pad has a password, false if not.
@@ -42,10 +42,12 @@ module EtherpadLite
42
42
  get_info[:validUntil]
43
43
  end
44
44
 
45
+ # Returns true if the session is not expired
45
46
  def valid?
46
47
  valid_until < Time.now.to_i
47
48
  end
48
49
 
50
+ # Returns true if the session is expired
49
51
  def expired?
50
52
  not valid?
51
53
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jordan Hollinger
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-08-30 00:00:00 -04:00
17
+ date: 2011-09-05 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -45,9 +45,10 @@ files:
45
45
  - spec/author_spec.rb
46
46
  - spec/pad_spec.rb
47
47
  - README.rdoc
48
+ - CHANGELOG
48
49
  - LICENSE
49
50
  has_rdoc: true
50
- homepage: http://github.com/jhollinger/etherpad-lite
51
+ homepage: http://github.com/jhollinger/ruby-etherpad-lite
51
52
  licenses: []
52
53
 
53
54
  post_install_message: