Class: WTForum::User
- Inherits:
-
Object
- Object
- WTForum::User
- Defined in:
- lib/wtforum/user.rb
Defined Under Namespace
Classes: NotFound
Instance Attribute Summary collapse
-
#apikey ⇒ Object
writeonly
Sets the attribute apikey.
-
#email ⇒ Object
Returns the value of attribute email.
-
#field276177 ⇒ Object
Returns the value of attribute field276177.
-
#field276178 ⇒ Object
Returns the value of attribute field276178.
-
#field276179 ⇒ Object
Returns the value of attribute field276179.
-
#id ⇒ Object
Returns the value of attribute id.
-
#member ⇒ Object
Returns the value of attribute member.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pw ⇒ Object
writeonly
Sets the attribute pw.
-
#wtforum ⇒ Object
Returns the value of attribute wtforum.
Class Method Summary collapse
- .create(wtforum, response, attributes) ⇒ Object
- .destroy(wtforum, user_id) ⇒ Object
- .update(wtforum, user_id, attributes) ⇒ Object
Instance Method Summary collapse
- #about ⇒ Object
- #about=(value) ⇒ Object
- #destroy ⇒ Object
- #gender ⇒ Object
- #gender=(value) ⇒ Object
-
#initialize(wtforum, attributes) ⇒ User
constructor
A new instance of User.
- #location ⇒ Object
- #location=(value) ⇒ Object
- #save! ⇒ Object
- #update_attributes!(attributes) ⇒ Object
- #username ⇒ Object
- #username=(value) ⇒ Object
Constructor Details
#initialize(wtforum, attributes) ⇒ User
Returns a new instance of User.
20 21 22 23 |
# File 'lib/wtforum/user.rb', line 20 def initialize wtforum, attributes self.wtforum = wtforum self.attributes = attributes end |
Instance Attribute Details
#apikey=(value) ⇒ Object (writeonly)
Sets the attribute apikey
56 57 58 |
# File 'lib/wtforum/user.rb', line 56 def apikey=(value) @apikey = value end |
#email ⇒ Object
Returns the value of attribute email.
55 56 57 |
# File 'lib/wtforum/user.rb', line 55 def email @email end |
#field276177 ⇒ Object
Returns the value of attribute field276177.
55 56 57 |
# File 'lib/wtforum/user.rb', line 55 def field276177 @field276177 end |
#field276178 ⇒ Object
Returns the value of attribute field276178.
55 56 57 |
# File 'lib/wtforum/user.rb', line 55 def field276178 @field276178 end |
#field276179 ⇒ Object
Returns the value of attribute field276179.
55 56 57 |
# File 'lib/wtforum/user.rb', line 55 def field276179 @field276179 end |
#id ⇒ Object
Returns the value of attribute id.
55 56 57 |
# File 'lib/wtforum/user.rb', line 55 def id @id end |
#member ⇒ Object
Returns the value of attribute member.
55 56 57 |
# File 'lib/wtforum/user.rb', line 55 def member @member end |
#name ⇒ Object
Returns the value of attribute name.
55 56 57 |
# File 'lib/wtforum/user.rb', line 55 def name @name end |
#pw=(value) ⇒ Object (writeonly)
Sets the attribute pw
56 57 58 |
# File 'lib/wtforum/user.rb', line 56 def pw=(value) @pw = value end |
#wtforum ⇒ Object
Returns the value of attribute wtforum.
55 56 57 |
# File 'lib/wtforum/user.rb', line 55 def wtforum @wtforum end |
Class Method Details
.create(wtforum, response, attributes) ⇒ Object
5 6 7 8 9 |
# File 'lib/wtforum/user.rb', line 5 def self.create wtforum, response, attributes user_id = WTForum.extract_value(:userid, from: response.body) attributes[:id] = user_id.to_i new(wtforum, attributes) end |
.destroy(wtforum, user_id) ⇒ Object
15 16 17 18 |
# File 'lib/wtforum/user.rb', line 15 def self.destroy wtforum, user_id wtforum.destroy_user(user_id) true end |
.update(wtforum, user_id, attributes) ⇒ Object
11 12 13 |
# File 'lib/wtforum/user.rb', line 11 def self.update wtforum, user_id, attributes wtforum.find_user(user_id).update_attributes!(attributes) end |
Instance Method Details
#about ⇒ Object
82 83 84 |
# File 'lib/wtforum/user.rb', line 82 def about field276179 end |
#about=(value) ⇒ Object
86 87 88 |
# File 'lib/wtforum/user.rb', line 86 def about= value self.field276179 = value end |
#destroy ⇒ Object
51 52 53 |
# File 'lib/wtforum/user.rb', line 51 def destroy self.class.destroy self.wtforum, id end |
#gender ⇒ Object
66 67 68 |
# File 'lib/wtforum/user.rb', line 66 def gender field276177 end |
#gender=(value) ⇒ Object
70 71 72 |
# File 'lib/wtforum/user.rb', line 70 def gender= value self.field276177 = value end |
#location ⇒ Object
74 75 76 |
# File 'lib/wtforum/user.rb', line 74 def location field276178 end |
#location=(value) ⇒ Object
78 79 80 |
# File 'lib/wtforum/user.rb', line 78 def location= value self.field276178 = value end |
#save! ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/wtforum/user.rb', line 30 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
25 26 27 28 |
# File 'lib/wtforum/user.rb', line 25 def update_attributes! attributes self.attributes = attributes save! end |
#username ⇒ Object
58 59 60 |
# File 'lib/wtforum/user.rb', line 58 def username member end |
#username=(value) ⇒ Object
62 63 64 |
# File 'lib/wtforum/user.rb', line 62 def username= value self.member = value end |