protolink 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/protolink/protonet.rb +8 -8
- data/lib/protolink/user.rb +2 -1
- data/lib/protolink/version.rb +1 -1
- data/test/all_tests.rb +2 -1
- metadata +3 -3
data/lib/protolink/protonet.rb
CHANGED
@@ -72,20 +72,20 @@ module Protolink
|
|
72
72
|
|
73
73
|
# Creates and returns a new user with the given attributes
|
74
74
|
def create_user(options)
|
75
|
-
login
|
76
|
-
password
|
77
|
-
name
|
78
|
-
email
|
79
|
-
avatar_url
|
80
|
-
|
81
|
-
channels
|
75
|
+
login = options[:login] || raise(ArgumentError, "Please provide a login for this user")
|
76
|
+
password = options[:password]
|
77
|
+
name = options[:name]
|
78
|
+
email = options[:email] || raise(ArgumentError, "Please provide an email for this user")
|
79
|
+
avatar_url = options[:avatar_url]
|
80
|
+
external_profile_url = options[:external_profile_url]
|
81
|
+
channels = options[:channels]
|
82
82
|
if channels
|
83
83
|
# not implemented yet
|
84
84
|
no_channels = "true"
|
85
85
|
else
|
86
86
|
no_channels = "true"
|
87
87
|
end
|
88
|
-
post('/api/v1/users', :body => {:login => login, :name => name, :password => password, :email => email, :avatar_url => avatar_url, :no_channels => no_channels, :channels_to_subscribe => nil } )
|
88
|
+
post('/api/v1/users', :body => {:login => login, :name => name, :password => password, :email => email, :avatar_url => avatar_url, :no_channels => no_channels, :channels_to_subscribe => nil, :external_profile_url => external_profile_url } )
|
89
89
|
find_user_by_login(login)
|
90
90
|
end
|
91
91
|
|
data/lib/protolink/user.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Protolink
|
2
2
|
class User
|
3
|
-
attr_reader :id, :name, :login, :email, :avatar_url
|
3
|
+
attr_reader :id, :name, :login, :email, :avatar_url, :external_profile_url
|
4
4
|
|
5
5
|
def initialize(connection, attributes = {})
|
6
6
|
@connection = connection
|
@@ -9,6 +9,7 @@ module Protolink
|
|
9
9
|
@login = attributes['login']
|
10
10
|
@email = attributes['email']
|
11
11
|
@avatar_url = attributes['avatar_url']
|
12
|
+
@external_profile_url = attributes['external_profile_url']
|
12
13
|
@loaded = false
|
13
14
|
end
|
14
15
|
|
data/lib/protolink/version.rb
CHANGED
data/test/all_tests.rb
CHANGED
@@ -45,10 +45,11 @@ class TestAll < Test::Unit::TestCase
|
|
45
45
|
protonet = Protolink::Protonet.open(PTN_SERVER, PTN_USER, PTN_PASS)
|
46
46
|
assert protonet, "Couldn't create connection instance"
|
47
47
|
|
48
|
-
user_1 = protonet.create_user(:login => 'test', :email => 'test@test.com')
|
48
|
+
user_1 = protonet.create_user(:login => 'test', :email => 'test@test.com', :external_profile_url => 'http://www.google.de')
|
49
49
|
assert user_1.is_a?(Protolink::User), "Couldn't create user"
|
50
50
|
assert_equal 'test', user_1.login
|
51
51
|
assert_equal 'test@test.com', user_1.email
|
52
|
+
assert_equal 'http://www.google.de', user_1.external_profile_url
|
52
53
|
assert user_1.auth_token.match(/\w+/)
|
53
54
|
|
54
55
|
user_2 = protonet.find_or_create_user_by_login('test', :email => 'test@test.com')
|
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:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Bj\xC3\xB6rn B. Dorra"
|