class WTForum::User

Attributes

apikey[W]
email[RW]
field276177[RW]
field276178[RW]
field276179[RW]
id[RW]
member[RW]
name[RW]
pw[W]
wtforum[RW]

Public Class Methods

create(wtforum, response, attributes) click to toggle source
# File lib/wtforum/user.rb, line 6
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) click to toggle source
# File lib/wtforum/user.rb, line 16
def self.destroy wtforum, user_id
  wtforum.destroy_user(user_id)
  true
end
new(wtforum, attributes) click to toggle source
# File lib/wtforum/user.rb, line 21
def initialize wtforum, attributes
  self.wtforum = wtforum
  self.attributes = attributes
end
update(wtforum, user_id, attributes) click to toggle source
# File lib/wtforum/user.rb, line 12
def self.update wtforum, user_id, attributes
  wtforum.find_user(user_id).update_attributes!(attributes)
end

Public Instance Methods

about() click to toggle source
# File lib/wtforum/user.rb, line 83
def about
  field276179
end
about=(value) click to toggle source
# File lib/wtforum/user.rb, line 87
def about= value
  self.field276179 = value
end
destroy() click to toggle source
# File lib/wtforum/user.rb, line 52
def destroy
  self.class.destroy self.wtforum, id
end
gender() click to toggle source
# File lib/wtforum/user.rb, line 67
def gender
  field276177
end
gender=(value) click to toggle source
# File lib/wtforum/user.rb, line 71
def gender= value
  self.field276177 = value
end
location() click to toggle source
# File lib/wtforum/user.rb, line 75
def location
  field276178
end
location=(value) click to toggle source
# File lib/wtforum/user.rb, line 79
def location= value
  self.field276178 = value
end
save!() click to toggle source
# 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) click to toggle source
# File lib/wtforum/user.rb, line 26
def update_attributes! attributes
  self.attributes = attributes
  save!
end
username() click to toggle source
# File lib/wtforum/user.rb, line 59
def username
  member
end
username=(value) click to toggle source
# File lib/wtforum/user.rb, line 63
def username= value
  self.member = value
end

Private Instance Methods

attributes=(attributes={}) click to toggle source
# File lib/wtforum/user.rb, line 93
def attributes=(attributes={})
  attributes.each do |key, value|
    send :"#{key}=", value
  end
end