Class: Ubiquitously::Delicious::Post
Instance Attribute Summary
#captcha, #categories, #description, #downvotes, #extension, #format, #image, #kind, #must_be_unique, #privacy, #rating, #service_id, #service_url, #slug, #source, #source_url, #state, #status, #tags, #title, #token, #upvotes, #url, #user, #vote
Class Method Summary
collapse
Instance Method Summary
collapse
#access_token, #initialize
included
included
included
included
Methods inherited from Base
#apply, #debug?
included, override
Class Method Details
.find(options = {}) ⇒ Object
46
47
48
49
50
|
# File 'lib/ubiquitously/services/delicious.rb', line 46
def find(options = {})
options[:result] = options.delete(:count) unless options[:count].nil?
raise "enter ':basic_auth => {:username => x, :password => y}'" unless options[:basic_auth]
self.get('/posts/get', options)
end
|
Instance Method Details
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/ubiquitously/services/delicious.rb', line 18
def create
puts "CREATE #{@auth.inspect}"
res = self.class.get(
"/posts/add",
:query => {
:url => url,
:description => title,
:extended => description,
:tags => tags.map { |tag| tag.downcase.gsub(/[^a-z0-9]/, "-").squeeze("-") }.join(" ")
},
:basic_auth => @auth
)
puts "RESPONSE: #{res.inspect}"
true
end
|
#remote(options = {}) ⇒ Object
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/ubiquitously/services/delicious.rb', line 34
def remote(options = {})
return nil
raise "what url to do want" if self.url.nil?
@remote ||= self.class.find(options.merge(
:query => {
:url => CGI.escape(self.url)
},
:basic_auth => @auth
))
end
|
14
15
16
|
# File 'lib/ubiquitously/services/delicious.rb', line 14
def tokenize
super.merge(:tags => tags.taggify("-", " "))
end
|