Sha256: 510fade21773c767469d7eeb31af8f0b22a0b47f2022615f507bdfe1148b2157
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
module Rubyoverflow class Badges < PagedBase attr_reader :badges def initialize(hash, request_path = '') dash = BadgesDash.new hash @badges = Array.new dash.badges.each{ |badgeHash| @badges.push(Badge.new badgeHash)} super(dash, request_path) end class <<self #Retrieves all badges in alphabetical order # #Maps to '/badges' def retrieve_all hash, url = request('badges') Badges.new hash, url end #Retrieves all standard, non-tag-based badges in alphabetical order # #Maps to '/badges/name' def retrieve_all_non_tag_based hash, url = request('badges/name') Badges.new hash, url end #Retrieves all tag-based badges in alphabetical order # #Maps to '/badges/tags' def retrieve_all_tag_based hash, url = request('badges/tags') Badges.new hash, url end #Retrieves all badges that have been awarded to a set of users by their id(s) # #id can be an int, string or an array of ints or strings # #Maps to '/users/{id}/badges' def retrieve_by_user(id) id = convert_to_id_list(id) hash, url = request('users/'+id.to_s+'/badges') Badges.new hash, url end end end class BadgesDash < PagedDash property :badges end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubyoverflow-1.0.2 | lib/rubyoverflow/badges.rb |