Sha256: db90079a90c2fd076486d0f9f6c12ce8639aa631de70d55e30f51dfbd96d2a57
Contents?: true
Size: 829 Bytes
Versions: 3
Compression:
Stored size: 829 Bytes
Contents
module StackExchange module StackOverflow class Badge extend Forwardable def_delegators :@struct, :badge_id, :rank, :name, :description, :award_count, :tag_based, :badges_recipients_url class << self attr_reader :client def all(options = {}) method = select_method options response = client.request(method, options) badges = response['badges'] badges.map { |badge| Badge.new badge } end def select_method(options) tag_based = options[:tag_based] || options['tag_based'] tag_based ? '/badges/tags' : '/badges' end end def initialize(hash) @struct = OpenStruct.new hash end def id @struct.badge_id end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pilha-0.1.5 | lib/pilha/stack_overflow/badge.rb |
pilha-0.1.3 | lib/pilha/stack_overflow/badge.rb |
pilha-0.1.2 | lib/pilha/stack_overflow/badge.rb |