moomerman-twitter_oauth 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/twitter_oauth.rb CHANGED
@@ -5,8 +5,4 @@ require 'json'
5
5
  require 'twitter_oauth/client'
6
6
 
7
7
  module TwitterOAuth
8
- def self.version
9
- yml = YAML.load(File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION.yml])))
10
- "#{yml[:major]}.#{yml[:minor]}.#{yml[:patch]}"
11
- end
12
8
  end
@@ -7,6 +7,16 @@ module TwitterOAuth
7
7
  @secret = options[:secret]
8
8
  end
9
9
 
10
+ def login(token, secret)
11
+ request_token = OAuth::RequestToken.new(
12
+ consumer, token, secret
13
+ )
14
+ @access_token = request_token.get_access_token
15
+ @token = @access_token.token
16
+ @secret = @access_token.secret
17
+ @access_token
18
+ end
19
+
10
20
  def show(username = @username)
11
21
  oauth_response = access_token.get("/users/show/#{username}.json")
12
22
  JSON.parse(oauth_response.body)
@@ -31,7 +41,11 @@ module TwitterOAuth
31
41
  oauth_response = access_token.post('/direct_messages/new.format', :user => user, :text => text)
32
42
  JSON.parse(oauth_response.body)
33
43
  end
34
-
44
+
45
+ def request_token
46
+ consumer.get_request_token
47
+ end
48
+
35
49
  private
36
50
  def consumer
37
51
  @consumer ||= OAuth::Consumer.new(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moomerman-twitter_oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Taylor