Class: Ldclip
- Inherits:
-
Object
- Object
- Ldclip
- Defined in:
- lib/ldclip/version.rb,
lib/ldclip.rb
Overview
:nodoc:
Defined Under Namespace
Modules: VERSION
Constant Summary collapse
- LIVEDOOR_CLIP_HOST =
'api.clip.livedoor.com'
Instance Attribute Summary collapse
-
#apikey ⇒ Object
readonly
Returns the value of attribute apikey.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#add(url, description, options = {}) ⇒ Object
options extended # as comment for bookmark tags dt (date) replace shared rate r18.
-
#all(options = {}) ⇒ Object
options tag.
- #delete(url) ⇒ Object
-
#get(options = {}) ⇒ Object
options tag dt (date) url.
-
#initialize(user, apikey) ⇒ Ldclip
constructor
user,apikey get apikey at this url clip.livedoor.com/config/api.
-
#recent(options = {}) ⇒ Object
options tag count (default = 15,max = 100).
-
#update ⇒ Object
return last update date.
Constructor Details
#initialize(user, apikey) ⇒ Ldclip
user,apikey get apikey at this url clip.livedoor.com/config/api
19 20 21 22 |
# File 'lib/ldclip.rb', line 19 def initialize(user, apikey) @user = user @apikey = apikey end |
Instance Attribute Details
#apikey ⇒ Object (readonly)
Returns the value of attribute apikey.
13 14 15 |
# File 'lib/ldclip.rb', line 13 def apikey @apikey end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
13 14 15 |
# File 'lib/ldclip.rb', line 13 def user @user end |
Instance Method Details
#add(url, description, options = {}) ⇒ Object
options extended # as comment for bookmark tags dt (date) replace shared rate r18
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/ldclip.rb', line 68 def add(url, description, = {}) params = [] params << "url=#{url}" params << "description=#{CGI.escape(NKF.nkf('-w',description))}" .each do |t,e| params << "#{t.to_s}=#{CGI.escape(NKF.nkf('-w',e.to_s))}" end connect("posts/add?#{params.join('&')}") end |
#all(options = {}) ⇒ Object
options tag
53 54 55 56 57 |
# File 'lib/ldclip.rb', line 53 def all( = {}) params = '' params += "tag=#{CGI.escape(NKF.nkf('-w',[:tag]))}" if [:tag] connect("posts/all?#{params}") end |
#delete(url) ⇒ Object
80 81 82 83 84 |
# File 'lib/ldclip.rb', line 80 def delete(url) params = "url=#{url}" connect("posts/delete?#{params}") end |
#get(options = {}) ⇒ Object
options tag dt (date) url
33 34 35 36 37 38 39 |
# File 'lib/ldclip.rb', line 33 def get( = {}) params = [] params << "tag=#{CGI.escape(NKF.nkf('-w',[:tag]))}" if [:tag] params << "dt=#{[:dt]}" if [:dt] params << "url=#{[:url]}" if [:url] connect("posts/get?#{params.join('&')}") end |
#recent(options = {}) ⇒ Object
options tag count (default = 15,max = 100)
44 45 46 47 48 49 |
# File 'lib/ldclip.rb', line 44 def recent( = {}) params = [] params << "tag=#{CGI.escape(NKF.nkf('-w',[:tag]))}" if [:tag] params << "count=#{[:count]}" if [:count] connect("posts/recent?#{params.join('&')}") end |
#update ⇒ Object
return last update date
25 26 27 |
# File 'lib/ldclip.rb', line 25 def update connect('posts/update') end |