Class: Googletastic::Apps
Constant Summary
Constants included from Mixins::Namespaces
Mixins::Namespaces::NAMESPACES
Instance Attribute Summary
Attributes inherited from Base
#acl, #attachment_path, #created_at, #etag, #head, #id, #keep_raw, #raw, #response, #synced_with, #updated_at
Attributes included from Mixins::Attributes
Class Method Summary collapse
-
.create(options = {}) ⇒ Object
follow_meta_refresh for FORMS!!! might have to save cookiejar between requests as captcha is presented domain, first_name, last_name, email, phone, country, username, password, password_confirmation.
- .new_url ⇒ Object
Methods inherited from Base
client_class, #initialize, #to_xml
Methods included from Mixins::Pagination
Methods included from Mixins::Finders
Methods included from Mixins::Parsing
Methods included from Mixins::Requesting
Methods included from Mixins::Attributes
#attribute_names, #has_attribute?, #inspect
Methods included from Mixins::Namespaces
Constructor Details
This class inherits a constructor from Googletastic::Base
Class Method Details
.create(options = {}) ⇒ Object
follow_meta_refresh for FORMS!!! might have to save cookiejar between requests as captcha is presented domain, first_name, last_name, email, phone, country, username, password, password_confirmation
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/googletastic/apps.rb', line 12 def create( = {}) # precaptcha and postcaptcha agent = WWW::Mechanize.new page = agent.get(new_url) # fill out domain name (must already have) form = page.forms_with("domainEntry").first form..first.check form.fields_with("existingDomain").first.value = [:domain] second_page = agent.submit(form) # fill out profile form = second_page.forms.first form.firstName = [:first_name] form.lastName = [:last_name] form.email = [:email] form.phone = [:phone] #form.jobTitle = "" #form.orgName = "" # default value is "US" form.country = [:country] || "US" # form.orgType = "" # form.orgSize # DO YOU AGREE??? form.checkboxes_with("domainAdminCheck").first.check # third page must be filled out within about a minute it seems third_page = agent.submit(form) form = last_page.forms.first # sample CAPTCHA URL (or "format=audio") # form.captchaToken # https://www.google.com/a/cpanel/captcha?format=image&captchaToken=crazy-token form.captchaAnswer = "progshi" form.newUserName = [:username] # minimum 6 chars form.fields_with("newPassword.alpha").first.value = [:password] form.fields_with("newPassword.beta").first.value = [:password_confirmation] last_page = agent.submit(form) # now you have your account form = last_page.forms_with(:action => "VerifyDomainOwnership").first form.(:value => "htmlVer").first.check verify_page = agent.submit(form) form = verify_page.forms_with(:action => "VerifyDomainOwnership") # or "id => 'verificationPages'" # upload file "googlehostedservice.html" with special text, and let google know it's okay special_text = verify_page.parser.xpath("//span[@class='callout']").first.text # upload to http://tinker.heroku.com/googlehostedservice.html apps_home = agent.submit(form) end |
.new_url ⇒ Object
5 6 7 |
# File 'lib/googletastic/apps.rb', line 5 def new_url "http://www.google.com/a/cpanel/domain/new" end |