ubiquitously 0.0.1.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. data/README.markdown +224 -19
  2. data/Rakefile +12 -4
  3. data/bin/u.me +4 -0
  4. data/lib/ubiquitously.rb +56 -7
  5. data/lib/ubiquitously/commands/base.rb +118 -0
  6. data/lib/ubiquitously/commands/post.rb +108 -0
  7. data/lib/ubiquitously/commands/user.rb +111 -0
  8. data/lib/ubiquitously/extensions/callbacks.rb +62 -0
  9. data/lib/ubiquitously/extensions/core.rb +88 -0
  10. data/lib/ubiquitously/extensions/mechanize.rb +35 -0
  11. data/lib/ubiquitously/models/base.rb +18 -0
  12. data/lib/ubiquitously/models/page.rb +28 -0
  13. data/lib/ubiquitously/models/post.rb +66 -0
  14. data/lib/ubiquitously/models/service.rb +1 -0
  15. data/lib/ubiquitously/models/service/account.rb +57 -0
  16. data/lib/ubiquitously/models/service/account/authorizable.rb +58 -0
  17. data/lib/ubiquitously/models/service/account/loggable.rb +50 -0
  18. data/lib/ubiquitously/models/service/account/restful.rb +21 -0
  19. data/lib/ubiquitously/models/service/post.rb +59 -0
  20. data/lib/ubiquitously/models/service/post/loggable.rb +64 -0
  21. data/lib/ubiquitously/models/service/post/ownable.rb +31 -0
  22. data/lib/ubiquitously/models/service/post/postable.rb +73 -0
  23. data/lib/ubiquitously/models/service/post/restful.rb +52 -0
  24. data/lib/ubiquitously/models/user.rb +128 -0
  25. data/lib/ubiquitously/services/blogger_den.rb +68 -0
  26. data/lib/ubiquitously/services/chetzit.rb +37 -0
  27. data/lib/ubiquitously/services/code_project.rb +21 -0
  28. data/lib/ubiquitously/services/delicious.rb +54 -0
  29. data/lib/ubiquitously/services/design_bump.rb +41 -0
  30. data/lib/ubiquitously/services/designgizer.rb +21 -0
  31. data/lib/ubiquitously/services/designr_fix.rb +21 -0
  32. data/lib/ubiquitously/services/digg.rb +151 -0
  33. data/lib/ubiquitously/services/digzign.rb +25 -0
  34. data/lib/ubiquitously/services/diigo.rb +68 -0
  35. data/lib/ubiquitously/services/dzone.rb +132 -0
  36. data/lib/ubiquitously/services/dzone_snippets.rb +39 -0
  37. data/lib/ubiquitously/services/facebook.rb +42 -0
  38. data/lib/ubiquitously/services/faves.rb +81 -0
  39. data/lib/ubiquitously/services/favshare.rb +78 -0
  40. data/lib/ubiquitously/services/flikode.rb +38 -0
  41. data/lib/ubiquitously/services/friendfeed.rb +21 -0
  42. data/lib/ubiquitously/services/gist.rb +52 -0
  43. data/lib/ubiquitously/services/google_buzz.rb +15 -0
  44. data/lib/ubiquitously/services/identica.rb +15 -0
  45. data/lib/ubiquitously/services/jump_tags.rb +21 -0
  46. data/lib/ubiquitously/services/kailoon.rb +27 -0
  47. data/lib/ubiquitously/services/meta_filter.rb +26 -0
  48. data/lib/ubiquitously/services/mixx.rb +94 -0
  49. data/lib/ubiquitously/services/mmo.rb +22 -0
  50. data/lib/ubiquitously/services/mvc_forge.rb +37 -0
  51. data/lib/ubiquitously/services/my_space.rb +25 -0
  52. data/lib/ubiquitously/services/nestdev.rb +36 -0
  53. data/lib/ubiquitously/services/newsvine.rb +76 -0
  54. data/lib/ubiquitously/services/pixel_groovy.rb +22 -0
  55. data/lib/ubiquitously/services/posterous.rb +24 -0
  56. data/lib/ubiquitously/services/programmers_heaven.rb +21 -0
  57. data/lib/ubiquitously/{propeller.rb → services/propeller.rb} +17 -26
  58. data/lib/ubiquitously/services/queness.rb +38 -0
  59. data/lib/ubiquitously/services/reddit.rb +62 -0
  60. data/lib/ubiquitously/services/scribd.rb +21 -0
  61. data/lib/ubiquitously/services/script_and_style.rb +23 -0
  62. data/lib/ubiquitously/services/sharebrain.rb +19 -0
  63. data/lib/ubiquitously/services/shoutwire.rb +34 -0
  64. data/lib/ubiquitously/services/slideshare.rb +70 -0
  65. data/lib/ubiquitously/services/smipple.rb +21 -0
  66. data/lib/ubiquitously/services/snipplr.rb +67 -0
  67. data/lib/ubiquitously/services/snipt.rb +49 -0
  68. data/lib/ubiquitously/services/sphinn.rb +24 -0
  69. data/lib/ubiquitously/services/stumble_upon.rb +67 -0
  70. data/lib/ubiquitously/services/stumpedia.rb +13 -0
  71. data/lib/ubiquitously/services/tumblr.rb +28 -0
  72. data/lib/ubiquitously/services/tweako.rb +53 -0
  73. data/lib/ubiquitously/services/twitter.rb +60 -0
  74. data/lib/ubiquitously/services/web_blend.rb +25 -0
  75. data/lib/ubiquitously/services/webdev5.rb +32 -0
  76. data/lib/ubiquitously/services/who_freelance.rb +21 -0
  77. data/lib/ubiquitously/services/wordtaps.rb +36 -0
  78. data/lib/ubiquitously/services/yahoo_buzz.rb +64 -0
  79. data/lib/ubiquitously/services/youblr.rb +15 -0
  80. data/lib/ubiquitously/services/zabox.rb +22 -0
  81. data/lib/ubiquitously/support/active_record.rb +25 -0
  82. data/lib/ubiquitously/support/storage.rb +71 -0
  83. data/test/config/cookies.yml +111 -0
  84. data/test/config/credentials.yml +7 -0
  85. data/test/config/secrets.yml +33 -0
  86. data/test/config/tokens.yml +30 -0
  87. data/test/meta.html +19 -0
  88. data/test/test_delicious.rb +37 -0
  89. data/test/test_digg.rb +57 -0
  90. data/test/test_dzone.rb +23 -18
  91. data/test/test_facebook.rb +40 -0
  92. data/test/test_faves.rb +18 -20
  93. data/test/test_helper.rb +8 -1
  94. data/test/test_newsvine.rb +3 -3
  95. data/test/test_page.rb +21 -0
  96. data/test/test_post.rb +55 -0
  97. data/test/test_propeller.rb +2 -2
  98. data/test/test_reddit.rb +26 -4
  99. data/test/test_stumble_upon.rb +23 -3
  100. data/test/test_twitter.rb +33 -0
  101. data/test/test_user.rb +22 -0
  102. metadata +199 -24
  103. data/lib/ext.rb +0 -37
  104. data/lib/ubiquitously/base.rb +0 -56
  105. data/lib/ubiquitously/dzone.rb +0 -111
  106. data/lib/ubiquitously/faves.rb +0 -43
  107. data/lib/ubiquitously/mister_wong.rb +0 -11
  108. data/lib/ubiquitously/mixins/resourceful.rb +0 -50
  109. data/lib/ubiquitously/mixx.rb +0 -66
  110. data/lib/ubiquitously/newsvine.rb +0 -54
  111. data/lib/ubiquitously/reddit.rb +0 -46
  112. data/lib/ubiquitously/sphinn.rb +0 -11
  113. data/lib/ubiquitously/stumble_upon.rb +0 -61
  114. data/test/config.yml +0 -18
