Class: WTForum::User
- Inherits:
-
Object
show all
- Defined in:
- lib/wtforum/user.rb
Defined Under Namespace
Classes: NotFound, UsernameAlreadyTaken
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(wtforum, attributes) ⇒ User
Returns a new instance of User.
21
22
23
24
|
# File 'lib/wtforum/user.rb', line 21
def initialize wtforum, attributes
self.wtforum = wtforum
self.attributes = attributes
end
|
Instance Attribute Details
#apikey=(value) ⇒ Object
Sets the attribute apikey
57
58
59
|
# File 'lib/wtforum/user.rb', line 57
def apikey=(value)
@apikey = value
end
|
#email ⇒ Object
Returns the value of attribute email.
56
57
58
|
# File 'lib/wtforum/user.rb', line 56
def email
@email
end
|
#field276177 ⇒ Object
Returns the value of attribute field276177.
56
57
58
|
# File 'lib/wtforum/user.rb', line 56
def field276177
@field276177
end
|
#field276178 ⇒ Object
Returns the value of attribute field276178.
56
57
58
|
# File 'lib/wtforum/user.rb', line 56
def field276178
@field276178
end
|
#field276179 ⇒ Object
Returns the value of attribute field276179.
56
57
58
|
# File 'lib/wtforum/user.rb', line 56
def field276179
@field276179
end
|
#id ⇒ Object
Returns the value of attribute id.
56
57
58
|
# File 'lib/wtforum/user.rb', line 56
def id
@id
end
|
#member ⇒ Object
Returns the value of attribute member.
56
57
58
|
# File 'lib/wtforum/user.rb', line 56
def member
@member
end
|
#name ⇒ Object
Returns the value of attribute name.
56
57
58
|
# File 'lib/wtforum/user.rb', line 56
def name
@name
end
|
#pw=(value) ⇒ Object
57
58
59
|
# File 'lib/wtforum/user.rb', line 57
def pw=(value)
@pw = value
end
|
#wtforum ⇒ Object
Returns the value of attribute wtforum.
56
57
58
|
# File 'lib/wtforum/user.rb', line 56
def wtforum
@wtforum
end
|
Class Method Details
.create(wtforum, response, attributes) ⇒ Object
6
7
8
9
10
|
# File 'lib/wtforum/user.rb', line 6
def self.create wtforum, response, attributes
user_id = WTForum.(:userid, from: response.body)
attributes[:id] = user_id.to_i
new(wtforum, attributes)
end
|
.destroy(wtforum, user_id) ⇒ Object
16
17
18
19
|
# File 'lib/wtforum/user.rb', line 16
def self.destroy wtforum, user_id
wtforum.destroy_user(user_id)
true
end
|
.update(wtforum, user_id, attributes) ⇒ Object
12
13
14
|
# File 'lib/wtforum/user.rb', line 12
def self.update wtforum, user_id, attributes
wtforum.find_user(user_id).update_attributes!(attributes)
end
|
Instance Method Details
#about ⇒ Object
83
84
85
|
# File 'lib/wtforum/user.rb', line 83
def about
field276179
end
|
#about=(value) ⇒ Object
87
88
89
|
# File 'lib/wtforum/user.rb', line 87
def about= value
self.field276179 = value
end
|
#destroy ⇒ Object
52
53
54
|
# File 'lib/wtforum/user.rb', line 52
def destroy
self.class.destroy self.wtforum, id
end
|
#gender ⇒ Object
67
68
69
|
# File 'lib/wtforum/user.rb', line 67
def gender
field276177
end
|
#gender=(value) ⇒ Object
71
72
73
|
# File 'lib/wtforum/user.rb', line 71
def gender= value
self.field276177 = value
end
|
#location ⇒ Object
75
76
77
|
# File 'lib/wtforum/user.rb', line 75
def location
field276178
end
|
#location=(value) ⇒ Object
79
80
81
|
# File 'lib/wtforum/user.rb', line 79
def location= value
self.field276178 = value
end
|
#save! ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/wtforum/user.rb', line 31
def save!
wtforum.edit_user(id).tap do |page|
form = page.forms.first
form["name"] = name
form["field276177"] = field276177
form["field276178"] = field276178
form["field276179"] = field276179
form.submit
end
wtforum.edit_user_username(id).tap do |page|
form = page.forms.first
form["new_username"] = username
form.submit
end
wtforum.edit_user_email(id).tap do |page|
form = page.forms.first
form["email"] = email
form.submit
end
end
|
#update_attributes!(attributes) ⇒ Object
26
27
28
29
|
# File 'lib/wtforum/user.rb', line 26
def update_attributes! attributes
self.attributes = attributes
save!
end
|
#username ⇒ Object
59
60
61
|
# File 'lib/wtforum/user.rb', line 59
def username
member
end
|
#username=(value) ⇒ Object
63
64
65
|
# File 'lib/wtforum/user.rb', line 63
def username= value
self.member = value
end
|