Sha256: 728a0c242d63945a9d7ca6edacc80888be6d6d6983916d774e0630287b807ecc

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 Bytes

Contents

module StackExchange
  module StackOverflow
    class Badge < Base

      setup_delegators :@struct, :badge_id, :rank, :name, :description,
                               :award_count, :tag_based, :badges_recipients_url

      class << self 

        def all(options = {})
          method = select_method(options)
          request(method, nil, options)
        end

        def select_method(options)
          tag_based = options[:tag_based] || options['tag_based']
          tag_based ? '/badges/tags' : '/badges'
        end

        def parse(response)
          parse_with_class(response, 'badges', Badge)
          OpenStruct.new response
        end
      end

      def id
        @struct.badge_id
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pilha-0.2.2 lib/pilha/stack_overflow/badge.rb