@@ -0,0 +1,21 @@
1
+ module Ubiquitously
2
+ module Scribd
3
+ class Account < Ubiquitously::Service::Account
4
+ def login
5
+ page = agent.get("http://service.com/login")
6
+ form = page.form_with(:name => "loginform")
7
+ form["username"] = username
8
+ form["password"] = password
9
+ page = form.submit
10
+
11
+ authorized?(page.title =~ /Some title/i)
12
+ end
13
+ end
14
+
15
+ class Post < Ubiquitously::Service::Post
16
+ def create
17
+ page = agent.get("")
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ module Ubiquitously
2
+ module ScriptAndStyle
3
+ class Account < Ubiquitously::Service::Account
4
+ end
5
+
6
+ class Post < Ubiquitously::Service::Post
7
+ def create
8
+ page = agent.get("http://scriptandstyle.com/submit")
9
+ form = page.form_with(:name => "tdomf_form1")
10
+
11
+ form["whoami_name"] = user.name
12
+ form["whoami_email"] = user.email
13
+ form["content_title"] = title
14
+ form["whoami_webpage"] = url
15
+ form["content_content"] = description
16
+
17
+ page = form.submit
18
+
19
+ true
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ module Ubiquitously
2
+ module Sharebrain
3
+ class Account < Ubiquitously::Service::Account
4
+ def login
5
+ page = agent.get("http://digzign.com/login")
6
+ form = page.form_with(:name => "loginform")
7
+ form["username"] = username
8
+ form["password"] = password
9
+ page = form.submit
10
+ end
11
+ end
12
+
13
+ class Post < Ubiquitously::Service::Post
14
+ def create
15
+ page = agent.get("")
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,34 @@
1
+ module Ubiquitously
2
+ module Shoutwire
3
+ class Account < Ubiquitously::Service::Account
4
+ def login
5
+ page = agent.get("http://shoutwire.com/login")
6
+ form = page.form_with(:name => "TemplateMainForm")
7
+ form["ctl06$Username"] = username
8
+ form["ctl06$Password"] = password
9
+ page = form.submit
10
+
11
+ authorize!(page.url.downcase != "http://shoutwire.com/login")
12
+ end
13
+ end
14
+
15
+ class Post < Ubiquitously::Service::Post
16
+ def create
17
+ page = agent.get("http://shoutwire.com/submit")
18
+ form = page.form_with(:name => "TemplateMainForm")
19
+ form["ctl06$txtLink"] = token[:url]
20
+ page = form.submit
21
+
22
+ form = page.form_with(:name => "TemplateMainForm")
23
+ form["ctl06$txtTitle"] = token[:title]
24
+ form["ctl06$txtDescription"] = token[:description]
25
+ #page = form.submit
26
+
27
+ # has a captcha, not done
28
+ unless debug?
29
+ page = form.submit
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,70 @@
1
+ module Ubiquitously
2
+ module Slideshare
3
+ class Account < Ubiquitously::Service::Account
4
+ def login
5
+ page = agent.get("http://www.slideshare.net/login")
6
+ form = page.form_with(:action => "/login")
7
+ form["user_login"] = username
8
+ form["user_password"] = password
9
+ form.checkboxes.first.check # remember
10
+ form["login"] = "Login"
11
+ page = form.submit
12
+
13
+ authorize!(page.uri != "http://www.slideshare.net/login")
14
+ end
15
+ end
16
+
17
+ class Post < Ubiquitously::Service::Post
18
+ def create
19
+ page = agent.get(url)
20
+
21
+ header = {
22
+ "X-Requested-With" => "XMLHttpRequest",
23
+ "Referer" => token[:url],
24
+ "Accept" => "application/json, text/javascript, */*"
25
+ }
26
+
27
+ id = page.parser.css(".viralShareItem a.bloggerShare").first["href"].split("/").last
28
+ authenticity_token = page.parser.css("input[name=authenticity_token]").first["value"]
29
+ user_id = agent.get("http://www.slideshare.net/#{user.username_for(self)}").body.match(/\"id\":(\d+)/)[1]
30
+
31
+ # favorite
32
+ params = {
33
+ "authenticity_token" => authenticity_token,
34
+ "favorite[tag_text]" => token[:tags],
35
+ "slideshow_id" => id,
36
+ "source" => "slideviewer",
37
+ "undefined" => "undefined",
38
+ "user_id" => user_id
39
+ }
40
+
41
+ result = agent.post("http://www.slideshare.net/favorite/create", params, header)
42
+
43
+ commented = false
44
+ page.parser.css(".comment").each do |comment|
45
+ if comment["class"].match(/author-(\d+)/)[1].to_s == user_id.to_s
46
+ commented = true
47
+ break
48
+ end
49
+ end
50
+
51
+ unless commented
52
+ # comment
53
+ params = {
54
+ "authenticity_token" => authenticity_token,
55
+ "followup_email" => "undefined",
56
+ "followup_subscribe" => "1",
57
+ "slide_order" => "1",
58
+ "undefined" => "undefined",
59
+ "version" => 2,
60
+ "slide_id" => id,
61
+ "comment[text]" => token[:description]
62
+ }
63
+ result = agent.post("http://www.slideshare.net/comment/create", params, header)
64
+ end
65
+
66
+ true
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,21 @@
1
+ module Ubiquitously
2
+ module Smipple
3
+ class Account < Ubiquitously::Service::Account
4
+ def login
5
+ page = agent.get("http://service.com/login")
6
+ form = page.form_with(:name => "loginform")
7
+ form["username"] = username
8
+ form["password"] = password
9
+ page = form.submit
10
+
11
+ authorize!(page.title =~ /Some title/i)
12
+ end
13
+ end
14
+
15
+ class Post < Ubiquitously::Service::Post
16
+ def create
17
+ page = agent.get("")
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,67 @@
1
+ # snipplr stores an encrypted version of your password in the cookies, watch out!
2
+ # only uses last tag in array :/
3
+ module Ubiquitously
4
+ module Snipplr
5
+ class Account < Ubiquitously::Service::Account
6
+ def login
7
+ page = agent.get("http://snipplr.com/login/")
8
+ form = page.form_with(:action => "/login/")
9
+ form["username"] = username
10
+ form["password"] = password
11
+ form["btnsubmit"] = "LOGIN"
12
+ page = form.submit
13
+
14
+ authorize!(page.uri != "http://snipplr.com/login/")
15
+ end
16
+ end
17
+
18
+ class Post < Ubiquitously::Service::Post
19
+
20
+ def tokenize
21
+ super.merge(:tags => tags.taggify(" ", " "))
22
+ end
23
+
24
+ def create
25
+ page = agent.get("http://snipplr.com/new/")
26
+ form = page.form_with(:action => "/new/")
27
+
28
+ form["title"] = token[:title]
29
+ form["url"] = token[:title].downcase.strip.gsub(/[^a-z0-9]/, "-").squeeze("-")
30
+ form["source"] = token[:description]
31
+ form["tags"] = token[:tags]
32
+ form.field_with(:name => "lang").options.each do |option|
33
+ if option.text.to_s.downcase.strip == format
34
+ option.select
35
+ break
36
+ end
37
+ end
38
+ form["private"] = 1 if private?
39
+
40
+ # captcha
41
+ iframe_url = page.parser.css("noscript iframe").first["src"]
42
+ params = iframe_url.split("?").last
43
+ captcha_iframe = agent.click(page.iframes.first)
44
+ captcha_form = captcha_iframe.forms.first
45
+ captcha_image = captcha_iframe.parser.css("img").first["src"]
46
+ # open browser with captcha image
47
+ system("open", "http://api.recaptcha.net/#{captcha_image}")
48
+ # enter captcha response in terminal
49
+ captcha_says = ask("Enter Captcha from Browser Image: ") { |q| q.echo = true }
50
+ captcha_form["recaptcha_response_field"] = captcha_says
51
+ # submit captcha
52
+ captcha_form.action = "http://www.google.com/recaptcha/api/noscript?#{params}"
53
+ captcha_response = captcha_form.submit
54
+ # grab secret
55
+ captcha_response = captcha_response.parser.css("textarea").first.text
56
+
57
+ form["recaptcha_challenge_field"] = captcha_response
58
+ form["recaptcha_response_field"] = captcha_says
59
+ form["btnsubmit"] = "POST"
60
+
61
+ page = form.submit
62
+
63
+ true
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,49 @@
1
+ module Ubiquitously
2
+ module Snipt
3
+ class Account < Ubiquitously::Service::Account
4
+ def login
5
+ page = agent.get("http://snipt.net/login")
6
+ form = page.form_with(:name => "fauth")
7
+ form["username"] = username
8
+ form["password"] = password
9
+ form["blogin"] = "Login"
10
+ page = form.submit
11
+
12
+ authorize!(page.uri != "http://snipt.net/login")
13
+ end
14
+ end
15
+
16
+ class Post < Ubiquitously::Service::Post
17
+ def create
18
+ page = agent.get("http://snipt.net/#{user.username_for(self)}")
19
+ form = page.forms.detect { |form| form.form_node["id"] == "snippet-form" }
20
+ form["description"] = token[:title]
21
+ form["code"] = token[:description]
22
+ form["tags"] = token[:tags]
23
+ form.field_with(:name => "lexer").options.each do |option|
24
+ option.select if (format == option.value || format == option.text.to_s.downcase)
25
+ end
26
+ form["public"] = public? ? "True" : "False"
27
+ form["id"] = "0"
28
+
29
+ # trailing slash matters
30
+ form.action = "/save/"
31
+
32
+ headers = {
33
+ "X-Requested-With" => "XMLHttpRequest",
34
+ "Accept" => "application/json, text/javascript, */*",
35
+ "Content-Type" => "application/x-www-form-urlencoded; charset=UTF-8",
36
+ "Pragma" => "no-cache",
37
+ "Cache-Control" => "no-cache",
38
+ "Accept-Encoding" => "gzip,deflate"
39
+ }
40
+
41
+ page = form.submit(nil, headers)
42
+
43
+ url = JSON.parse(page.body)["slug"] rescue nil
44
+
45
+ true
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,24 @@
1
+ module Ubiquitously
2
+ module Sphinn
3
+ class Account < Ubiquitously::Service::Account
4
+ def login
5
+ page = agent.get("http://sphinn.com/login/")
6
+ form = page.forms.detect { |form| form.form_node["id"] == "thisform" }
7
+ form["username"] = username
8
+ form["password"] = password
9
+ page = form.submit
10
+
11
+ authorize!(true)
12
+ end
13
+ end
14
+
15
+ class Post < Ubiquitously::Service::Post
16
+ validates_presence_of :url, :title, :description, :tags
17
+
18
+ def save(options = {})
19
+ return false unless valid?
20
+
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,67 @@
1
+ module Ubiquitously
2
+ module StumbleUpon
3
+ class Account < Ubiquitously::Service::Account
4
+ def login
5
+ page = agent.get("http://www.stumbleupon.com/login.php")
6
+ form = page.form_with(:name => "formLogin")
7
+ form["username"] = username
8
+ form["password"] = password
9
+ page = form.submit
10
+
11
+ authorize!(page.body =~ /Currently logged in/i)
12
+ end
13
+ end
14
+
15
+ class Post < Ubiquitously::Service::Post
16
+ submit_to "http://www.stumbleupon.com/submit?url=:url&title=:title"
17
+
18
+ def create
19
+ page = agent.get("http://www.stumbleupon.com/favorites/")
20
+ action = "http://www.stumbleupon.com/ajax/edit/comment"
21
+
22
+ form = page.forms.detect do |form|
23
+ !form.form_node.css("textarea#review").first.blank?
24
+ end
25
+
26
+ headers = {
27
+ "X-Requested-With" => "XMLHttpRequest",
28
+ "Accept" => "application/json, text/javascript, */*"
29
+ }
30
+
31
+ # get key properties
32
+ key = page.parser.css("div#wrapperContent").first["class"]
33
+ var = page.parser.css("li.listLi var").first
34
+ comment_id = var["id"].blank? ? 0 : var["id"]
35
+ public_id = var["class"].blank? ? "" : var["class"]
36
+
37
+ # post to hidden api
38
+ params = {
39
+ "url" => token[:url],
40
+ "title" => token[:title],
41
+ "review" => token[:description],
42
+ "tags" => token[:tags],
43
+ "token" => key,
44
+ "sticky_post" => "0",
45
+ "publicid" => "",
46
+ "syndicate_fb" =>"syndicate_fb",
47
+ "syndicate_tw" => "syndicate_tw",
48
+ "commentid" => 0,
49
+ "new_post" => 1,
50
+ "blog_post" => 0,
51
+ "keep_date" => 0
52
+ }
53
+
54
+ form.action = action
55
+ form.method = "POST"
56
+
57
+ params.each do |k, v|
58
+ form[k] = v
59
+ end
60
+
61
+ page = form.submit(nil, headers)
62
+
63
+ true
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,13 @@
1
+ module Ubiquitously
2
+ module Stumpedia
3
+ class Account < Ubiquitously::Service::Account
4
+ end
5
+
6
+ class Post < Ubiquitously::Service::Post
7
+ def save(options = {})
8
+ return false unless valid?
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,28 @@
1
+ module Ubiquitously
2
+ module Tumblr
3
+ class Account < Ubiquitously::Service::Account
4
+ end
5
+
6
+ class Post < Ubiquitously::Service::Post
7
+ include HTTParty
8
+ base_uri 'http://www.tumblr.com/api'
9
+
10
+ def create
11
+ # type == regular, link, quote, photo, conversation, video, audio, answer
12
+ response = self.class.post("/write", {
13
+ :body => {
14
+ :email => user.username_for(self),
15
+ :password => user.password_for(self),
16
+ :type => "link",
17
+ :name => token[:title],
18
+ :url => token[:url],
19
+ :description => token[:description],
20
+ :tags => token[:tags],
21
+ }
22
+ })
23
+
24
+ true
25
+ end
26
+ end
27
+ end
28
+ end