Class: Delicious::Bookmarks::Methods::All::Criteria
- Inherits:
-
Object
- Object
- Delicious::Bookmarks::Methods::All::Criteria
- Includes:
- Enumerable
- Defined in:
- lib/delicious/bookmarks/methods/all.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#each(&block) ⇒ Object
Fetches bookmarks from server filtering by current criteria.
-
#from(date) ⇒ Criteria
Sets starting date and time for which you want to get bookmarks.
-
#initialize(&block) ⇒ Criteria
constructor
A new instance of Criteria.
-
#limit(count) ⇒ Criteria
Sets the limit.
-
#offset(count) ⇒ Criteria
Sets the offset.
- #params ⇒ Object
-
#tag(name) ⇒ Criteria
Sets tag-based filtering.
-
#to(date) ⇒ Criteria
Sets ending date and time for which you want to get bookmarks.
Constructor Details
#initialize(&block) ⇒ Criteria
Returns a new instance of Criteria.
40 41 42 |
# File 'lib/delicious/bookmarks/methods/all.rb', line 40 def initialize(&block) @fetch = block end |
Class Method Details
.param(param) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/delicious/bookmarks/methods/all.rb', line 13 def self.param(param) method, query_param = param.is_a?(Hash) ? param.first : [param, param] define_method method do |value| params[query_param] = value self end end |
Instance Method Details
#each(&block) ⇒ Object
Fetches bookmarks from server filtering by current criteria
63 64 65 |
# File 'lib/delicious/bookmarks/methods/all.rb', line 63 def each(&block) @fetch.call(self).each(&block) end |
#from(date) ⇒ Criteria
Sets starting date and time for which you want to get bookmarks
49 50 51 52 |
# File 'lib/delicious/bookmarks/methods/all.rb', line 49 def from(date) params[:fromdt] = format_time(date) self end |
#limit(count) ⇒ Criteria
Sets the limit
26 |
# File 'lib/delicious/bookmarks/methods/all.rb', line 26 param limit: :results |
#offset(count) ⇒ Criteria
Sets the offset
32 |
# File 'lib/delicious/bookmarks/methods/all.rb', line 32 param offset: :start |
#params ⇒ Object
67 68 69 |
# File 'lib/delicious/bookmarks/methods/all.rb', line 67 def params @params ||= {} end |
#tag(name) ⇒ Criteria
Sets tag-based filtering
38 |
# File 'lib/delicious/bookmarks/methods/all.rb', line 38 param :tag |
#to(date) ⇒ Criteria
Sets ending date and time for which you want to get bookmarks
57 58 59 60 |
# File 'lib/delicious/bookmarks/methods/all.rb', line 57 def to(date) params[:todt] = format_time(date) self end |