protolink 0.2.3 → 0.2.4

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/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  coverage
2
+ pkg
@@ -61,6 +61,16 @@ module Protolink
61
61
  response = get("/api/v1/channels/#{name}")
62
62
  Channel.new(self, response) if response
63
63
  end
64
+
65
+ def create_rendezvous(first_user_id, second_user_id)
66
+ response = post('/api/v1/rendezvous', :body => { :first_user_id => first_user_id, :second_user_id => second_user_id } )
67
+ Channel.new(self, response) if response
68
+ end
69
+
70
+ def find_rendezvous(first_user_id, second_user_id)
71
+ response = get('/api/v1/rendezvous', :query => {:first_user_id => first_user_id, :second_user_id => second_user_id})
72
+ Channel.new(self, response) if response
73
+ end
64
74
 
65
75
  # USERS
66
76
 
@@ -1,3 +1,3 @@
1
1
  module Protolink
2
- VERSION = '0.2.3' unless defined?(::Protolink::VERSION)
2
+ VERSION = '0.2.4' unless defined?(::Protolink::VERSION)
3
3
  end
data/test/all_tests.rb CHANGED
@@ -4,39 +4,27 @@ require "rubygems"
4
4
  require "protolink"
5
5
  require "test/unit"
6
6
 
7
- # require 'ruby-debug'
8
- # Debugger.start
7
+ require 'ruby-debug'
8
+ Debugger.start
9
9
  # change this if you need to connect to another server
10
10
  PTN_SERVER = "http://localhost:3000"
11
11
  PTN_USER = "dude"
12
12
  PTN_PASS = "geheim"
13
- # protonet = Protolink::Protonet.new('localhost:3000', 'bjoern.dorra', 'geheim')
14
- #
15
- # user = protonet.find_or_create_user_by_login("johndoe", "password", "John Doe", "john@doe.com")
16
- # auth_token = user.auth_token
17
- # puts "user_id : #{user.id}"
18
- # puts "user_login : #{user.login}"
19
- # puts "auth_token : #{auth_token}"
20
- #
21
- # channel = protonet.find_or_create_channel_by_name("test", "This is a test channel!")
22
- # puts "channel_id : #{channel.id}"
23
- # puts "channel_name: #{channel.name}"
24
- # puts "channel_desc: #{channel.description}"
25
- #
26
- # protonet.create_listen(user.id, channel.id)
27
- #
28
- # puts "\nhttp://localhost:3000/?auth_token=#{auth_token}"
29
13
 
30
14
  class TestAll < Test::Unit::TestCase
31
15
 
32
16
  def teardown
33
17
  protonet = Protolink::Protonet.open(PTN_SERVER, PTN_USER, PTN_PASS)
34
- user = protonet.find_user_by_login("test")
35
- user.delete!
36
- user = protonet.find_user_by_login("test_2")
37
- user.delete!
38
- user = protonet.find_user_by_login("test_3")
39
- user.delete!
18
+ user_1 = protonet.find_user_by_login("test")
19
+ user_3 = protonet.find_user_by_login("test_2")
20
+ user_4 = protonet.find_user_by_login("test_3")
21
+
22
+ channel = protonet.find_rendezvous(user_3.id, user_1.id)
23
+ channel.delete!
24
+
25
+ user_1.delete!
26
+ user_3.delete!
27
+ user_4.delete!
40
28
  channel = protonet.find_channel_by_name("test_foobar")
41
29
  channel.delete!
42
30
  channel = protonet.find_channel_by_name("test_foobar_2")
@@ -62,7 +50,7 @@ class TestAll < Test::Unit::TestCase
62
50
  assert_equal 'test_2', user_3.login
63
51
  assert_equal 'test_2@test.com', user_3.email
64
52
 
65
- user_4 = protonet.find_or_create_user_by_login('test_3', {:name => 'foobar', :email => "email@du-bist-mir-sympathisch.de"), :external_profile_url => "http://du-bist-mir-sympathisch.de/profile_redirect", :avatar_url => "http://www.google.com/intl/en_com/images/srpr/logo2w.png"})
53
+ user_4 = protonet.find_or_create_user_by_login('test_3', {:name => 'foobar', :email => "email@du-bist-mir-sympathisch.de", :external_profile_url => "http://du-bist-mir-sympathisch.de/profile_redirect", :avatar_url => "http://www.google.com/intl/en_com/images/srpr/logo2w.png"})
66
54
 
67
55
  channel_1 = protonet.create_channel(:name => "test_foobar", :skip_autosubscribe => true)
68
56
  assert channel_1.is_a?(Protolink::Channel), "Couldn't create channel"
@@ -85,5 +73,7 @@ class TestAll < Test::Unit::TestCase
85
73
 
86
74
  assert_equal [user_3.id], channel_1.listener.map {|u| u.id}.sort
87
75
 
76
+ rendezvous = protonet.create_rendezvous(user_3.id, user_1.id)
77
+ assert_equal [user_1.id, user_3.id], rendezvous.listener.map {|u| u.id.to_i}.sort
88
78
  end
89
79
  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: 17
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 4
10
+ version: 0.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Bj\xC3\xB6rn B. Dorra"
@@ -16,10 +16,11 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-28 00:00:00 +02:00
19
+ date: 2011-08-29 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
+ name: crack
23
24
  prerelease: false
24
25
  requirement: &id001 !ruby/object:Gem::Requirement
25
26
  none: false
@@ -31,9 +32,9 @@ dependencies:
31
32
  - 0
32
33
  version: "0"
33
34
  type: :runtime
34
- name: crack
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
37
+ name: httparty
37
38
  prerelease: false
38
39
  requirement: &id002 !ruby/object:Gem::Requirement
39
40
  none: false
@@ -47,7 +48,6 @@ dependencies:
47
48
  - 1
48
49
  version: 0.5.1
49
50
  type: :runtime
50
- name: httparty
51
51
  version_requirements: *id002
52
52
  description: A Ruby API for interfacing with Protonet, the next-gen internet infrastructure. Truly social and people-powered.
53
53
  email: dorra@d-1.comg