hublingo 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/hublingo.rb +38 -0
  3. metadata +60 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NThkMDA4MTNlMTg4MzA4YTNiYzk2ODczYmY5MWUwZDA2ZDgyODNiZA==
5
+ data.tar.gz: !binary |-
6
+ NmYxMDBmMmE4NzU0OWJlODYxNjczOThmODljYzA2NzUzMzViM2Y1Yw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MTY3ZDE2OWIwMGI3ZDU3NTcwMTNmOWIzOTlhYzRlMzdlZDU3OTM3NzQ3YTQ2
10
+ Mjk2MGM4ZTI1MmEzMDRlM2Y3MDQxNjNjNGJiNzE4ODQ0NjljYTc2MTRiYWNk
11
+ YzVhYTMwMmRiODQ0MmI2MTMzMmY0NTk5ODI3YTdjNzc3ODZjYWQ=
12
+ data.tar.gz: !binary |-
13
+ OGUzYmNlZjE0M2RmN2MwOGQ4MTM3MjY0MTI3ODgxNDc2M2I3Mjg3ZTViM2Q1
14
+ YWNjNzY1Y2FiZGQzYjkxNjc5NDA4Y2ZkNzljNzk2YjBmZmIzODI0ODQ2Y2U0
15
+ MDM1NGQ0ZDRhODJkNzUyYWJlM2Q1OGQ3MGE1NWU4N2Q1MjI2OGM=
@@ -0,0 +1,38 @@
1
+ require 'octokit'
2
+
3
+ class Hublingo
4
+
5
+ attr_accessor :repos
6
+ attr_accessor :frequencies
7
+
8
+ def initialize
9
+ @repos = []
10
+ @frequencies = Hash.new(0)
11
+ end
12
+
13
+ def size
14
+ repos.size
15
+ end
16
+
17
+ def lingo(hacker)
18
+ @repos = Octokit.repos(hacker)
19
+ languages || "Sorry that hacker has no public repos!"
20
+ rescue Octokit::NotFound
21
+ "That hacker doesn't exist baby."
22
+ rescue Octokit::TooManyRequests
23
+ "Uh oh! Rate limit! Please try again at #{Octokit.rate_limit.resets_at}"
24
+ end
25
+
26
+ def languages
27
+ if repos.any?
28
+ repos.each do |repo|
29
+ Octokit.languages(repo.full_name).fields.each do |field|
30
+ frequencies[field] += 1
31
+ end
32
+ end
33
+ frequencies.sort_by {|k, v| - v}.first.first.to_s
34
+ return frequencies
35
+ end
36
+ false
37
+ end
38
+ end
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hublingo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dave Goodchild
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: octokit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 2.7.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 2.7.1
27
+ description: Seek the languages they love
28
+ email:
29
+ - buddhamagnet@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - lib/hublingo.rb
35
+ homepage: http://github.com/buddhamagnet/hublingo
36
+ licenses:
37
+ - MIT
38
+ metadata: {}
39
+ post_install_message: We hope you enjoy hublingo
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubyforge_project:
55
+ rubygems_version: 2.1.11
56
+ signing_key:
57
+ specification_version: 4
58
+ summary: Hublingo!
59
+ test_files: []
60
+ has_rdoc: