Module: Delicious::Bundles::Methods::Set

Extended by:
ActiveSupport::Concern
Included in:
Api
Defined in:
lib/delicious/bundles/methods/set.rb

Instance Method Summary collapse

Instance Method Details

#set(name, tags) ⇒ Bundle

Update bundle tags

Parameters:

  • name (String)

    Bundle name

  • tags (Array<String>)

    List of new tags for given bundle

Returns:

Raises:



16
17
18
19
20
21
22
# File 'lib/delicious/bundles/methods/set.rb', line 16

def set(name, tags)
  fail Delicious::Error, "Bundle name can't be blank" if name.nil?
  fail Delicious::Error, 'Please specify at least 1 tag' unless (tags || []).any?
  response = @client.connection.post '/v1/tags/bundles/set', bundle: name, tags: tags.join(',')
  fail Delicious::Error, response.body['result'] unless 'ok' == response.body['result']
  Bundle.build_persisted @client, name: name, tags: tags
end