pupil 0.4 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -1
- data/README.ja.md +14 -5
- data/README.md +11 -1
- data/bin/eyedrops +75 -32
- data/lib/pupil/version.rb +1 -1
- metadata +11 -11
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,13 @@
|
|
1
|
+
0.4.1
|
2
|
+
----------------
|
3
|
+
|
4
|
+
* Eyedrops v1.0 released!
|
5
|
+
|
1
6
|
0.4.0
|
2
7
|
----------------
|
3
8
|
|
4
9
|
* Added new commandline tool.
|
5
|
-
"Eyedrops, the interactive
|
10
|
+
"Eyedrops, the interactive Pupil"
|
6
11
|
* Pupil::Keygen are supported readline.
|
7
12
|
|
8
13
|
0.3.3
|
data/README.ja.md
CHANGED
@@ -6,9 +6,11 @@ Pupil はRuby 1.9.xのための"怠惰"なTwitter APIライブラリです。
|
|
6
6
|
フューチャー
|
7
7
|
-------------
|
8
8
|
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
9
|
+
* Pupilは動的なAPIラッパーであり、Twitter APIの仕様変更に柔軟に対応することができます
|
10
|
+
* Ruby on Railsライクな直感的で書きやすい文法
|
11
|
+
* 殆どのREST APIをサポートしていますが、一部のAPIはサポートされていません
|
12
|
+
* Twitter Streaming APIをサポート
|
13
|
+
* コマンドラインからPupilを自由にテスト出来るEyedropsコマンド
|
12
14
|
|
13
15
|
問題
|
14
16
|
-------------
|
@@ -38,7 +40,7 @@ Pupil はRuby 1.9.xのための"怠惰"なTwitter APIライブラリです。
|
|
38
40
|
:access_token_secret => "something"
|
39
41
|
}
|
40
42
|
|
41
|
-
pupil = Pupil.new
|
43
|
+
pupil = Pupil.new(oauth_key)
|
42
44
|
|
43
45
|
# リプライが含まれないタイムラインを取得する
|
44
46
|
pupil.timeline :count => 50, :exclude => :replies
|
@@ -79,7 +81,14 @@ Streaming API を使ってみる
|
|
79
81
|
require "pupil/keygen"
|
80
82
|
|
81
83
|
keygen = Pupil::Keygen.new
|
82
|
-
keygen.interactive #=> インタラクティブにoauth_keyを生成
|
84
|
+
token = keygen.interactive #=> インタラクティブにoauth_keyを生成
|
85
|
+
|
86
|
+
Eyedrops, the interactive Pupil
|
87
|
+
|
88
|
+
> eyedrops -h
|
89
|
+
> eyedrops -u [name] -i
|
90
|
+
eyedrops> twitter.timeline :count => 10
|
91
|
+
...
|
83
92
|
|
84
93
|
協力
|
85
94
|
-------------
|
data/README.md
CHANGED
@@ -6,14 +6,17 @@ Pupil is "Lazy" Twitter API Library for Ruby 1.9.x.
|
|
6
6
|
Features
|
7
7
|
-------------
|
8
8
|
|
9
|
+
* Pupil is Dynamic API Wrapper, can respond flexibly to change specifications of the Twitter API.
|
10
|
+
* Ruby on Rails like syntax.
|
9
11
|
* Almost Twitter REST API are wrapped. However, some API does not support yet.
|
10
12
|
* Twitter Streaming API are supported experimentally.
|
11
|
-
*
|
13
|
+
* Eyedrops, the interactive Pupil command are contained.
|
12
14
|
|
13
15
|
Problems
|
14
16
|
-------------
|
15
17
|
|
16
18
|
* Some REST API are not supported.
|
19
|
+
* Unstable
|
17
20
|
|
18
21
|
Requirement
|
19
22
|
-------------
|
@@ -81,6 +84,13 @@ Making `oauth_key`
|
|
81
84
|
keygen = Pupil::Keygen.new
|
82
85
|
keygen.interactive #=> Generate pupil_key interactively
|
83
86
|
|
87
|
+
Eyedrops, the interactive Pupil
|
88
|
+
|
89
|
+
> eyedrops -h
|
90
|
+
> eyedrops -u [name] -i
|
91
|
+
eyedrops> twitter.timeline :count => 10
|
92
|
+
...
|
93
|
+
|
84
94
|
Contributing to pupil
|
85
95
|
-------------
|
86
96
|
|
data/bin/eyedrops
CHANGED
@@ -1,10 +1,23 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
2
3
|
|
3
4
|
require "pupil"
|
4
5
|
require "pupil/keygen"
|
5
6
|
require "yaml"
|
6
7
|
require "fileutils"
|
7
8
|
require "readline"
|
9
|
+
require "optparse"
|
10
|
+
require "pp"
|
11
|
+
|
12
|
+
class String
|
13
|
+
def undent
|
14
|
+
gsub /^.{#{slice(/^ +/).length}}/, ''
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Eyedrops
|
19
|
+
VERSION = "1.0"
|
20
|
+
end
|
8
21
|
|
9
22
|
class Credentials
|
10
23
|
attr_accessor :credentials
|
@@ -18,7 +31,7 @@ class Credentials
|
|
18
31
|
def save
|
19
32
|
YAML.dump(@credentials, File.open(@credentials_file, "w"))
|
20
33
|
end
|
21
|
-
|
34
|
+
|
22
35
|
def create
|
23
36
|
token = Pupil::Keygen.new.interactive
|
24
37
|
@credentials ||= Hash.new
|
@@ -28,6 +41,25 @@ class Credentials
|
|
28
41
|
end
|
29
42
|
end
|
30
43
|
|
44
|
+
def display_help
|
45
|
+
puts <<-EOD.undent
|
46
|
+
Usage: eyedrops [OPTIONS]
|
47
|
+
|
48
|
+
eyedrops> twitter #=> Prepared Pupil instance
|
49
|
+
|
50
|
+
options:
|
51
|
+
-i, --inspect\tDisplay inspected results
|
52
|
+
-a name, --account name\tSign-in account name
|
53
|
+
-h, --help\tShow help
|
54
|
+
-v, --version\tShow version
|
55
|
+
|
56
|
+
eyedrops commands:
|
57
|
+
help\tShow help
|
58
|
+
quit\tExit eyedrops
|
59
|
+
show-account\tDisplay active account
|
60
|
+
EOD
|
61
|
+
end
|
62
|
+
|
31
63
|
# Initialize
|
32
64
|
home_dir = `echo $HOME`.strip
|
33
65
|
eyedrops_dir = File.join(home_dir, ".eyedrops")
|
@@ -40,23 +72,48 @@ unless cred.credentials
|
|
40
72
|
cred.create
|
41
73
|
end
|
42
74
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
75
|
+
ProgramConfig = Hash.new
|
76
|
+
OptionParser.new do |opts|
|
77
|
+
opts.on("-i", "--inspect") do
|
78
|
+
ProgramConfig[:inspect] = true
|
79
|
+
end
|
80
|
+
opts.on("-u", "--user [USER]") do |user|
|
81
|
+
ProgramConfig[:user] = user
|
82
|
+
end
|
83
|
+
opts.on("-h", "--help") do
|
84
|
+
display_help
|
85
|
+
exit
|
86
|
+
end
|
87
|
+
opts.on("-v", "--version") do
|
88
|
+
puts "Eyedrops #{Eyedrops::VERSION} with Pupil-#{Pupil::VERSION}"
|
89
|
+
exit
|
90
|
+
end
|
91
|
+
opts.parse!(ARGV)
|
49
92
|
end
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
93
|
+
|
94
|
+
puts "Eyedrops, the interactive Pupil | Version: Eyedrops-#{Eyedrops::VERSION} with Pupil-#{Pupil::VERSION}"
|
95
|
+
|
96
|
+
# Account selecting
|
97
|
+
if ProgramConfig[:user]
|
98
|
+
account = ProgramConfig[:user]
|
99
|
+
else
|
100
|
+
num = 1
|
101
|
+
cred.credentials.keys.each do |name|
|
102
|
+
puts "#{num}. #{name}"
|
103
|
+
num += 1
|
104
|
+
end
|
105
|
+
puts "#{num}. Add Account"
|
106
|
+
sel = Readline.readline("Choose account: ", false).to_i
|
107
|
+
if sel == cred.credentials.keys.size + 1
|
108
|
+
cred.create
|
109
|
+
sel = cred.credentials.keys.size
|
110
|
+
end
|
111
|
+
account = cred.credentials.keys[sel-1]
|
55
112
|
end
|
56
113
|
|
57
114
|
puts "Preparing Pupil instance..."
|
58
|
-
|
59
|
-
puts "Signed with @#{
|
115
|
+
twitter = Pupil.new(cred.credentials[account])
|
116
|
+
puts "Signed with @#{account}"
|
60
117
|
|
61
118
|
while(true)
|
62
119
|
begin
|
@@ -69,26 +126,12 @@ while(true)
|
|
69
126
|
|
70
127
|
case command.to_sym
|
71
128
|
when :help
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
exit|quit - Exit eyedrops.
|
76
|
-
|
77
|
-
### Examples ###
|
78
|
-
eyedrops> puts pupil.profile.id
|
79
|
-
237079012
|
80
|
-
=> nil
|
81
|
-
eyedrops> pupil.timeline :count => 5
|
82
|
-
#<Pupil::Status:0x007fafb34b5720>
|
83
|
-
#<Pupil::Status:0x007fafb34b56f8>
|
84
|
-
#<Pupil::Status:0x007fafb34b56d0>
|
85
|
-
#<Pupil::Status:0x007fafb34b56a8>
|
86
|
-
#<Pupil::Status:0x007fafb34b5680>
|
87
|
-
=> nil
|
88
|
-
EOD
|
129
|
+
display_help
|
130
|
+
when :"show-account"
|
131
|
+
puts "Signed with @#{account}"
|
89
132
|
else
|
90
133
|
result = eval(line)
|
91
|
-
puts "=> #{result.inspect}"
|
134
|
+
puts "=> #{result.inspect}" if ProgramConfig[:inspect]
|
92
135
|
end
|
93
136
|
rescue => exception
|
94
137
|
puts exception
|
data/lib/pupil/version.rb
CHANGED
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:
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-05-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth
|
16
|
-
requirement: &
|
16
|
+
requirement: &70257046427060 !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: *
|
24
|
+
version_requirements: *70257046427060
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &70257046426580 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70257046426580
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70257046426140 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70257046426140
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: yard
|
49
|
-
requirement: &
|
49
|
+
requirement: &70257046425720 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70257046425720
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bundler
|
60
|
-
requirement: &
|
60
|
+
requirement: &70257046425260 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70257046425260
|
69
69
|
description: The "Lazy" Twitter API Library for Ruby 1.9.x. Easy to use.
|
70
70
|
email:
|
71
71
|
- oame@oameya.com
|