Class: Fleakr::Objects::Tag
- Inherits:
-
Object
- Object
- Fleakr::Objects::Tag
- Includes:
- Support::Object
- Defined in:
- lib/fleakr/objects/tag.rb
Overview
Tag
This class represents a tag that can be associated with a photo or an individual user.
Attributes
- id
-
The unique identifier for this tag
- raw
-
The raw, user-entered value for this tag
- value
-
The formatted value for this tag. Also available through
to_s
Instance Method Summary collapse
-
#author ⇒ Object
The first user who created this tag.
-
#machine? ⇒ Boolean
Is this a machine tag?.
-
#related ⇒ Object
A list of related tags.
-
#to_s ⇒ Object
The formatted value of the tag.
Methods included from Support::Object
Instance Method Details
#author ⇒ Object
The first user who created this tag. See Fleakr::Objects::User for more information
28 29 30 |
# File 'lib/fleakr/objects/tag.rb', line 28 def @author ||= User.find_by_id() unless .nil? end |
#machine? ⇒ Boolean
Is this a machine tag?
43 44 45 |
# File 'lib/fleakr/objects/tag.rb', line 43 def machine? machine_flag != '0' end |
#related ⇒ Object
A list of related tags. Each of the objects in the collection is an instance of Tag
34 35 36 37 38 39 |
# File 'lib/fleakr/objects/tag.rb', line 34 def @related ||= begin response = Fleakr::Api::MethodRequest.with_response!('tags.getRelated', :tag => value) (response.body/'rsp/tags/tag').map {|e| Tag.new(e) } end end |
#to_s ⇒ Object
The formatted value of the tag. Also available as value
49 50 51 |
# File 'lib/fleakr/objects/tag.rb', line 49 def to_s value end |