Permalink
Browse files

Fixed initialization methods on clients.

  • Loading branch information...
1 parent 10d033b commit bdcee3a1fadc147538efee1243bd56643d2da18d Štefan Ľupták committed May 25, 2012
Showing with 10 additions and 3 deletions.
  1. +2 −2 gitlab_hook.rb
  2. +4 −1 lib/bitly_client.rb
  3. +4 −0 lib/twitter_client.rb
View
@@ -8,8 +8,8 @@
configure do
CONFIG = GitLabHook::Config.load
- TwitterClient = GitLabHook::TwitterClient.new
- BitlyClient = GitLabHook::BitlyClient.new
+ TwitterClient = GitLabHook::TwitterClient.load
+ BitlyClient = GitLabHook::BitlyClient.load
end
post '*' do
View
@@ -3,11 +3,14 @@ class BitlyClient
attr_reader :client
+ def self.load
+ client = new.client
+ end
+
def initialize
config = GitLabHook::Config.config
Bitly.use_api_version_3
@client = Bitly.new(config[:bitly][:username], config[:bitly][:api_key])
- return client
end
end
View
@@ -3,6 +3,10 @@ class TwitterClient
attr_reader :client
+ def self.load
+ client = new.client
+ end
+
def initialize
config = GitLabHook::Config.config
@client = Twitter::Client.new(config[:twitter])

0 comments on commit bdcee3a

Please sign in to comment.