aggcat 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/lib/aggcat/base.rb CHANGED
@@ -27,17 +27,19 @@ module Aggcat
27
27
 
28
28
  protected
29
29
 
30
- def access_token
31
- token = oauth_token
32
- consumer = OAuth::Consumer.new(@consumer_key, @consumer_secret, {:timeout => TIMEOUT})
33
- OAuth::AccessToken.new(consumer, token[:key], token[:secret])
30
+ def oauth_client
31
+ OAuth::AccessToken.new(oauth_consumer, *oauth_token)
32
+ end
33
+
34
+ def oauth_consumer
35
+ @oauth_consumer ||= OAuth::Consumer.new(@consumer_key, @consumer_secret, {:timeout => TIMEOUT})
34
36
  end
35
37
 
36
38
  def oauth_token
37
- now = Time.now.utc
38
- if @oauth_token.nil? || @oauth_token[:expire_at] <= now
39
+ now = Time.now
40
+ if @oauth_token.nil? || @oauth_token_expire_at <= now
39
41
  @oauth_token = new_token(saml_message(@customer_id))
40
- @oauth_token[:expire_at] = now + 9 * 60 # 9 minutes
42
+ @oauth_token_expire_at = now + 9 * 60 # 9 minutes
41
43
  end
42
44
  @oauth_token
43
45
  end
@@ -53,7 +55,7 @@ module Aggcat
53
55
  #http.set_debug_output($stdout)
54
56
  response = http.request(request)
55
57
  params = CGI::parse(response.body)
56
- {key: params['oauth_token'][0], secret: params['oauth_token_secret'][0]}
58
+ [params['oauth_token'][0], params['oauth_token_secret'][0]]
57
59
  end
58
60
 
59
61
  def saml_message(user_id)
data/lib/aggcat/client.rb CHANGED
@@ -91,7 +91,7 @@ module Aggcat
91
91
  private
92
92
 
93
93
  def request(method, uri, *options)
94
- response = access_token.send(method.to_sym, BASE_URL + uri, *options)
94
+ response = oauth_client.send(method.to_sym, BASE_URL + uri, *options)
95
95
  result = {:response_code => response.code, :response => parse_xml(response.body)}
96
96
  if response['challengeSessionId']
97
97
  result[:challenge_session_id] = response['challengeSessionId']
@@ -1,3 +1,3 @@
1
1
  module Aggcat
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aggcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: