Class: API::Tag
- Inherits:
-
Object
- Object
- API::Tag
- Defined in:
- lib/quintype/api/tag.rb
Instance Attribute Summary collapse
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(tag) ⇒ Tag
constructor
A new instance of Tag.
- #to_h(config = {}) ⇒ Object
Constructor Details
#initialize(tag) ⇒ Tag
Returns a new instance of Tag.
26 27 28 |
# File 'lib/quintype/api/tag.rb', line 26 def initialize(tag) @tag = tag end |
Instance Attribute Details
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
5 6 7 |
# File 'lib/quintype/api/tag.rb', line 5 def tag @tag end |
Class Method Details
.find_by_name(name) ⇒ Object
19 20 21 22 23 |
# File 'lib/quintype/api/tag.rb', line 19 def find_by_name(name) if tag = API.tag_by_name(URI.encode(name)) wrap(tag) end end |
.wrap(tag) ⇒ Object
15 16 17 |
# File 'lib/quintype/api/tag.rb', line 15 def wrap(tag) new(tag) if tag end |
.wrap_all(tags) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/quintype/api/tag.rb', line 8 def wrap_all() ||= [] .is_a?(Array) ? .map {|t| wrap(t)} : wrap() end |
Instance Method Details
#to_h(config = {}) ⇒ Object
30 31 32 |
# File 'lib/quintype/api/tag.rb', line 30 def to_h(config={}) self.tag["tag"] end |