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.
- data/README.markdown +224 -19
- data/Rakefile +12 -4
- data/bin/u.me +4 -0
- data/lib/ubiquitously.rb +56 -7
- data/lib/ubiquitously/commands/base.rb +118 -0
- data/lib/ubiquitously/commands/post.rb +108 -0
- data/lib/ubiquitously/commands/user.rb +111 -0
- data/lib/ubiquitously/extensions/callbacks.rb +62 -0
- data/lib/ubiquitously/extensions/core.rb +88 -0
- data/lib/ubiquitously/extensions/mechanize.rb +35 -0
- data/lib/ubiquitously/models/base.rb +18 -0
- data/lib/ubiquitously/models/page.rb +28 -0
- data/lib/ubiquitously/models/post.rb +66 -0
- data/lib/ubiquitously/models/service.rb +1 -0
- data/lib/ubiquitously/models/service/account.rb +57 -0
- data/lib/ubiquitously/models/service/account/authorizable.rb +58 -0
- data/lib/ubiquitously/models/service/account/loggable.rb +50 -0
- data/lib/ubiquitously/models/service/account/restful.rb +21 -0
- data/lib/ubiquitously/models/service/post.rb +59 -0
- data/lib/ubiquitously/models/service/post/loggable.rb +64 -0
- data/lib/ubiquitously/models/service/post/ownable.rb +31 -0
- data/lib/ubiquitously/models/service/post/postable.rb +73 -0
- data/lib/ubiquitously/models/service/post/restful.rb +52 -0
- data/lib/ubiquitously/models/user.rb +128 -0
- data/lib/ubiquitously/services/blogger_den.rb +68 -0
- data/lib/ubiquitously/services/chetzit.rb +37 -0
- data/lib/ubiquitously/services/code_project.rb +21 -0
- data/lib/ubiquitously/services/delicious.rb +54 -0
- data/lib/ubiquitously/services/design_bump.rb +41 -0
- data/lib/ubiquitously/services/designgizer.rb +21 -0
- data/lib/ubiquitously/services/designr_fix.rb +21 -0
- data/lib/ubiquitously/services/digg.rb +151 -0
- data/lib/ubiquitously/services/digzign.rb +25 -0
- data/lib/ubiquitously/services/diigo.rb +68 -0
- data/lib/ubiquitously/services/dzone.rb +132 -0
- data/lib/ubiquitously/services/dzone_snippets.rb +39 -0
- data/lib/ubiquitously/services/facebook.rb +42 -0
- data/lib/ubiquitously/services/faves.rb +81 -0
- data/lib/ubiquitously/services/favshare.rb +78 -0
- data/lib/ubiquitously/services/flikode.rb +38 -0
- data/lib/ubiquitously/services/friendfeed.rb +21 -0
- data/lib/ubiquitously/services/gist.rb +52 -0
- data/lib/ubiquitously/services/google_buzz.rb +15 -0
- data/lib/ubiquitously/services/identica.rb +15 -0
- data/lib/ubiquitously/services/jump_tags.rb +21 -0
- data/lib/ubiquitously/services/kailoon.rb +27 -0
- data/lib/ubiquitously/services/meta_filter.rb +26 -0
- data/lib/ubiquitously/services/mixx.rb +94 -0
- data/lib/ubiquitously/services/mmo.rb +22 -0
- data/lib/ubiquitously/services/mvc_forge.rb +37 -0
- data/lib/ubiquitously/services/my_space.rb +25 -0
- data/lib/ubiquitously/services/nestdev.rb +36 -0
- data/lib/ubiquitously/services/newsvine.rb +76 -0
- data/lib/ubiquitously/services/pixel_groovy.rb +22 -0
- data/lib/ubiquitously/services/posterous.rb +24 -0
- data/lib/ubiquitously/services/programmers_heaven.rb +21 -0
- data/lib/ubiquitously/{propeller.rb → services/propeller.rb} +17 -26
- data/lib/ubiquitously/services/queness.rb +38 -0
- data/lib/ubiquitously/services/reddit.rb +62 -0
- data/lib/ubiquitously/services/scribd.rb +21 -0
- data/lib/ubiquitously/services/script_and_style.rb +23 -0
- data/lib/ubiquitously/services/sharebrain.rb +19 -0
- data/lib/ubiquitously/services/shoutwire.rb +34 -0
- data/lib/ubiquitously/services/slideshare.rb +70 -0
- data/lib/ubiquitously/services/smipple.rb +21 -0
- data/lib/ubiquitously/services/snipplr.rb +67 -0
- data/lib/ubiquitously/services/snipt.rb +49 -0
- data/lib/ubiquitously/services/sphinn.rb +24 -0
- data/lib/ubiquitously/services/stumble_upon.rb +67 -0
- data/lib/ubiquitously/services/stumpedia.rb +13 -0
- data/lib/ubiquitously/services/tumblr.rb +28 -0
- data/lib/ubiquitously/services/tweako.rb +53 -0
- data/lib/ubiquitously/services/twitter.rb +60 -0
- data/lib/ubiquitously/services/web_blend.rb +25 -0
- data/lib/ubiquitously/services/webdev5.rb +32 -0
- data/lib/ubiquitously/services/who_freelance.rb +21 -0
- data/lib/ubiquitously/services/wordtaps.rb +36 -0
- data/lib/ubiquitously/services/yahoo_buzz.rb +64 -0
- data/lib/ubiquitously/services/youblr.rb +15 -0
- data/lib/ubiquitously/services/zabox.rb +22 -0
- data/lib/ubiquitously/support/active_record.rb +25 -0
- data/lib/ubiquitously/support/storage.rb +71 -0
- data/test/config/cookies.yml +111 -0
- data/test/config/credentials.yml +7 -0
- data/test/config/secrets.yml +33 -0
- data/test/config/tokens.yml +30 -0
- data/test/meta.html +19 -0
- data/test/test_delicious.rb +37 -0
- data/test/test_digg.rb +57 -0
- data/test/test_dzone.rb +23 -18
- data/test/test_facebook.rb +40 -0
- data/test/test_faves.rb +18 -20
- data/test/test_helper.rb +8 -1
- data/test/test_newsvine.rb +3 -3
- data/test/test_page.rb +21 -0
- data/test/test_post.rb +55 -0
- data/test/test_propeller.rb +2 -2
- data/test/test_reddit.rb +26 -4
- data/test/test_stumble_upon.rb +23 -3
- data/test/test_twitter.rb +33 -0
- data/test/test_user.rb +22 -0
- metadata +199 -24
- data/lib/ext.rb +0 -37
- data/lib/ubiquitously/base.rb +0 -56
- data/lib/ubiquitously/dzone.rb +0 -111
- data/lib/ubiquitously/faves.rb +0 -43
- data/lib/ubiquitously/mister_wong.rb +0 -11
- data/lib/ubiquitously/mixins/resourceful.rb +0 -50
- data/lib/ubiquitously/mixx.rb +0 -66
- data/lib/ubiquitously/newsvine.rb +0 -54
- data/lib/ubiquitously/reddit.rb +0 -46
- data/lib/ubiquitously/sphinn.rb +0 -11
- data/lib/ubiquitously/stumble_upon.rb +0 -61
- 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,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
|