protolink 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ProtoLink is a library for interfacing with ProtoNet, the next-gen internet infrastructure. Truly social and people-powered.
4
4
 
5
- Version: 0.1.0
5
+ Version: 0.2.1
6
6
 
7
7
  Sorry, there are no tests at all yet...
8
8
 
@@ -20,7 +20,7 @@ Sorry, there are no tests at all yet...
20
20
  require 'rubygems'
21
21
  require 'protolink'
22
22
 
23
- protonet = Protolink::Protonet.new('HTTP://SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD')
23
+ protonet = Protolink::Protonet.open('HTTP://SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD')
24
24
  channel = protonet.channels.first
25
25
  channel.speak 'Hello world!'
26
26
 
@@ -29,7 +29,7 @@ Sorry, there are no tests at all yet...
29
29
  require 'rubygems'
30
30
  require 'protolink'
31
31
 
32
- protonet = Protolink::Protonet.new('SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD', :ssl => false)
32
+ protonet = Protolink::Protonet.open('HTTP://SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD')
33
33
  channel = protonet.find_channel_by_name("test")
34
34
  channel.speak 'Hello world!'
35
35
 
@@ -38,8 +38,8 @@ Sorry, there are no tests at all yet...
38
38
  require 'rubygems'
39
39
  require 'protolink'
40
40
 
41
- protonet = Protolink::Protonet.new('SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD', :ssl => false)
42
- channel = protonet.create_channel("test", "This is the description... woah")
41
+ protonet = Protolink::Protonet.open('HTTP://SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD')
42
+ channel = protonet.create_channel(:name => "test", :description => "This is the description... woah", :skip_autosubscribe => true)
43
43
  channel.speak 'Hello world!'
44
44
 
45
45
 
@@ -47,7 +47,7 @@ Sorry, there are no tests at all yet...
47
47
  require 'rubygems'
48
48
  require 'protolink'
49
49
 
50
- protonet = Protolink::Protonet.new('SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD', :ssl => false)
50
+ protonet = Protolink::Protonet.open('HTTP://SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD')
51
51
  channel = protonet.find_channel(117)
52
52
  channel.speak 'Hello world!'
53
53
 
@@ -56,8 +56,8 @@ Sorry, there are no tests at all yet...
56
56
  require 'rubygems'
57
57
  require 'protolink'
58
58
 
59
- protonet = Protolink::Protonet.new('SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD', :ssl => false)
60
- channel = protonet.find_or_create_channel_by_name("test", "This is the description... woah")
59
+ protonet = Protolink::Protonet.open('HTTP://SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD')
60
+ channel = protonet.find_or_create_channel_by_name("test", :description => "This is the description... woah")
61
61
  channel.speak 'Hello world!'
62
62
 
63
63
 
@@ -67,37 +67,37 @@ Sorry, there are no tests at all yet...
67
67
  require 'rubygems'
68
68
  require 'protolink'
69
69
 
70
- protonet = Protolink::Protonet.new('SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD', :ssl => false)
70
+ protonet = Protolink::Protonet.open('HTTP://SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD')
71
71
  user = protonet.find_user_by_login("bjoern.dorra")
72
72
 
73
73
  # find user by id
74
74
  require 'rubygems'
75
75
  require 'protolink'
76
76
 
77
- protonet = Protolink::Protonet.new('SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD', :ssl => false)
77
+ protonet = Protolink::Protonet.open('HTTP://SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD')
78
78
  user = protonet.find_user(117)
79
79
 
80
80
  # create a user
81
81
  require 'rubygems'
82
82
  require 'protolink'
83
83
 
84
- protonet = Protolink::Protonet.new('SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD', :ssl => false)
85
- user = protonet.create_user("testuser", "mymassword", "Test-User", "test@test.de")
84
+ protonet = Protolink::Protonet.open('HTTP://SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD')
85
+ user = protonet.create_user(:login => "testuser", :password => "userpassword", :name => "Test-User", :email => "test@test.de")
86
86
 
87
87
 
88
88
  # find or create a user
89
89
  require 'rubygems'
90
90
  require 'protolink'
91
91
 
