hublingo 0.0.5 → 0.0.6
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.
- checksums.yaml +8 -8
- data/README.md +5 -1
- data/lib/hublingo.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDRjYTFkZmNlMDUzNjM0ZjA0ZmZkMjM2NTU1YWFkYTY5OGUxZWRmNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzNhNDBmNjdmMGMxOTljNTdiMzEyZGY4ZDM2MDQyMjhkZGY2ZmI1MQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmU5N2ZiMzgwNDc2OTUwMWVmMzBhYzYyNDk0NzEwZjEzMGM5OGQ5ZjhmNzQ5
|
10
|
+
Y2NiOWQ0NWRlOTQ0YzM2ZWIyMjhhNTI2MGNjMTQ1ZDczZjQ0YzBiMmQzYTc0
|
11
|
+
ZTM1MmQ0YjlmNTNlZTU1M2FkZGVhYTQxZDZjM2M3ZDU3MmUzZmI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDFjYThiODA3YzU5YjI5Y2Q2NGMwMTNjNTJlZDQ2YTI2NjYxNjI2NWEwZTQy
|
14
|
+
YmQ0ZDY5ODI2OTg1MWQ0OWJjZjM3NGUyYzY2ZWY0MTU2NmM4ZDljYTU1ODg2
|
15
|
+
YWVkNzdiYWQ1YmE0YWJhNjllZWFlMWJhOTE3OTc2MmIyOTUwNGU=
|
data/README.md
CHANGED
@@ -4,6 +4,10 @@ A fun project to retrieve the favourite languages of Github users.
|
|
4
4
|
|
5
5
|
Use inside your favourite Rails/Sinatra/Rack application.
|
6
6
|
|
7
|
+
The gem uses your Github application id and secret to retrieve data: in
|
8
|
+
this scenario they should be stored in environment variables. In the Rails
|
9
|
+
app that uses this gem this is managed by dotenv.
|
10
|
+
|
7
11
|
You can also use the gem in irb/pry as follows:
|
8
12
|
|
9
13
|
```ruby
|
@@ -14,7 +18,7 @@ hub.lingo('buddhamagnet')
|
|
14
18
|
|
15
19
|
NOTES:
|
16
20
|
|
17
|
-
This whole project, the gem and application, was completed in 3 1/2 hours.
|
21
|
+
This whole project, the gem and [application](https://github.com/buddhamagnet/hackertongue), was completed in 3 1/2 hours.
|
18
22
|
|
19
23
|
I published it as a gem for giggles only.
|
20
24
|
|
data/lib/hublingo.rb
CHANGED
@@ -5,6 +5,7 @@ class Hublingo
|
|
5
5
|
|
6
6
|
attr_accessor :repos
|
7
7
|
attr_accessor :frequencies
|
8
|
+
attr_accessor :client
|
8
9
|
|
9
10
|
# Constructor initializes repos array and frequencies hash.
|
10
11
|
def initialize
|
@@ -23,7 +24,8 @@ class Hublingo
|
|
23
24
|
# @param hacker [String] the Github username
|
24
25
|
# @return [String] error response or favourite language.
|
25
26
|
def lingo(hacker)
|
26
|
-
@
|
27
|
+
@client = Octokit::Client.new(client_id: ENV['GITHUB_CLIENT_ID'], client_secret: ENV['GITHUB_CLIENT_SECRET'])
|
28
|
+
@repos = client.repositories(hacker)
|
27
29
|
languages || "Sorry that hacker has no public repos!"
|
28
30
|
rescue Octokit::NotFound
|
29
31
|
"That hacker doesn't exist baby."
|
@@ -36,7 +38,7 @@ class Hublingo
|
|
36
38
|
def languages
|
37
39
|
if repos.any?
|
38
40
|
repos.each do |repo|
|
39
|
-
|
41
|
+
client.languages(repo.full_name).fields.each do |field|
|
40
42
|
frequencies[field] += 1
|
41
43
|
end
|
42
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hublingo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Goodchild
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|