Class: Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/r43/tag.rb

Overview

Implements a tag object from 43 things. Currently only meant to be constructed by an R43::Request object

require 'r43'
request = R43::Request.new(<api_key>)
tags = request.get_persons_tags(<username>)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTag

Returns a new instance of Tag.



15
16
17
18
# File 'lib/r43/tag.rb', line 15

def initialize()
  # just to initialize the object, we'll always feed the attributes in
  # some other way
end

Instance Attribute Details

#countObject

Returns the value of attribute count.



13
14
15
# File 'lib/r43/tag.rb', line 13

def count
  @count
end

#nameObject

Returns the value of attribute name.



13
14
15
# File 'lib/r43/tag.rb', line 13

def name
  @name
end

Class Method Details

.from_xml(xml) ⇒ Object

Builds a Tag object from an xml object.



23
24
25
26
27
28
29
30
# File 'lib/r43/tag.rb', line 23

def Tag.from_xml(xml)
  tag = Tag.new()

  tag.count= xml.attributes["count"].to_i if xml.attributes["count"]
  tag.name=  xml.text
  
  tag
end