Module: Delicious::Bookmarks::Methods::All

Extended by:
ActiveSupport::Concern
Included in:
Api
Defined in:
lib/delicious/bookmarks/methods/all.rb

Defined Under Namespace

Classes: Criteria

Instance Method Summary collapse

Instance Method Details

#allCriteria

Returns all bookmarks associated with given access token. Results can be paginated:

“‘ruby client.all.offset(150).limit(50).to_a “`

And filtered by date and tag:

“‘ruby client.all.tag(’angular’).from(‘2013/11/12 10:23:00’).to(‘2013/11/13 12:10:00’) “‘

Returns:

See Also:



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/delicious/bookmarks/methods/all.rb', line 93

def all
  Criteria.new do |criteria|
    response = @client.connection.get '/v1/posts/all', criteria.params.merge(tag_separator: 'comma')
    posts = response.body['posts'] ? response.body['posts']['post'] : []
    posts.map do |post_attrs|
      Delicious::Post.build_persisted @client,
        url:         post_attrs['href'],
        description: post_attrs['description'],
        extended:    post_attrs['extended'],
        tags:        post_attrs['tag'],
        dt:          post_attrs['time'],
        shared:      (post_attrs['shared'] == 'yes')
    end
  end
end