Class: Threesixtyvoice::BadgeList

Inherits:
Object
  • Object
show all
Defined in:
lib/threesixtyvoice/badge_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc) ⇒ BadgeList

Returns a new instance of BadgeList.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/threesixtyvoice/badge_list.rb', line 5

def initialize(doc)
  @version = doc.xpath('//api/info/version').text
  @title = doc.xpath('//api/info/title').text

  @badges = doc.xpath('//api/badges/badge').map do |i|
    Badge.new(i.xpath('id').text, i.xpath('title').text,
              i.xpath('owners').text, i.xpath('image').text,
              i.xpath('description').text, i.xpath("category").text,
              i.xpath("category_id").text, i.xpath('threshold').text,
              i.xpath('categoryname').text, i.xpath('badgescore_old').text,
              i.xpath('badgescore').text, i.xpath('badgescorecount').text
             )
  end
end

Instance Attribute Details

#badgesObject (readonly)

Returns the value of attribute badges.



3
4
5
# File 'lib/threesixtyvoice/badge_list.rb', line 3

def badges
  @badges
end

#titleObject (readonly)

Returns the value of attribute title.



3
4
5
# File 'lib/threesixtyvoice/badge_list.rb', line 3

def title
  @title
end

#versionObject (readonly)

Returns the value of attribute version.



3
4
5
# File 'lib/threesixtyvoice/badge_list.rb', line 3

def version
  @version
end