pupil 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.document CHANGED
@@ -1,4 +1,5 @@
1
1
  lib/**/*.rb
2
+ lib/*.rb
2
3
  bin/*
3
4
  -
4
5
  features/**/*.feature
@@ -1,6 +1,6 @@
1
1
  = pupil
2
2
 
3
- Description goes here.
3
+ Pupil is lazy Twitter API Wrapper for Ruby 1.9.x
4
4
 
5
5
  == Contributing to pupil
6
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -7,6 +7,9 @@ require 'rubygems' if RUBY_VERSION < '1.9.0'
7
7
  require 'oauth'
8
8
  #require 'pp'
9
9
 
10
+ $LOAD_PATH << File.dirname(File.expand_path(__FILE__)) if RUBY_VERSION >= '1.9.0'
11
+ require 'pupil/keygen'
12
+
10
13
  class Pupil
11
14
  attr_reader :screen_name
12
15
 
@@ -75,7 +78,7 @@ class Pupil
75
78
  return self.root.get_text("error")
76
79
  end
77
80
  end
78
-
81
+
79
82
  public
80
83
 
81
84
  # @return [Hash] user profile
@@ -1,32 +1,42 @@
1
- #!/usr/bin/env ruby
2
1
  # -*- coding: utf-8 -*-
3
2
 
4
- require 'rubygems' if RUBY_VERSION < '1.9.0'
5
- require 'oauth'
6
-
7
3
  class Pupil
8
- def self.keygen
9
- print "Enter OAuth Consumer_Key: "
10
- oauth_consumer_key = gets.chomp.strip
11
- print "Enter OAuth Consumer_Secret: "
12
- oauth_consumer_secret = gets.chomp.strip
13
-
14
- CONSUMER_KEY = oauth_consumer_key
15
- CONSUMER_SECRET = oauth_consumer_secret
16
-
17
- consumer = OAuth::Consumer.new(CONSUMER_KEY, CONSUMER_SECRET, :site => 'http://twitter.com')
18
-
19
- request_token = consumer.get_request_token
20
-
21
- puts "Access to this URL and approve: #{request_token.authorize_url}"
22
-
23
- print "Enter OAuth Verifier: "
24
- oauth_verifier = gets.chomp.strip
25
-
26
- access_token = request_token.get_access_token(:oauth_verifier => oauth_verifier)
27
-
28
- puts "Process complete!"
29
- puts "Access token: #{access_token.token}"
30
- puts "Access token secret: #{access_token.secret}"
31
- end
4
+ class Keygen
5
+ class MissingRequiedTokens < StandardError; end
6
+
7
+ def initialize opts={}
8
+ @con_key = opts[:consumer_key] rescue nil
9
+ @con_sec = opts[:consumer_secret] rescue nil
10
+ @act_key = opts[:access_token] rescue nil
11
+ @act_sec = opts[:access_token_secret] rescue nil
12
+ end
13
+
14
+ def access_token
15
+ raise MissingRequiedTokens, "Keygen#access_token require consumer_key and consumer_secret" unless @con_key && @con_sec
16
+ end
17
+
18
+ def interactive
19
+ print "Enter OAuth Consumer_Key: "
20
+ oauth_consumer_key = gets.chomp.strip
21
+ print "Enter OAuth Consumer_Secret: "
22
+ oauth_consumer_secret = gets.chomp.strip
23
+
24
+ CONSUMER_KEY = oauth_consumer_key
25
+ CONSUMER_SECRET = oauth_consumer_secret
26
+
27
+ consumer = OAuth::Consumer.new(CONSUMER_KEY, CONSUMER_SECRET, :site => 'http://twitter.com')
28
+
29
+ request_token = consumer.get_request_token
30
+
31
+ puts "Access to this URL and approve: #{request_token.authorize_url}"
32
+
33
+ print "Enter OAuth Verifier: "
34
+ oauth_verifier = gets.chomp.strip
35
+
36
+ access_token = request_token.get_access_token(:oauth_verifier => oauth_verifier)
37
+
38
+ puts "Process complete!"
39
+ puts "Access token: #{access_token.token}"
40
+ puts "Access token secret: #{access_token.secret}"
41
+ end
32
42
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pupil}
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Oame}]
12
- s.date = %q{2011-09-11}
12
+ s.date = %q{2011-10-10}
13
13
  s.description = %q{The "Lazy" Twitter API wrapper for Ruby. It was made for Kbot library.}
14
14
  s.email = %q{oame@oameya.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pupil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-11 00:00:00.000000000Z
12
+ date: 2011-10-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth
16
- requirement: &2154807720 !ruby/object:Gem::Requirement
16
+ requirement: &2154343320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2154807720
24
+ version_requirements: *2154343320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &2154807120 !ruby/object:Gem::Requirement
27
+ requirement: &2154342740 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.3.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2154807120
35
+ version_requirements: *2154342740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yard
38
- requirement: &2154806520 !ruby/object:Gem::Requirement
38
+ requirement: &2154342160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.6.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2154806520
46
+ version_requirements: *2154342160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &2154805920 !ruby/object:Gem::Requirement
49
+ requirement: &2154341560 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2154805920
57
+ version_requirements: *2154341560
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &2154805280 !ruby/object:Gem::Requirement
60
+ requirement: &2154340980 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.6.4
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2154805280
68
+ version_requirements: *2154340980
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rcov
71
- requirement: &2154804680 !ruby/object:Gem::Requirement
71
+ requirement: &2154340400 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2154804680
79
+ version_requirements: *2154340400
80
80
  description: The "Lazy" Twitter API wrapper for Ruby. It was made for Kbot library.
81
81
  email: oame@oameya.com
82
82
  executables: []
@@ -113,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
113
  version: '0'
114
114
  segments:
115
115
  - 0
116
- hash: -2172588966398234870
116
+ hash: 422837417626133980
117
117
  required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements: