rscribd 1.1.0 → 1.2.0
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 +1 -0
- data/History.txt +10 -0
- data/{README.txt → README} +21 -20
- data/Rakefile +19 -0
- data/VERSION +1 -1
- data/lib/rscribd.rb +12 -33
- data/lib/{scribdapi.rb → scribd/api.rb} +48 -35
- data/lib/scribd/category.rb +112 -0
- data/lib/scribd/collection.rb +96 -0
- data/lib/{scribddoc.rb → scribd/document.rb} +179 -101
- data/lib/{scribderrors.rb → scribd/errors.rb} +4 -5
- data/lib/{scribdresource.rb → scribd/resource.rb} +65 -42
- data/lib/scribd/security.rb +102 -0
- data/lib/scribd/user.rb +193 -0
- data/lib/support/extensions.rb +26 -0
- data/lib/{scribdmultiparthack.rb → support/multipart_hack.rb} +3 -1
- data/rscribd.gemspec +86 -0
- data/spec/category_spec.rb +177 -0
- data/spec/collection_spec.rb +127 -0
- data/spec/document_spec.rb +106 -42
- data/spec/security_spec.rb +118 -0
- data/spec/user_spec.rb +88 -0
- metadata +35 -12
- data/lib/scribduser.rb +0 -145
@@ -0,0 +1,118 @@
|
|
1
|
+
describe Scribd::Security do
|
2
|
+
before :each do
|
3
|
+
@document = Scribd::Document.new(:xml => REXML::Document.new('<result><doc_id>123</doc_id></result>').root)
|
4
|
+
@ident_list = REXML::Document.new(<<-EOF
|
5
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
6
|
+
<rsp stat="ok">
|
7
|
+
<resultset list="true">
|
8
|
+
<result>
|
9
|
+
<user_identifier>leila83</user_identifier>
|
10
|
+
</result>
|
11
|
+
<result>
|
12
|
+
<user_identifier>spikyhairdude</user_identifier>
|
13
|
+
</result>
|
14
|
+
</resultset>
|
15
|
+
</rsp>
|
16
|
+
EOF
|
17
|
+
).root
|
18
|
+
@doc_list = REXML::Document.new(<<-EOF
|
19
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
20
|
+
<rsp stat="ok">
|
21
|
+
<resultset list="true">
|
22
|
+
<result>
|
23
|
+
<doc_id>244565</doc_id>
|
24
|
+
<title><![CDATA[Ruby on Java]]></title>
|
25
|
+
<description><![CDATA[Ruby On Java, Barcamp, Washington DC]]></description>
|
26
|
+
<access_key>key-t3q5qujoj525yun8gf7</access_key>
|
27
|
+
<conversion_status>DONE</conversion_status>
|
28
|
+
<page_count>10</page_count>
|
29
|
+
</result>
|
30
|
+
<result>
|
31
|
+
<doc_id>244567</doc_id>
|
32
|
+
<title><![CDATA[Ruby on Java Part II]]></title>
|
33
|
+
<description><![CDATA[Ruby On Java Part II, Barcamp, Washington DC]]></description>
|
34
|
+
<access_key>key-2b3udhalycthsm91d1ps</access_key>
|
35
|
+
<conversion_status>DONE</conversion_status>
|
36
|
+
<page_count>12</page_count>
|
37
|
+
</result>
|
38
|
+
</resultset>
|
39
|
+
</rsp>
|
40
|
+
EOF
|
41
|
+
).root
|
42
|
+
end
|
43
|
+
|
44
|
+
describe :grant_access do
|
45
|
+
it "should call set_access" do
|
46
|
+
Scribd::Security.should_receive(:set_access).once.with('foo', true, @document)
|
47
|
+
Scribd::Security.grant_access('foo', @document)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe :revoke_access do
|
52
|
+
it "should call set_access" do
|
53
|
+
Scribd::Security.should_receive(:set_access).once.with('foo', false, @document)
|
54
|
+
Scribd::Security.revoke_access('foo', @document)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe :set_access do
|
59
|
+
it "should make an API call to security.setAccess (nil document, access_allowed = 1)" do
|
60
|
+
Scribd::API.instance.should_receive(:send_request).once.with('security.setAccess', :user_identifier => 'foo', :allowed => 1)
|
61
|
+
Scribd::Security.set_access 'foo', true
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should set the doc_id when given a Scribd::Document" do
|
65
|
+
Scribd::API.instance.should_receive(:send_request).once.with('security.setAccess', :user_identifier => 'foo', :allowed => 1, :doc_id => '123')
|
66
|
+
Scribd::Security.set_access 'foo', true, @document
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should set the doc_id when given a number" do
|
70
|
+
Scribd::API.instance.should_receive(:send_request).once.with('security.setAccess', :user_identifier => 'foo', :allowed => 1, :doc_id => 123)
|
71
|
+
Scribd::Security.set_access 'foo', true, 123
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should raise ArgumentError when given anything else" do
|
75
|
+
lambda { Scribd::Security.set_access 'foo', true, Object.new }.should raise_error(ArgumentError)
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should set allowed to 0 when given false" do
|
79
|
+
Scribd::API.instance.should_receive(:send_request).once.with('security.setAccess', :user_identifier => 'foo', :allowed => 0)
|
80
|
+
Scribd::Security.set_access 'foo', false
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe :document_access_list do
|
85
|
+
it "should make an API call to security.getDocumentAccessList with the document ID" do
|
86
|
+
Scribd::API.instance.should_receive(:send_request).once.with('security.getDocumentAccessList', :doc_id => '123').and_return(@ident_list)
|
87
|
+
Scribd::Security.document_access_list(@document)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should accept ID numbers" do
|
91
|
+
Scribd::API.instance.should_receive(:send_request).once.with('security.getDocumentAccessList', :doc_id => 123).and_return(@ident_list)
|
92
|
+
Scribd::Security.document_access_list(123)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should return an array of identifiers" do
|
96
|
+
Scribd::API.instance.stub!(:send_request).and_return(@ident_list)
|
97
|
+
idents = Scribd::Security.document_access_list(@document)
|
98
|
+
idents.should == %w( leila83 spikyhairdude )
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe :user_access_list do
|
103
|
+
it "should make an API call to security.getUserAccessList with the document ID" do
|
104
|
+
Scribd::API.instance.should_receive(:send_request).once.with('security.getUserAccessList', :user_identifier => '123').and_return(@doc_list)
|
105
|
+
Scribd::Security.user_access_list('123')
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should return an array of documents" do
|
109
|
+
Scribd::API.instance.stub!(:send_request).and_return(@doc_list)
|
110
|
+
docs = Scribd::Security.user_access_list('123')
|
111
|
+
docs.should be_kind_of(Array)
|
112
|
+
docs.size.should eql(2)
|
113
|
+
docs.each do |doc|
|
114
|
+
doc.should be_kind_of(Scribd::Document)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
data/spec/user_spec.rb
CHANGED
@@ -92,6 +92,67 @@ describe Scribd::User do
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
+
describe "#collections" do
|
96
|
+
before :each do
|
97
|
+
@user = Scribd::User.new(:xml => REXML::Document.new("<rsp stat='ok'><user_id type='integer'>225</user_id><username>sancho</username><name>Sancho Sample</name><session_key>some key</session_key></rsp>").root)
|
98
|
+
@response = <<-EOF
|
99
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
100
|
+
<rsp stat="ok">
|
101
|
+
<resultset list="true">
|
102
|
+
<result>
|
103
|
+
<collection_id>61</collection_id>
|
104
|
+
<collection_name>My Collection</collection_name>
|
105
|
+
<doc_count>5</doc_count>
|
106
|
+
</result>
|
107
|
+
<result>
|
108
|
+
<collection_id>62</collection_id>
|
109
|
+
<collection_name>My Other Collection</collection_name>
|
110
|
+
<doc_count>1</doc_count>
|
111
|
+
</result>
|
112
|
+
</resultset>
|
113
|
+
</rsp>
|
114
|
+
EOF
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should raise NotReadyError for new users" do
|
118
|
+
user = Scribd::User.new
|
119
|
+
lambda { user.collections }.should raise_error(Scribd::NotReadyError)
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should call the docs.getCollections API method" do
|
123
|
+
Scribd::API.instance.should_receive(:send_request).once.with('docs.getCollections', :session_key => 'some key').and_return(REXML::Document.new(@response))
|
124
|
+
@user.collections
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should pass options to the API method" do
|
128
|
+
Scribd::API.instance.should_receive(:send_request).once.with('docs.getCollections', :session_key => 'some key', :other => 'option').and_return(REXML::Document.new(@response))
|
129
|
+
@user.collections(:other => 'option')
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should return an array of collections" do
|
133
|
+
Scribd::API.instance.should_receive(:send_request).once.with('docs.getCollections', an_instance_of(Hash)).and_return(REXML::Document.new(@response))
|
134
|
+
list = @user.collections
|
135
|
+
list.should be_kind_of(Array)
|
136
|
+
list.size.should eql(2)
|
137
|
+
|
138
|
+
list.first.should be_kind_of(Scribd::Collection)
|
139
|
+
list.first.collection_id.should eql('61')
|
140
|
+
list.first.collection_name.should eql('My Collection')
|
141
|
+
list.first.doc_count.should eql('5')
|
142
|
+
|
143
|
+
list.last.should be_kind_of(Scribd::Collection)
|
144
|
+
list.last.collection_id.should eql('62')
|
145
|
+
list.last.collection_name.should eql('My Other Collection')
|
146
|
+
list.last.doc_count.should eql('1')
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should set each collection's owner" do
|
150
|
+
Scribd::API.instance.should_receive(:send_request).once.with('docs.getCollections', an_instance_of(Hash)).and_return(REXML::Document.new(@response))
|
151
|
+
list = @user.collections
|
152
|
+
list.each { |coll| coll.owner.should eql(@user) }
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
95
156
|
describe "find_documents method" do
|
96
157
|
it "should call Document.find with an appropriate scope and session key" do
|
97
158
|
Scribd::Document.should_receive(:find).once.with(hash_including(:scope => 'user', :session_key => 'some key'))
|
@@ -167,6 +228,33 @@ describe Scribd::User do
|
|
167
228
|
end
|
168
229
|
end
|
169
230
|
|
231
|
+
describe "#auto_sign_in_url" do
|
232
|
+
before :each do
|
233
|
+
@response = REXML::Document.new('<rsp><url><![CDATA[hello]]></url></rsp>').root
|
234
|
+
end
|
235
|
+
|
236
|
+
subject { Scribd::User.new(:xml => REXML::Document.new("<rsp stat='ok'><user_id type='integer'>225</user_id><username>sancho</username><name>Sancho Sample</name><session_key>some key</session_key></rsp>").root) }
|
237
|
+
|
238
|
+
it "should raise NotReadyError if the user isn't saved" do
|
239
|
+
lambda { Scribd::User.new.auto_sign_in_url }.should raise_error(Scribd::NotReadyError)
|
240
|
+
end
|
241
|
+
|
242
|
+
it "should call the API method user.getAutoSignInUrl" do
|
243
|
+
Scribd::API.instance.should_receive(:send_request).once.with('user.getAutoSignInUrl', :session_key => 'some key', :next_url => 'foobar').and_return(@response)
|
244
|
+
subject.auto_sign_in_url('foobar')
|
245
|
+
end
|
246
|
+
|
247
|
+
it "should set next_url to a blank string by default" do
|
248
|
+
Scribd::API.instance.should_receive(:send_request).once.with('user.getAutoSignInUrl', :session_key => 'some key', :next_url => '').and_return(@response)
|
249
|
+
subject.auto_sign_in_url
|
250
|
+
end
|
251
|
+
|
252
|
+
it "should return the URL returned by the API" do
|
253
|
+
Scribd::API.instance.stub!(:send_request).and_return(@response)
|
254
|
+
subject.auto_sign_in_url.should eql('hello')
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
170
258
|
describe ".username" do
|
171
259
|
before :each do
|
172
260
|
@xml = REXML::Document.new("<rsp stat='ok'><username>sancho</username><name>Sancho Sample</name></rsp>")
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
7
|
+
- 2
|
8
8
|
- 0
|
9
|
-
version: 1.
|
9
|
+
version: 1.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tim Morgan
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-05-13 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -43,6 +43,18 @@ dependencies:
|
|
43
43
|
version: "0"
|
44
44
|
type: :development
|
45
45
|
version_requirements: *id002
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: yard
|
48
|
+
prerelease: false
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 0
|
55
|
+
version: "0"
|
56
|
+
type: :development
|
57
|
+
version_requirements: *id003
|
46
58
|
description: The official Ruby gem for the Scribd API. Scribd is a document-sharing website allowing people to upload and view documents online.
|
47
59
|
email: api@scribd.com
|
48
60
|
executables: []
|
@@ -50,28 +62,36 @@ executables: []
|
|
50
62
|
extensions: []
|
51
63
|
|
52
64
|
extra_rdoc_files:
|
53
|
-
- README
|
65
|
+
- README
|
54
66
|
files:
|
55
67
|
- .gitignore
|
56
68
|
- History.txt
|
57
|
-
- README
|
69
|
+
- README
|
58
70
|
- Rakefile
|
59
71
|
- VERSION
|
60
72
|
- lib/rscribd.rb
|
61
|
-
- lib/
|
62
|
-
- lib/
|
63
|
-
- lib/
|
64
|
-
- lib/
|
65
|
-
- lib/
|
66
|
-
- lib/
|
73
|
+
- lib/scribd/api.rb
|
74
|
+
- lib/scribd/category.rb
|
75
|
+
- lib/scribd/collection.rb
|
76
|
+
- lib/scribd/document.rb
|
77
|
+
- lib/scribd/errors.rb
|
78
|
+
- lib/scribd/resource.rb
|
79
|
+
- lib/scribd/security.rb
|
80
|
+
- lib/scribd/user.rb
|
81
|
+
- lib/support/extensions.rb
|
82
|
+
- lib/support/multipart_hack.rb
|
83
|
+
- rscribd.gemspec
|
67
84
|
- sample/01_upload.rb
|
68
85
|
- sample/02_user.rb
|
69
86
|
- sample/test.txt
|
70
87
|
- spec/api_spec.rb
|
88
|
+
- spec/category_spec.rb
|
89
|
+
- spec/collection_spec.rb
|
71
90
|
- spec/document_spec.rb
|
72
91
|
- spec/error_spec.rb
|
73
92
|
- spec/resource_spec.rb
|
74
93
|
- spec/rscribd_spec.rb
|
94
|
+
- spec/security_spec.rb
|
75
95
|
- spec/user_spec.rb
|
76
96
|
has_rdoc: true
|
77
97
|
homepage: http://www.scribd.com/developers
|
@@ -98,15 +118,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
118
|
version: "0"
|
99
119
|
requirements: []
|
100
120
|
|
101
|
-
rubyforge_project:
|
121
|
+
rubyforge_project: rscribd
|
102
122
|
rubygems_version: 1.3.6
|
103
123
|
signing_key:
|
104
124
|
specification_version: 3
|
105
125
|
summary: Ruby client library for the Scribd API
|
106
126
|
test_files:
|
107
127
|
- spec/api_spec.rb
|
128
|
+
- spec/category_spec.rb
|
129
|
+
- spec/collection_spec.rb
|
108
130
|
- spec/document_spec.rb
|
109
131
|
- spec/error_spec.rb
|
110
132
|
- spec/resource_spec.rb
|
111
133
|
- spec/rscribd_spec.rb
|
134
|
+
- spec/security_spec.rb
|
112
135
|
- spec/user_spec.rb
|
data/lib/scribduser.rb
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
module Scribd
|
2
|
-
|
3
|
-
# A user of the Scribd website. API programs can use this class to log in as a
|
4
|
-
# Scribd user, create new user accounts, and get information about the current
|
5
|
-
# user.
|
6
|
-
#
|
7
|
-
# An API program begins by logging into Scribd:
|
8
|
-
#
|
9
|
-
# user = Scribd::User.login 'login', 'pass'
|
10
|
-
#
|
11
|
-
# You can now access information about this user through direct method calls:
|
12
|
-
#
|
13
|
-
# user.name #=> 'Real Name'
|
14
|
-
#
|
15
|
-
# If, at any time, you would like to retrieve the Scribd::User instance for
|
16
|
-
# the currently logged-in user, simply call:
|
17
|
-
#
|
18
|
-
# user = Scribd::API.instance.user
|
19
|
-
#
|
20
|
-
# For information on a user's attributes, please consult the online API
|
21
|
-
# documentation at http://www.scribd.com/developers/api?method_name=user.login
|
22
|
-
#
|
23
|
-
# You can create a new account with the signup (a.k.a. create) method:
|
24
|
-
#
|
25
|
-
# user = Scribd::User.signup :username => 'testuser', :password => 'testpassword', :email => your@email.com
|
26
|
-
|
27
|
-
class User < Resource
|
28
|
-
|
29
|
-
# Creates a new, unsaved user with the given attributes. You can eventually
|
30
|
-
# use this record to create a new Scribd account.
|
31
|
-
|
32
|
-
def initialize(options={})
|
33
|
-
super
|
34
|
-
if options[:xml] then
|
35
|
-
load_attributes(options[:xml])
|
36
|
-
@saved = true
|
37
|
-
@created = true
|
38
|
-
else
|
39
|
-
@attributes = options
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# For new, unsaved records, creates a new Scribd user with the provided
|
44
|
-
# attributes, then logs in as that user. Currently modification of existing
|
45
|
-
# Scribd users is not supported. Throws a ResponseError if a remote error
|
46
|
-
# occurs.
|
47
|
-
|
48
|
-
def save
|
49
|
-
if not created? then
|
50
|
-
response = API.instance.send_request('user.signup', @attributes)
|
51
|
-
xml = response.get_elements('/rsp')[0]
|
52
|
-
load_attributes(xml)
|
53
|
-
API.instance.user = self
|
54
|
-
else
|
55
|
-
raise NotImplementedError, "Cannot update a user once that user's been saved"
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Returns a list of documents owned by this user. By default, the size of the returned
|
60
|
-
# list is capped at 1000. Use the :limit and :offset parameters to page through this
|
61
|
-
# user's documents, however :limit cannot be greater than 1000. This list is _not_
|
62
|
-
# backed by the server, so if you add or remove items from it, it will not
|
63
|
-
# make those changes server-side. This also has some tricky consequences
|
64
|
-
# when modifying a list of documents while iterating over it:
|
65
|
-
#
|
66
|
-
# docs = user.documents
|
67
|
-
# docs.each(&:destroy)
|
68
|
-
# docs #=> Still populated, because it hasn't been updated
|
69
|
-
# docs = user.documents #=> Now it's empty
|
70
|
-
#
|
71
|
-
# Scribd::Document instances returned through this method have more
|
72
|
-
# attributes than those returned by the Scribd::Document.find method. The
|
73
|
-
# additional attributes are documented online at
|
74
|
-
# http://www.scribd.com/developers/api?method_name=docs.getSettings
|
75
|
-
|
76
|
-
def documents(options = {})
|
77
|
-
response = API.instance.send_request('docs.getList', options.merge(:session_key => @attributes[:session_key]))
|
78
|
-
documents = Array.new
|
79
|
-
response.elements['/rsp/resultset'].elements.each do |doc|
|
80
|
-
documents << Document.new(:xml => doc, :owner => self)
|
81
|
-
end
|
82
|
-
return documents
|
83
|
-
end
|
84
|
-
|
85
|
-
# Finds documents owned by this user matching a given query. The parameters
|
86
|
-
# provided to this method are identical to those provided to
|
87
|
-
# Scribd::Document.find.
|
88
|
-
|
89
|
-
def find_documents(options)
|
90
|
-
return nil unless @attributes[:session_key]
|
91
|
-
Document.find options.merge(:scope => 'user', :session_key => @attributes[:session_key])
|
92
|
-
end
|
93
|
-
|
94
|
-
# Loads a Scribd::Document by ID. You can only load such documents if they
|
95
|
-
# belong to this user.
|
96
|
-
|
97
|
-
def find_document(document_id)
|
98
|
-
return nil unless @attributes[:session_key]
|
99
|
-
response = API.instance.send_request('docs.getSettings', { :doc_id => document_id, :session_key => @attributes[:session_key] })
|
100
|
-
Document.new :xml => response.elements['/rsp'], :owner => self
|
101
|
-
end
|
102
|
-
|
103
|
-
# Uploads a document to a user's document list. This method takes the
|
104
|
-
# following options:
|
105
|
-
#
|
106
|
-
# +file+:: The location of a file on disk or the URL to a file on the Web
|
107
|
-
# +type+:: The file's type (e.g., "txt" or "ppt"). Optional if the file has
|
108
|
-
# an extension (like "file.txt").
|
109
|
-
#
|
110
|
-
# There are other options you can specify. For more information, see the
|
111
|
-
# Scribd::Document.save method.
|
112
|
-
|
113
|
-
def upload(options)
|
114
|
-
raise NotReadyError, "User hasn't been created yet" unless created?
|
115
|
-
Document.create options.merge(:owner => self)
|
116
|
-
end
|
117
|
-
|
118
|
-
class << self
|
119
|
-
alias_method :signup, :create
|
120
|
-
end
|
121
|
-
|
122
|
-
# Logs into Scribd using the given username and password. This user will be
|
123
|
-
# used for all subsequent Scribd API calls. You must log in before you can
|
124
|
-
# use protected API functions. Returns the Scribd::User instance for the
|
125
|
-
# logged in user.
|
126
|
-
|
127
|
-
def self.login(username, password)
|
128
|
-
response = API.instance.send_request('user.login', { :username => username, :password => password })
|
129
|
-
xml = response.get_elements('/rsp')[0]
|
130
|
-
user = User.new(:xml => xml)
|
131
|
-
API.instance.user = user
|
132
|
-
return user
|
133
|
-
end
|
134
|
-
|
135
|
-
# Returns the +user_id+ attribute.
|
136
|
-
|
137
|
-
def id
|
138
|
-
self.user_id
|
139
|
-
end
|
140
|
-
|
141
|
-
def to_s #:nodoc:
|
142
|
-
@attributes[:username]
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|