croudia 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/README.md +31 -14
- data/Rakefile +11 -11
- data/croudia.gemspec +10 -8
- data/lib/croudia/api/favorites.rb +43 -0
- data/lib/croudia/api/oauth.rb +32 -0
- data/lib/croudia/api/statuses.rb +55 -0
- data/lib/croudia/api/timelines.rb +57 -0
- data/lib/croudia/base.rb +44 -0
- data/lib/croudia/client.rb +64 -0
- data/lib/croudia/configurable.rb +39 -0
- data/lib/croudia/creatable.rb +9 -0
- data/lib/croudia/default.rb +63 -0
- data/lib/croudia/ext/openssl.rb +19 -0
- data/lib/croudia/identity.rb +22 -39
- data/lib/croudia/status.rb +26 -0
- data/lib/croudia/user.rb +12 -43
- data/lib/croudia/version.rb +1 -1
- data/lib/croudia.rb +21 -12
- data/spec/croudia/api/favorites_spec.rb +35 -0
- data/spec/croudia/api/oauth_spec.rb +53 -0
- data/spec/croudia/api/statuses_spec.rb +73 -0
- data/spec/croudia/api/timelines_spec.rb +93 -0
- data/spec/croudia/base_spec.rb +27 -0
- data/spec/croudia/client_spec.rb +115 -0
- data/spec/croudia/identity_spec.rb +29 -65
- data/spec/croudia/status_spec.rb +30 -0
- data/spec/croudia/user_spec.rb +30 -43
- data/spec/croudia_spec.rb +48 -49
- data/spec/fixtures/access_token.json +6 -0
- data/spec/fixtures/status.json +1 -0
- data/spec/fixtures/timeline.json +1 -0
- data/spec/helper.rb +49 -32
- metadata +80 -84
- data/lib/croudia/api.rb +0 -5
- data/lib/croudia/error.rb +0 -5
- data/lib/croudia/scraper/friendships.rb +0 -72
- data/lib/croudia/scraper/login.rb +0 -42
- data/lib/croudia/scraper/parser/users.rb +0 -59
- data/lib/croudia/scraper/parser/voices.rb +0 -32
- data/lib/croudia/scraper/parser.rb +0 -13
- data/lib/croudia/scraper/users.rb +0 -20
- data/lib/croudia/scraper/voices.rb +0 -59
- data/lib/croudia/scraper.rb +0 -63
- data/lib/croudia/voice.rb +0 -21
- data/spec/croudia/api_spec.rb +0 -7
- data/spec/croudia/error_spec.rb +0 -13
- data/spec/croudia/scraper/friendships_spec.rb +0 -115
- data/spec/croudia/scraper/login_spec.rb +0 -137
- data/spec/croudia/scraper/parser/users_spec.rb +0 -292
- data/spec/croudia/scraper/parser/voices_spec.rb +0 -119
- data/spec/croudia/scraper/users_spec.rb +0 -78
- data/spec/croudia/scraper/voices_spec.rb +0 -178
- data/spec/croudia/scraper_spec.rb +0 -120
- data/spec/croudia/version_spec.rb +0 -7
- data/spec/croudia/voice_spec.rb +0 -16
- data/spec/fixtures/follow_request.html +0 -69
- data/spec/fixtures/follower_wktk.html +0 -89
- data/spec/fixtures/following_wktk.html +0 -89
- data/spec/fixtures/user_wktk1.html +0 -72
- data/spec/fixtures/user_wktk2.html +0 -75
- data/spec/fixtures/user_wktk3.html +0 -83
- data/spec/fixtures/voices_reply_list.html +0 -55
- data/spec/fixtures/voices_timeline.html +0 -60
- data/spec/fixtures/voices_written.html +0 -20
data/spec/croudia/user_spec.rb
CHANGED
@@ -1,43 +1,30 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
describe Croudia::User do
|
4
|
-
describe '
|
5
|
-
it 'returns
|
6
|
-
Croudia::User.new(:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
it '
|
12
|
-
Croudia::User.new(:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '
|
25
|
-
it 'returns
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
it 'returns false if usernames are different' do
|
32
|
-
user1 = Croudia::User.new(:username => 'wktk', :name => 'wktk')
|
33
|
-
user2 = Croudia::User.new(:username => 'croudia', :name => 'wktk')
|
34
|
-
(user1 == user2).should be_false
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'returns false if classes are different' do
|
38
|
-
user1 = Croudia::User.new(:username => 'wktk', :name => 'wktk')
|
39
|
-
user2 = { :username => 'wktk', :name => 'wktk' }
|
40
|
-
(user1 == user2).should be_false
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Croudia::User do
|
4
|
+
describe '#==' do
|
5
|
+
it 'returns true when objects IDs are the same' do
|
6
|
+
user = Croudia::User.new(id: 1, name: 'hoge')
|
7
|
+
other = Croudia::User.new(id: 1, name: 'fuga')
|
8
|
+
expect(user == other).to be_true
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'returns false when objects IDs are different' do
|
12
|
+
user = Croudia::User.new(id: 1)
|
13
|
+
other = Croudia::User.new(id: 2)
|
14
|
+
expect(user == other).to be_false
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'returns false when classes are different' do
|
18
|
+
user = Croudia::User.new(id: 1)
|
19
|
+
other = Croudia::Identity.new(id: 1)
|
20
|
+
expect(user == other).to be_false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#created_at' do
|
25
|
+
it 'returns a Time' do
|
26
|
+
user = Croudia::User.new(id: 3, created_at: 'Mon, 08 2013 01:23:45 +0900')
|
27
|
+
expect(user.created_at).to be_a Time
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/spec/croudia_spec.rb
CHANGED
@@ -1,49 +1,48 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
describe Croudia do
|
4
|
-
context 'when delegating to Croudia::
|
5
|
-
before do
|
6
|
-
stub_get('/
|
7
|
-
:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Croudia do
|
4
|
+
context 'when delegating to Croudia::Client' do
|
5
|
+
before do
|
6
|
+
stub_get('/statuses/public_timeline.json').to_return(
|
7
|
+
body: fixture('timeline'),
|
8
|
+
headers: { content_type: 'application/json; charset_utf-8' }
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'requests the correct resource' do
|
13
|
+
Croudia.public_timeline
|
14
|
+
expect(a_get('/statuses/public_timeline.json')).to have_been_made
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'returns the same result to Croudia::Client' do
|
18
|
+
expect(Croudia.public_timeline).to eq Croudia::Client.new.public_timeline
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '.client' do
|
23
|
+
it 'returns a Croudia::Client' do
|
24
|
+
expect(Croudia.client).to be_a Croudia::Client
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '.respond_to?' do
|
29
|
+
it 'delegates to Croudia::Client' do
|
30
|
+
expect(Croudia.respond_to?(:public_timeline)).to be_true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '.configure' do
|
35
|
+
after do
|
36
|
+
Croudia.reset!
|
37
|
+
end
|
38
|
+
|
39
|
+
Croudia::Configurable.keys.each do |key|
|
40
|
+
it "sets the #{key}" do
|
41
|
+
Croudia.configure do |config|
|
42
|
+
config.send("#{key}=", key)
|
43
|
+
end
|
44
|
+
expect(Croudia.instance_variable_get(:"@#{key}")).to eq key
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"id":1228014,"id_str":"1228014","text":"さっき誤字してた……","created_at":"Tue, 25 Jun 2013 23:58:43 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}}
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"id":1228014,"id_str":"1228014","text":"さっき誤字してた……","created_at":"Tue, 25 Jun 2013 23:58:43 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":1228009,"id_str":"1228009","text":":;(∩´﹏`∩);:","created_at":"Tue, 25 Jun 2013 23:58:15 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":1228005,"id_str":"1228005","text":"ウッバス酔いが","created_at":"Tue, 25 Jun 2013 23:57:39 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":1228003,"id_str":"1228003","text":"PublicTimeline が search の分類なのはちょっと感覚に合わないな……:;(∩´﹏`∩);:","created_at":"Tue, 25 Jun 2013 23:57:18 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":1227986,"id_str":"1227986","text":"PublicTimeline 開くのに手間取った、あまりフォローしてないの便利なのに推さない方向なのかな","created_at":"Tue, 25 Jun 2013 23:54:44 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":1227954,"id_str":"1227954","text":"夜行バスで東京に戻ってる、こっちには結局 80 日ちょっとの滞在だった","created_at":"Tue, 25 Jun 2013 23:51:21 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":1227949,"id_str":"1227949","text":"アプリ認証じゃなくてアプリ認可では (ボソッ","created_at":"Tue, 25 Jun 2013 23:50:27 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":1064197,"id_str":"1064197","text":"@utagawakiki ごめんなさい、あれは API じゃなくて HTML を解析してやってるんです:;(∩´﹏`∩);: 放置してるので動かなくなってると思います","created_at":"Sun, 14 Apr 2013 12:42:30 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":602151,"id_str":"602151","text":"PublicTimeline こわい","created_at":"Tue, 25 Dec 2012 03:08:55 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":597996,"id_str":"597996","text":"Ruby から Croudia できるやつ作ってる","created_at":"Sun, 23 Dec 2012 22:33:06 +0900","favorited":false,"favorited_count":2,"spread":false,"spread_count":1,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":589475,"id_str":"589475","text":"自分の Croudia の user_id は 7987 っぽい","created_at":"Fri, 21 Dec 2012 12:00:09 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":587093,"id_str":"587093","text":"久々に Croudia 見に来た","created_at":"Thu, 20 Dec 2012 10:03:36 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":490289,"id_str":"490289","text":"スマホからは初めて Croudia 開いたけど、PC と比べてこっちの方が見やすい","created_at":"Wed, 07 Nov 2012 20:11:27 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":469356,"id_str":"469356","text":"ねむい","created_at":"Fri, 26 Oct 2012 06:27:54 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":464990,"id_str":"464990","text":"そういえばログイン画面にある画像もネコである","created_at":"Tue, 23 Oct 2012 20:54:13 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":464976,"id_str":"464976","text":"Croudia の Cr ネコ、Twitter でいう Twitter bird みたいな立場なのかな","created_at":"Tue, 23 Oct 2012 20:51:15 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":464427,"id_str":"464427","text":"とりあえず Basic 認証でいいので API 欲しい #要望リスト","created_at":"Tue, 23 Oct 2012 17:06:32 +0900","favorited":false,"favorited_count":1,"spread":false,"spread_count":1,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":453717,"id_str":"453717","text":"ツイ禁始めたので Croudia に遊びにきた","created_at":"Thu, 18 Oct 2012 19:19:27 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":446854,"id_str":"446854","text":"Twitter で fav 規制されたので久々に Croudia 見にきた","created_at":"Sun, 14 Oct 2012 12:50:19 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}},{"id":352215,"id_str":"352215","text":"昨日雨降ってたの気づかなかった","created_at":"Sun, 02 Sep 2012 11:07:18 +0900","favorited":false,"favorited_count":0,"spread":false,"spread_count":0,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"source":"underdevelopment","user":{"id":7987,"id_str":"7987","name":"wktk","screen_name":"wktk","profile_image_url_https":"https://croudia.com/testimages/download/9423","created_at":"Sun, 29 Jul 2012 19:21:21 +0900","description":"気軽に fav ります。Twitter でも @wktk です。 \r\nhttps://twitter.com/wktk\r\nhttps://github.com/wktk","favorites_count":68,"follow_request_sent":"underdevelopment","followers_count":12,"following":"underdevelopment","friends_count":11,"location":"Japan","statuses_count":26,"protected":false,"url":"http://wktk.jp/"}}]
|
data/spec/helper.rb
CHANGED
@@ -1,32 +1,49 @@
|
|
1
|
-
require 'croudia'
|
2
|
-
require 'rspec'
|
3
|
-
require 'webmock/rspec'
|
4
|
-
|
5
|
-
def a_get(path)
|
6
|
-
a_request(:get, Croudia
|
7
|
-
end
|
8
|
-
|
9
|
-
def a_post(path)
|
10
|
-
a_request(:post, Croudia
|
11
|
-
end
|
12
|
-
|
13
|
-
def
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
def
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
def
|
22
|
-
stub_request(:
|
23
|
-
end
|
24
|
-
|
25
|
-
def
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def
|
30
|
-
|
31
|
-
|
32
|
-
|
1
|
+
require 'croudia'
|
2
|
+
require 'rspec'
|
3
|
+
require 'webmock/rspec'
|
4
|
+
|
5
|
+
def a_get(path)
|
6
|
+
a_request(:get, Croudia::Default::ENDPOINT + path)
|
7
|
+
end
|
8
|
+
|
9
|
+
def a_post(path)
|
10
|
+
a_request(:post, Croudia::Default::ENDPOINT + path)
|
11
|
+
end
|
12
|
+
|
13
|
+
def a_put(path)
|
14
|
+
a_request(:put, Croudia::Default::ENDPOINT + path)
|
15
|
+
end
|
16
|
+
|
17
|
+
def a_delete(path)
|
18
|
+
a_request(:delete, Croudia::Default::ENDPOINT + path)
|
19
|
+
end
|
20
|
+
|
21
|
+
def stub_any(path)
|
22
|
+
stub_request(:any, Croudia::Default::ENDPOINT + path)
|
23
|
+
end
|
24
|
+
|
25
|
+
def stub_get(path)
|
26
|
+
stub_request(:get, Croudia::Default::ENDPOINT + path)
|
27
|
+
end
|
28
|
+
|
29
|
+
def stub_post(path)
|
30
|
+
stub_request(:post, Croudia::Default::ENDPOINT + path)
|
31
|
+
end
|
32
|
+
|
33
|
+
def stub_put(path)
|
34
|
+
stub_request(:put, Croudia::Default::ENDPOINT + path)
|
35
|
+
end
|
36
|
+
|
37
|
+
def stub_delete(path)
|
38
|
+
stub_request(:delete, Croudia::Default::ENDPOINT + path)
|
39
|
+
end
|
40
|
+
|
41
|
+
def fixture_path
|
42
|
+
File.expand_path('../fixtures', __FILE__)
|
43
|
+
end
|
44
|
+
|
45
|
+
def fixture(file)
|
46
|
+
file = file.to_s
|
47
|
+
file += '.json' unless file.include? '.'
|
48
|
+
File.new(fixture_path + '/' + file)
|
49
|
+
end
|
metadata
CHANGED
@@ -1,99 +1,116 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: croudia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- wktk
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-07-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: faraday
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 0.8.7
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
26
|
+
version: 0.8.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday_middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.9.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.0.5
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.0.5
|
30
55
|
- !ruby/object:Gem::Dependency
|
31
56
|
name: rake
|
32
57
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
58
|
requirements:
|
35
59
|
- - ~>
|
36
60
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
61
|
+
version: 10.1.0
|
38
62
|
type: :development
|
39
63
|
prerelease: false
|
40
64
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
65
|
requirements:
|
43
66
|
- - ~>
|
44
67
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
68
|
+
version: 10.1.0
|
46
69
|
- !ruby/object:Gem::Dependency
|
47
70
|
name: rdoc
|
48
71
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
72
|
requirements:
|
51
73
|
- - ~>
|
52
74
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
75
|
+
version: 4.0.1
|
54
76
|
type: :development
|
55
77
|
prerelease: false
|
56
78
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
79
|
requirements:
|
59
80
|
- - ~>
|
60
81
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
82
|
+
version: 4.0.1
|
62
83
|
- !ruby/object:Gem::Dependency
|
63
84
|
name: rspec
|
64
85
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
86
|
requirements:
|
67
87
|
- - ~>
|
68
88
|
- !ruby/object:Gem::Version
|
69
|
-
version: 2.
|
89
|
+
version: 2.14.0
|
70
90
|
type: :development
|
71
91
|
prerelease: false
|
72
92
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
93
|
requirements:
|
75
94
|
- - ~>
|
76
95
|
- !ruby/object:Gem::Version
|
77
|
-
version: 2.
|
96
|
+
version: 2.14.0
|
78
97
|
- !ruby/object:Gem::Dependency
|
79
98
|
name: webmock
|
80
99
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
100
|
requirements:
|
83
101
|
- - ~>
|
84
102
|
- !ruby/object:Gem::Version
|
85
|
-
version: 1.
|
103
|
+
version: 1.13.0
|
86
104
|
type: :development
|
87
105
|
prerelease: false
|
88
106
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
107
|
requirements:
|
91
108
|
- - ~>
|
92
109
|
- !ruby/object:Gem::Version
|
93
|
-
version: 1.
|
94
|
-
description:
|
110
|
+
version: 1.13.0
|
111
|
+
description: Ruby Wrapper for the Croudia API
|
95
112
|
email:
|
96
|
-
-
|
113
|
+
- mail@wktk.jp
|
97
114
|
executables: []
|
98
115
|
extensions: []
|
99
116
|
extra_rdoc_files: []
|
@@ -105,90 +122,69 @@ files:
|
|
105
122
|
- Rakefile
|
106
123
|
- croudia.gemspec
|
107
124
|
- lib/croudia.rb
|
108
|
-
- lib/croudia/api.rb
|
109
|
-
- lib/croudia/
|
125
|
+
- lib/croudia/api/favorites.rb
|
126
|
+
- lib/croudia/api/oauth.rb
|
127
|
+
- lib/croudia/api/statuses.rb
|
128
|
+
- lib/croudia/api/timelines.rb
|
129
|
+
- lib/croudia/base.rb
|
130
|
+
- lib/croudia/client.rb
|
131
|
+
- lib/croudia/configurable.rb
|
132
|
+
- lib/croudia/creatable.rb
|
133
|
+
- lib/croudia/default.rb
|
134
|
+
- lib/croudia/ext/openssl.rb
|
110
135
|
- lib/croudia/identity.rb
|
111
|
-
- lib/croudia/
|
112
|
-
- lib/croudia/scraper/friendships.rb
|
113
|
-
- lib/croudia/scraper/login.rb
|
114
|
-
- lib/croudia/scraper/parser.rb
|
115
|
-
- lib/croudia/scraper/parser/users.rb
|
116
|
-
- lib/croudia/scraper/parser/voices.rb
|
117
|
-
- lib/croudia/scraper/users.rb
|
118
|
-
- lib/croudia/scraper/voices.rb
|
136
|
+
- lib/croudia/status.rb
|
119
137
|
- lib/croudia/user.rb
|
120
138
|
- lib/croudia/version.rb
|
121
|
-
-
|
122
|
-
- spec/croudia/
|
123
|
-
- spec/croudia/
|
139
|
+
- spec/croudia/api/favorites_spec.rb
|
140
|
+
- spec/croudia/api/oauth_spec.rb
|
141
|
+
- spec/croudia/api/statuses_spec.rb
|
142
|
+
- spec/croudia/api/timelines_spec.rb
|
143
|
+
- spec/croudia/base_spec.rb
|
144
|
+
- spec/croudia/client_spec.rb
|
124
145
|
- spec/croudia/identity_spec.rb
|
125
|
-
- spec/croudia/
|
126
|
-
- spec/croudia/scraper/login_spec.rb
|
127
|
-
- spec/croudia/scraper/parser/users_spec.rb
|
128
|
-
- spec/croudia/scraper/parser/voices_spec.rb
|
129
|
-
- spec/croudia/scraper/users_spec.rb
|
130
|
-
- spec/croudia/scraper/voices_spec.rb
|
131
|
-
- spec/croudia/scraper_spec.rb
|
146
|
+
- spec/croudia/status_spec.rb
|
132
147
|
- spec/croudia/user_spec.rb
|
133
|
-
- spec/croudia/version_spec.rb
|
134
|
-
- spec/croudia/voice_spec.rb
|
135
148
|
- spec/croudia_spec.rb
|
136
|
-
- spec/fixtures/
|
137
|
-
- spec/fixtures/
|
138
|
-
- spec/fixtures/
|
139
|
-
- spec/fixtures/user_wktk1.html
|
140
|
-
- spec/fixtures/user_wktk2.html
|
141
|
-
- spec/fixtures/user_wktk3.html
|
142
|
-
- spec/fixtures/voices_reply_list.html
|
143
|
-
- spec/fixtures/voices_timeline.html
|
144
|
-
- spec/fixtures/voices_written.html
|
149
|
+
- spec/fixtures/access_token.json
|
150
|
+
- spec/fixtures/status.json
|
151
|
+
- spec/fixtures/timeline.json
|
145
152
|
- spec/helper.rb
|
146
153
|
homepage: https://github.com/wktk/croudia-gem
|
147
154
|
licenses: []
|
155
|
+
metadata: {}
|
148
156
|
post_install_message:
|
149
157
|
rdoc_options: []
|
150
158
|
require_paths:
|
151
159
|
- lib
|
152
160
|
required_ruby_version: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
161
|
requirements:
|
155
|
-
- -
|
162
|
+
- - '>='
|
156
163
|
- !ruby/object:Gem::Version
|
157
164
|
version: '0'
|
158
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
|
-
none: false
|
160
166
|
requirements:
|
161
|
-
- -
|
167
|
+
- - '>='
|
162
168
|
- !ruby/object:Gem::Version
|
163
169
|
version: '0'
|
164
170
|
requirements: []
|
165
171
|
rubyforge_project:
|
166
|
-
rubygems_version:
|
172
|
+
rubygems_version: 2.0.3
|
167
173
|
signing_key:
|
168
|
-
specification_version:
|
169
|
-
summary: Croudia
|
174
|
+
specification_version: 4
|
175
|
+
summary: Croudia API
|
170
176
|
test_files:
|
171
|
-
- spec/croudia/
|
172
|
-
- spec/croudia/
|
177
|
+
- spec/croudia/api/favorites_spec.rb
|
178
|
+
- spec/croudia/api/oauth_spec.rb
|
179
|
+
- spec/croudia/api/statuses_spec.rb
|
180
|
+
- spec/croudia/api/timelines_spec.rb
|
181
|
+
- spec/croudia/base_spec.rb
|
182
|
+
- spec/croudia/client_spec.rb
|
173
183
|
- spec/croudia/identity_spec.rb
|
174
|
-
- spec/croudia/
|
175
|
-
- spec/croudia/scraper/login_spec.rb
|
176
|
-
- spec/croudia/scraper/parser/users_spec.rb
|
177
|
-
- spec/croudia/scraper/parser/voices_spec.rb
|
178
|
-
- spec/croudia/scraper/users_spec.rb
|
179
|
-
- spec/croudia/scraper/voices_spec.rb
|
180
|
-
- spec/croudia/scraper_spec.rb
|
184
|
+
- spec/croudia/status_spec.rb
|
181
185
|
- spec/croudia/user_spec.rb
|
182
|
-
- spec/croudia/version_spec.rb
|
183
|
-
- spec/croudia/voice_spec.rb
|
184
186
|
- spec/croudia_spec.rb
|
185
|
-
- spec/fixtures/
|
186
|
-
- spec/fixtures/
|
187
|
-
- spec/fixtures/
|
188
|
-
- spec/fixtures/user_wktk1.html
|
189
|
-
- spec/fixtures/user_wktk2.html
|
190
|
-
- spec/fixtures/user_wktk3.html
|
191
|
-
- spec/fixtures/voices_reply_list.html
|
192
|
-
- spec/fixtures/voices_timeline.html
|
193
|
-
- spec/fixtures/voices_written.html
|
187
|
+
- spec/fixtures/access_token.json
|
188
|
+
- spec/fixtures/status.json
|
189
|
+
- spec/fixtures/timeline.json
|
194
190
|
- spec/helper.rb
|
data/lib/croudia/api.rb
DELETED