Sha256: a909a623129c90175bd8500cf01b5d23eca7b1f3f998988d44d633ad8ac9b3ae

Contents?: true

Size: 941 Bytes

Versions: 42

Compression:

Stored size: 941 Bytes

Contents

module Octopolo
  module GitHub
    class User
      @cache ||= {}

      attr_accessor :login

      # Public: Instantiate a new User
      #
      # login - The login (username) of the given user
      def initialize login
        self.login = login
      end

      # Public: The real name of the author
      #
      # If the user has a name in GitHub, #author_name returns this. Otherwise
      # returns the given login.
      #
      # Returns a String containing the name
      def author_name
        user_data.name || login
      end

      # Private: The raw GitHub API data for the user
      #
      # Returns a Hashie::Mash containing the data
      def user_data
        User.user_data login
      end

      # Private: The raw GitHub API data for the given login
      #
      # Returns a Hashie::Mash containing the data
      def self.user_data login
        @cache[login] ||= GitHub.user login
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
octopolo-1.1.0 lib/octopolo/github/user.rb
octopolo-1.0.2 lib/octopolo/github/user.rb
octopolo-1.0.1 lib/octopolo/github/user.rb
octopolo-1.0.0 lib/octopolo/github/user.rb
octopolo-0.4.1 lib/octopolo/github/user.rb
octopolo-0.4.0 lib/octopolo/github/user.rb
octopolo-0.3.6 lib/octopolo/github/user.rb
octopolo-0.3.5 lib/octopolo/github/user.rb
octopolo-0.3.4 lib/octopolo/github/user.rb
octopolo-0.3.3 lib/octopolo/github/user.rb
octopolo-0.3.2 lib/octopolo/github/user.rb
octopolo-0.3.1 lib/octopolo/github/user.rb
octopolo-0.3.0 lib/octopolo/github/user.rb
octopolo-0.2.1 lib/octopolo/github/user.rb
octopolo-0.1.4 lib/octopolo/github/user.rb
octopolo-0.2.0 lib/octopolo/github/user.rb
octopolo-0.1.3 lib/octopolo/github/user.rb
octopolo-0.1.2 lib/octopolo/github/user.rb
octopolo-0.1.1 lib/octopolo/github/user.rb
octopolo-0.1.0 lib/octopolo/github/user.rb