Skip to content

Commit

Permalink
swap access token to extra file - to prevent commiting the private token
Browse files Browse the repository at this point in the history
  • Loading branch information
julidoehler committed Mar 15, 2012
1 parent 90244d7 commit 09668c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 0 additions & 4 deletions Gemfile.lock
Expand Up @@ -3,13 +3,9 @@ GEM
specs:
daemons (1.1.6)
eventmachine (0.12.10)
json (1.5.4)
mime-types (1.17.2)
rack (1.4.1)
rack-protection (1.2.0)
rack
rest-client (1.6.7)
mime-types (>= 1.16)
sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
Expand Down
5 changes: 5 additions & 0 deletions lib/access_token.rb
@@ -0,0 +1,5 @@
class TOKEN
def get_token
@access = 'ACCESSTOKEN'
end
end
11 changes: 7 additions & 4 deletions lib/githubviz.rb
Expand Up @@ -6,6 +6,7 @@
class GithubViz < Sinatra::Base

require 'github-v3-api.rb'
require 'access_token.rb'

set :public_directory, Proc.new { File.join(root, "public") }
set :public_folder, File.dirname(__FILE__) + '/public'
Expand Down Expand Up @@ -65,8 +66,8 @@ def process_data
@user = params[:user]

if @user

@api = GitHubV3API.new('c1616feca6aa3e63655dd92766a475c2227ed6a0')
@token = TOKEN.new
@api = GitHubV3API.new(@token.get_token)

@data[@user] = @api.get("/users/#{@user}")
@data[@user]['level'] = 0
Expand All @@ -80,7 +81,8 @@ def process_data

get '/repo_viz' do
@user = params[:user]
@api = GitHubV3API.new('c1616feca6aa3e63655dd92766a475c2227ed6a0')
@token = TOKEN.new
@api = GitHubV3API.new(@token.get_token)
user_data = @api.users.get(@user)
my_repos = @api.repos.list
page = 1
Expand Down Expand Up @@ -175,7 +177,8 @@ def process_data
end

get '/circle_viz' do
@api = GitHubV3API.new('c1616feca6aa3e63655dd92766a475c2227ed6a0')
@token = TOKEN.new
@api = GitHubV3API.new(@token.get_token)
@user = params[:user]
user_data = @api.users.get(@user)
#@data[@user] = @api.get("/users/#{@user}")
Expand Down

0 comments on commit 09668c5

Please sign in to comment.