92
- protonet = Protolink::Protonet.new('SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD', :ssl => false)
93
- user = protonet.find_or_create_user_by_login("testuser", "mymassword", "Test-User", "test@test.de")
92
+ protonet = Protolink::Protonet.open('HTTP://SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD')
93
+ user = protonet.find_or_create_user_by_login("testuser", :password => "mymassword", :name => "Test-User", :email => "test@test.de")
94
94
 
95
95
 
96
96
  # get users auth_token for auto-login
97
97
  require 'rubygems'
98
98
  require 'protolink'
99
99
 
100
- protonet = Protolink::Protonet.new('SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD', :ssl => false)
100
+ protonet = Protolink::Protonet.open('HTTP://SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD')
101
101
  user = protonet.find_user_by_name("bjoern.dorra")
102
102
  user.auth_token
103
103
  => "A19zNgCzgv4RGDGPc2mL"
@@ -109,7 +109,7 @@ Sorry, there are no tests at all yet...
109
109
  require 'rubygems'
110
110
  require 'protolink'
111
111
 
112
- protonet = Protolink::Protonet.new('SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD', :ssl => false)
112
+ protonet = Protolink::Protonet.open('HTTP://SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD')
113
113
  user = protonet.find_user_by_login("bjoern.dorra")
114
114
  channel = protonet.find_channel_by_name("test")
115
115
  protonet.create_listen(user.id, channel.id)
@@ -118,7 +118,7 @@ Sorry, there are no tests at all yet...
118
118
  require 'rubygems'
119
119
  require 'protolink'
120
120
 
121
- protonet = Protolink::Protonet.new('SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD', :ssl => false)
121
+ protonet = Protolink::Protonet.open('HTTP://SUBDOMAIN.DOMAIN.DE', 'USERLOGIN', 'PASSWORD')
122
122
  user = protonet.find_user_by_login("bjoern.dorra")
123
123
  channel = protonet.find_channel_by_name("test")
124
124
  protonet.destroy_listen(user.id, channel.id)
@@ -129,7 +129,7 @@ Sorry, there are no tests at all yet...
129
129
  require 'rubygems'
130
130
  require 'protolink'
131
131
 
132
- protonet = Protolink::Protonet.new('localhost:3000', 'bjoern.dorra', 'geheim')
132
+ protonet = Protolink::Protonet.open('localhost:3000', 'bjoern.dorra', 'geheim')
133
133
 
134
134
  user = protonet.find_or_create_user_by_login("johndoe", "password", "JohnDoe", "john@doe.com")
135
135
  auth_token = user.auth_token
@@ -44,7 +44,7 @@ module Protolink
44
44
  end
45
45
 
46
46
  def send_message(message)
47
- connection.post("/api/v1/meeps/create", :body => {:channel_id => self.id, :message => message})
47
+ connection.post("/api/v1/meeps", :body => {:channel_id => self.id, :message => message})
48
48
  end
49
49
 
50
50
  def connection
@@ -1,3 +1,3 @@
1
1
  module Protolink
2
- VERSION = '0.2.1' unless defined?(::Protolink::VERSION)
2
+ VERSION = '0.2.2' unless defined?(::Protolink::VERSION)
3
3
  end
data/test/all_tests.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
2
2
 
3
- require 'rubygems'
4
- require 'protolink'
3
+ require "rubygems"
4
+ require "protolink"
5
5
  require "test/unit"
6
6
 
7
7
  # require 'ruby-debug'
@@ -70,6 +70,7 @@ class TestAll < Test::Unit::TestCase
70
70
  channel_3 = protonet.find_or_create_channel_by_name("test_foobar_2")
71
71
  assert channel_3.is_a?(Protolink::Channel), "Couldn't create channel"
72
72
  assert_equal 'test_foobar_2', channel_3.name
73
+ assert channel_3.speak("dude!")["meep_id"] > 0
73
74
 
74
75
  protonet.create_listen(user_1.id, channel_1.id)
75
76
  protonet.create_listen(user_3.id, channel_1.id)
@@ -79,5 +80,6 @@ class TestAll < Test::Unit::TestCase
79
80
  protonet.destroy_listen(user_1.id, channel_1.id)
80
81
 
81
82
  assert_equal [user_3.id], channel_1.listener.map {|u| u.id}.sort
83
+
82
84
  end
83
85
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protolink
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Bj\xC3\xB6rn B. Dorra"
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-25 00:00:00 +02:00
19
+ date: 2011-07-26 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency