Class: WTForum::Admin
- Inherits:
-
Object
- Object
- WTForum::Admin
- Defined in:
- lib/wtforum/admin.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #api_key ⇒ Object
-
#domain ⇒ Object
visit “www.websitetoolbox.com/tool/members/mb/addusers” fill_in “member”, with: attributes fill_in “pw”, with: attributes fill_in “email”, with: attributes select “Administrators”, from: “usergroupid” click_button “Register New User” end.
- #domain=(full_domain) ⇒ Object
- #head_html ⇒ Object
- #head_html=(html) ⇒ Object
-
#initialize(attributes = {}) ⇒ Admin
constructor
A new instance of Admin.
- #skin ⇒ Object
- #skin=(skin_name) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Admin
Returns a new instance of Admin.
7 8 9 10 |
# File 'lib/wtforum/admin.rb', line 7 def initialize attributes={} self.username = attributes[:username] self.password = attributes[:password] end |
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
12 13 14 |
# File 'lib/wtforum/admin.rb', line 12 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
12 13 14 |
# File 'lib/wtforum/admin.rb', line 12 def username @username end |
Instance Method Details
#api_key ⇒ Object
14 15 16 17 |
# File 'lib/wtforum/admin.rb', line 14 def api_key page = .get("http://www.websitetoolbox.com/cgi/members/mboard.cgi?action=showmbsettings&tab=Single+Sign+On") page.form_with(name: "posts").field_with(name: "apikey").value end |
#domain ⇒ Object
visit “www.websitetoolbox.com/tool/members/mb/addusers”
fill_in "member", with: attributes[:username]
fill_in "pw", with: attributes[:password]
fill_in "email", with: attributes[:email]
select "Administrators", from: "usergroupid"
"Register New User"
end
30 31 32 33 |
# File 'lib/wtforum/admin.rb', line 30 def domain page = .get("http://www.websitetoolbox.com/cgi/members/main.cgi") page.at(".heading h2 span").text.split("//").last end |
#domain=(full_domain) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/wtforum/admin.rb', line 35 def domain= full_domain domain_parts = full_domain.split(".") subdomain = domain_parts.shift domain = domain_parts.join(".") page = .get("http://www.websitetoolbox.com/tool/members/domain?tool=mb&action=custom_domain_type&dashboard=1") form = page.form_with(action: "domain") form.field_with(name: "domain_sub_domain").value = subdomain form.field_with(name: "domain").value = domain form.submit end |
#head_html ⇒ Object
57 58 59 60 61 |
# File 'lib/wtforum/admin.rb', line 57 def head_html page = .get("http://www.websitetoolbox.com/cgi/members/hf.cgi?tool=mb") form = page.form_with(name: "hfform") form.field_with(name: "head").value end |
#head_html=(html) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/wtforum/admin.rb', line 63 def head_html= html page = .get("http://www.websitetoolbox.com/cgi/members/hf.cgi?tool=mb") form = page.form_with(name: "hfform") form.field_with(name: "head").value = html form.submit end |
#skin ⇒ Object
47 48 49 50 |
# File 'lib/wtforum/admin.rb', line 47 def skin page = .get("http://www.websitetoolbox.com/tool/members/mb/skins") page.at(".skin_title").text.sub(/[[:space:]]+Customize.+$/m, '') end |
#skin=(skin_name) ⇒ Object
52 53 54 55 |
# File 'lib/wtforum/admin.rb', line 52 def skin= skin_name skin_id = skins.fetch(skin_name) .get("http://www.websitetoolbox.com/tool/members/mb/skins?action=install_skin&subaction=skins&skin_id=#{skin_id}&search_skin=&sorted=") end |