Class: Radian6::Topic
- Inherits:
-
Object
- Object
- Radian6::Topic
- Defined in:
- lib/radian6/topic.rb
Instance Attribute Summary collapse
-
#groups ⇒ Object
Returns the value of attribute groups.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params) ⇒ Topic
constructor
A new instance of Topic.
Constructor Details
#initialize(params) ⇒ Topic
Returns a new instance of Topic.
5 6 7 8 9 10 |
# File 'lib/radian6/topic.rb', line 5 def initialize(params) params = {} unless params.is_a? Hash @name = params[:name] || "" @groups = params[:groups] || "" @id = params[:id] || "" end |
Instance Attribute Details
#groups ⇒ Object
Returns the value of attribute groups.
3 4 5 |
# File 'lib/radian6/topic.rb', line 3 def groups @groups end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/radian6/topic.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/radian6/topic.rb', line 3 def name @name end |
Class Method Details
.from_xml(xml) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/radian6/topic.rb', line 12 def self.from_xml(xml) xml_topics = Nokogiri::XML(xml).root.xpath('//topicFilters/topicFilter') rescue [] topics = [] xml_topics.each do |xml_topic| topics << parse_topic(xml_topic) end return topics end |