youroom_api 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/Manifest.txt +19 -0
- data/README.txt +106 -0
- data/Rakefile +12 -0
- data/lib/object_extention.rb +52 -0
- data/lib/youroom_api/base.rb +17 -0
- data/lib/youroom_api/base_url.rb +6 -0
- data/lib/youroom_api/request/add_participation.rb +24 -0
- data/lib/youroom_api/request/add_room.rb +20 -0
- data/lib/youroom_api/request/add_user.rb +28 -0
- data/lib/youroom_api/request/destroy_entry.rb +16 -0
- data/lib/youroom_api/request/destroy_participation.rb +24 -0
- data/lib/youroom_api/request/entry.rb +4 -0
- data/lib/youroom_api/request/get_entry.rb +21 -0
- data/lib/youroom_api/request/get_room_list.rb +15 -0
- data/lib/youroom_api/request/get_user_list.rb +15 -0
- data/lib/youroom_api/request/my_group.rb +7 -0
- data/lib/youroom_api/request/participation.rb +15 -0
- data/lib/youroom_api/request/post_entry.rb +23 -0
- data/lib/youroom_api/request/room_timeline.rb +23 -0
- data/lib/youroom_api/request/show_attachment.rb +15 -0
- data/lib/youroom_api/request/timeline.rb +8 -0
- data/lib/youroom_api/request/unread_timeline.rb +12 -0
- data/lib/youroom_api/request/verify_credentials.rb +7 -0
- data/lib/youroom_api/request.rb +85 -0
- data/lib/youroom_api/version.rb +3 -0
- data/lib/youroom_api/youroom.rb +32 -0
- data/lib/youroom_api.rb +44 -0
- data/spec/setup_test_model.rb +34 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +130 -0
- data/spec/youroom_api/add_participation_spec.rb +89 -0
- data/spec/youroom_api/add_room_spec.rb +67 -0
- data/spec/youroom_api/add_user_spec.rb +75 -0
- data/spec/youroom_api/destroy_entry_spec.rb +68 -0
- data/spec/youroom_api/destroy_participation_spec.rb +89 -0
- data/spec/youroom_api/entry_spec.rb +5 -0
- data/spec/youroom_api/get_entry_spec.rb +82 -0
- data/spec/youroom_api/get_room_list_spec.rb +55 -0
- data/spec/youroom_api/get_user_list_spec.rb +55 -0
- data/spec/youroom_api/my_group_spec.rb +44 -0
- data/spec/youroom_api/object_extention_spec.rb +65 -0
- data/spec/youroom_api/participation_spec.rb +56 -0
- data/spec/youroom_api/post_entry_spec.rb +75 -0
- data/spec/youroom_api/request_spec.rb +145 -0
- data/spec/youroom_api/room_timeline_spec.rb +127 -0
- data/spec/youroom_api/show_attachment_spec.rb +30 -0
- data/spec/youroom_api/timeline_spec.rb +47 -0
- data/spec/youroom_api/unread_timeline_spec.rb +42 -0
- data/spec/youroom_api/verify_credentials_spec.rb +30 -0
- data/spec/youroom_api/youroom_spec.rb +92 -0
- metadata +125 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.expand_path("../spec_helper", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe Youroom::HomeTimeline do
|
4
|
+
describe "#path" do
|
5
|
+
describe "when url is original" do
|
6
|
+
before do
|
7
|
+
@client = Youroom::HomeTimeline.new(access_token)
|
8
|
+
end
|
9
|
+
|
10
|
+
subject { @client.path }
|
11
|
+
|
12
|
+
it { should == File.join(@client.url, '?format=json') }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "when url is not original" do
|
16
|
+
before do
|
17
|
+
@client = Youroom::HomeTimeline.new(access_token, WW_URL)
|
18
|
+
end
|
19
|
+
|
20
|
+
subject { @client.path }
|
21
|
+
it { should == File.join(@client.url, '?format=json')}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#call" do
|
26
|
+
before do
|
27
|
+
@client = Youroom::HomeTimeline.new(access_token, WW_URL)
|
28
|
+
# dammy ww url
|
29
|
+
@client.should_receive(:path).at_least(1).and_return("http://localhost:8083/all?format=json")
|
30
|
+
|
31
|
+
# NOTICE: WW not check params
|
32
|
+
WW::Server.mock(:youroom, { :format => "json"} ).get("/all") do
|
33
|
+
{ :entry => "hogehoge" }.to_json
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
after do
|
38
|
+
WW::Server.verify(:youroom)
|
39
|
+
end
|
40
|
+
|
41
|
+
subject { @client.get }
|
42
|
+
it "should call request url" do
|
43
|
+
should be_a_instance_of(Hash)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path("../spec_helper", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe Youroom::UnreadTimeline do
|
4
|
+
describe "#path" do
|
5
|
+
describe "when url is original" do
|
6
|
+
before do
|
7
|
+
@client = Youroom::UnreadTimeline.new(access_token)
|
8
|
+
end
|
9
|
+
|
10
|
+
subject { @client.path }
|
11
|
+
it { should == File.join(Youroom::BASE_URL, '?format=json&read_state=unread')}
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "when url is not original" do
|
15
|
+
before do
|
16
|
+
@client = Youroom::UnreadTimeline.new(access_token, WW_URL)
|
17
|
+
end
|
18
|
+
|
19
|
+
subject { @client.path }
|
20
|
+
it { should == File.join(WW_URL, 'home', '?format=json&read_state=unread') }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#call" do
|
25
|
+
before do
|
26
|
+
@client = Youroom::UnreadTimeline.new(access_token, WW_URL)
|
27
|
+
WW::Server.mock(:youroom, { :format => "json", :read_state => "unread" }).get("/youroom/home/") do
|
28
|
+
{ :entry => "hogehoge" }.to_json
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
after do
|
33
|
+
WW::Server.verify(:youroom)
|
34
|
+
end
|
35
|
+
|
36
|
+
subject { @client.get }
|
37
|
+
it "should call request url" do
|
38
|
+
should be_a_instance_of(Hash)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path("../spec_helper", File.dirname(__FILE__))
|
4
|
+
|
5
|
+
describe Youroom::VerifyCredentials do
|
6
|
+
describe "#path" do
|
7
|
+
context "本家のURLを利用する場合" do
|
8
|
+
before do
|
9
|
+
@client = Youroom::VerifyCredentials.new(access_token)
|
10
|
+
end
|
11
|
+
|
12
|
+
subject { @client.path }
|
13
|
+
|
14
|
+
it "正しいURLが設定されていること" do
|
15
|
+
should == File.join(@client.url, 'verify_credentials', '?format=json')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "本家を利用しない場合" do
|
20
|
+
before do
|
21
|
+
@client = Youroom::VerifyCredentials.new(access_token, WW_URL)
|
22
|
+
end
|
23
|
+
|
24
|
+
subject { @client.path }
|
25
|
+
it "正しいURLが設定されていること" do
|
26
|
+
should == File.join(@client.url, 'verify_credentials', '?format=json')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require File.expand_path("../spec_helper", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe Youroom::OAuth do
|
4
|
+
describe "#initialize" do
|
5
|
+
describe "when can create instance" do
|
6
|
+
subject { Youroom::OAuth.new(access_token) }
|
7
|
+
|
8
|
+
it { should be_a(Youroom::OAuth) }
|
9
|
+
its(:request) { should be_a(Youroom::Request) }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "when can not create instance" do
|
13
|
+
it "should raise ArgumentError" do
|
14
|
+
lambda { Youroom::OAuth.new("hoge") }.should raise_exception(ArgumentError)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#ww" do
|
20
|
+
it "should be server is start" do
|
21
|
+
expect {
|
22
|
+
TCPSocket.open('localhost', '8083').close
|
23
|
+
}.should_not == raise_exception(Errno::ECONNREFUSED)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#entry" do
|
28
|
+
before do
|
29
|
+
@client = Youroom::OAuth.new(access_token, WW_URL)
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "when args size == 1" do
|
33
|
+
it "should receive Entry.get_entry" do
|
34
|
+
@client.request.should_receive(:get_entry)
|
35
|
+
@client.entry("room_id")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "when args size == 2" do
|
40
|
+
it "should receive Entry.get_entry" do
|
41
|
+
@client.request.should_receive(:get_entry)
|
42
|
+
@client.entry("room_id", "mutter_id")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "#participation" do
|
48
|
+
before do
|
49
|
+
@client = Youroom::OAuth.new(access_token, WW_URL)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should receive Participation.get_participation" do
|
53
|
+
@client.request.should_receive(:get_participation)
|
54
|
+
@client.participation("room_id", "participation_id")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "#all_timeline" do
|
59
|
+
before do
|
60
|
+
@client = Youroom::OAuth.new(access_token, WW_URL)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should receive Participation.get_participation" do
|
64
|
+
@client.request.should_receive(:get_all_timeline)
|
65
|
+
@client.all_timeline
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "#unread_timeline" do
|
70
|
+
before do
|
71
|
+
@client = Youroom::OAuth.new(access_token, WW_URL)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should receive Participation.get_participation" do
|
75
|
+
@client.request.should_receive(:get_unread_timeline)
|
76
|
+
@client.unread_timeline
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "#update(room_id, mutter_content)" do
|
81
|
+
before do
|
82
|
+
@client = Youroom::OAuth.new(access_token, WW_URL)
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should receive CreateEntry.new" do
|
86
|
+
@client.request.should_receive(:post_entry)
|
87
|
+
@client.update("room_id", "hogehoge")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: youroom_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 10
|
9
|
+
version: 0.0.10
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- pochi
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-05-19 00:00:00 +09:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Wrapper for youroom api
|
22
|
+
email: pochi.black@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files: []
|
28
|
+
|
29
|
+
files:
|
30
|
+
- History.txt
|
31
|
+
- README.txt
|
32
|
+
- Manifest.txt
|
33
|
+
- Rakefile
|
34
|
+
- lib/object_extention.rb
|
35
|
+
- lib/youroom_api.rb
|
36
|
+
- lib/youroom_api/base.rb
|
37
|
+
- lib/youroom_api/base_url.rb
|
38
|
+
- lib/youroom_api/request/entry.rb
|
39
|
+
- lib/youroom_api/request/participation.rb
|
40
|
+
- lib/youroom_api/request.rb
|
41
|
+
- lib/youroom_api/version.rb
|
42
|
+
- lib/youroom_api/youroom.rb
|
43
|
+
- spec/setup_test_model.rb
|
44
|
+
- spec/spec.opts
|
45
|
+
- spec/spec_helper.rb
|
46
|
+
- spec/youroom_api/entry_spec.rb
|
47
|
+
- spec/youroom_api/object_extention_spec.rb
|
48
|
+
- spec/youroom_api/participation_spec.rb
|
49
|
+
- spec/youroom_api/request_spec.rb
|
50
|
+
- spec/youroom_api/youroom_spec.rb
|
51
|
+
- spec/youroom_api/timeline_spec.rb
|
52
|
+
- lib/youroom_api/request/timeline.rb
|
53
|
+
- spec/youroom_api/verify_credentials_spec.rb
|
54
|
+
- lib/youroom_api/request/verify_credentials.rb
|
55
|
+
- spec/youroom_api/show_attachment_spec.rb
|
56
|
+
- lib/youroom_api/request/show_attachment.rb
|
57
|
+
- spec/youroom_api/room_timeline_spec.rb
|
58
|
+
- lib/youroom_api/request/room_timeline.rb
|
59
|
+
- spec/youroom_api/unread_timeline_spec.rb
|
60
|
+
- lib/youroom_api/request/unread_timeline.rb
|
61
|
+
- spec/youroom_api/post_entry_spec.rb
|
62
|
+
- lib/youroom_api/request/post_entry.rb
|
63
|
+
- lib/youroom_api/request/my_group.rb
|
64
|
+
- spec/youroom_api/my_group_spec.rb
|
65
|
+
- spec/youroom_api/get_entry_spec.rb
|
66
|
+
- lib/youroom_api/request/get_entry.rb
|
67
|
+
- lib/youroom_api/request/destroy_entry.rb
|
68
|
+
- spec/youroom_api/destroy_entry_spec.rb
|
69
|
+
- lib/youroom_api/request/add_room.rb
|
70
|
+
- spec/youroom_api/add_room_spec.rb
|
71
|
+
- lib/youroom_api/request/add_user.rb
|
72
|
+
- spec/youroom_api/add_user_spec.rb
|
73
|
+
- lib/youroom_api/request/get_room_list.rb
|
74
|
+
- spec/youroom_api/get_room_list_spec.rb
|
75
|
+
- lib/youroom_api/request/get_user_list.rb
|
76
|
+
- spec/youroom_api/get_user_list_spec.rb
|
77
|
+
- lib/youroom_api/request/add_participation.rb
|
78
|
+
- spec/youroom_api/add_participation_spec.rb
|
79
|
+
- lib/youroom_api/request/destroy_participation.rb
|
80
|
+
- spec/youroom_api/destroy_participation_spec.rb
|
81
|
+
has_rdoc: true
|
82
|
+
homepage: https://home.youroom.in/
|
83
|
+
licenses: []
|
84
|
+
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options:
|
87
|
+
- --title
|
88
|
+
- ww documentation
|
89
|
+
- --charset
|
90
|
+
- utf-8
|
91
|
+
- --opname
|
92
|
+
- index.html
|
93
|
+
- --line-numbers
|
94
|
+
- --main
|
95
|
+
- README.rdoc
|
96
|
+
- --inline-source
|
97
|
+
- --exclude
|
98
|
+
- ^(examples|extras)/
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
version: "0"
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
version: "0"
|
117
|
+
requirements: []
|
118
|
+
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 1.3.7
|
121
|
+
signing_key:
|
122
|
+
specification_version: 3
|
123
|
+
summary: Double Web, framework to build double Web server.
|
124
|
+
test_files: []
|
125
|
+
|