Class: Delicious::Bundle

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, ActiveModel::Validations, ApiModel
Defined in:
lib/delicious/bundle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ApiModel

#persisted?

Instance Attribute Details

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/delicious/bundle.rb', line 9

def name
  @name
end

#tagsObject

Returns the value of attribute tags.



9
10
11
# File 'lib/delicious/bundle.rb', line 9

def tags
  @tags
end

Instance Method Details

#deleteBoolean

Deletes this bundle

Returns:

  • (Boolean)

    ‘true` upon successful deletion, `false` otherwise

Raises:



18
19
20
21
22
23
24
# File 'lib/delicious/bundle.rb', line 18

def delete
  if persisted? && @delicious_client
    @delicious_client.bundles.delete bundle: name
  else
    fail Delicious::Error, 'Bundle was not saved yet'
  end
end

#saveBoolean

Creates or updates bundle

Returns:

  • (Boolean)

    ‘true` when saved

Raises:

  • (Delicious::Error)

    if bundle is not associated with Delicious::Client or save failed



30
31
32
33
34
35
36
37
# File 'lib/delicious/bundle.rb', line 30

def save
  if @delicious_client
    @delicious_client.bundles.set name, tags
    true
  else
    fail 'Bundle was not saved yet'
  end
end

#to_sObject



39
40
41
# File 'lib/delicious/bundle.rb', line 39

def to_s
  %Q(Delicious::Bundle(name: "#{name}", tags: #{tags}))
end