Module: Delicious::Bookmarks::Methods::Create
- Extended by:
- ActiveSupport::Concern
- Included in:
- Api
- Defined in:
- lib/delicious/bookmarks/methods/create.rb
Instance Method Summary collapse
-
#create(attrs) ⇒ Post
Create new bookmark.
Instance Method Details
#create(attrs) ⇒ Post
Create new bookmark
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/delicious/bookmarks/methods/create.rb', line 23 def create(attrs) post = Delicious::Post.new url: attrs[:url], description: attrs[:description], extended: attrs[:extended], tags: attrs[:tags], dt: attrs[:dt], shared: attrs[:shared] if post.valid? response = @client.connection.post '/v1/posts/add', post_attrs(post, attrs[:replace]) code = response.body['result']['code'] fail Delicious::Error, code unless 'done' == code post.persisted = true post.delicious_client = @client end post end |