Class: Evertils::Common::Entity::Tag

Inherits:
Base show all
Defined in:
lib/evertils/common/entity/tag.rb

Overview

Since:

  • 0.3.0

Constant Summary

Constants inherited from Base

Base::REPLACEMENTS

Instance Attribute Summary

Attributes inherited from Base

#entity

Instance Method Summary collapse

Methods inherited from Base

#end_of_day, #initialize, #placeholders_for, #prop, #start_of_day, #symbolize_keys, #to_s

Methods inherited from Generic

#bytesize, #deprecation_notice, #encoding, #force_encoding, #has_required_fields, #initialize

Constructor Details

This class inherits a constructor from Evertils::Common::Entity::Base

Instance Method Details

#create(name) ⇒ Object

Since:

  • 0.2.0



18
19
20
21
22
23
24
25
# File 'lib/evertils/common/entity/tag.rb', line 18

def create(name)
  tag = ::Evernote::EDAM::Type::Tag.new
  tag.name = name

  @entity = @evernote.call(:createTag, tag)

  self if @entity
end

#expunge(name) ⇒ Object

Deprecated.

0.2.9

Since:

  • 0.2.0



36
37
38
39
40
41
# File 'lib/evertils/common/entity/tag.rb', line 36

def expunge(name)
  deprecation_notice('0.2.9', 'Replaced with Entity#expunge!  Will be removed in 0.4.0.')
  tag = find(name)

  @evernote.call(:expungeTag, tag.guid)
end

#expunge!Object

Since:

  • 0.2.9



29
30
31
# File 'lib/evertils/common/entity/tag.rb', line 29

def expunge!
  @evernote.call(:expungeTag, @entity.guid)
end

#find(name) ⇒ Object

Since:

  • 0.2.0



7
8
9
10
11
12
13
14
# File 'lib/evertils/common/entity/tag.rb', line 7

def find(name)
  @entity = nil
  tags = Tags.new.all

  @entity = tags.detect { |tag| tag.name == name }

  self if @entity
end