coop 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +8 -2
- data/Guardfile +1 -1
- data/README.md +14 -0
- data/lib/coop/api_object/user.rb +1 -1
- data/lib/coop/session.rb +15 -3
- data/lib/coop/version.rb +1 -1
- data/test/coop/api_object/test_group.rb +1 -1
- data/test/coop/api_object/test_status.rb +2 -2
- data/test/coop/test_session.rb +12 -2
- data/test/fixtures/groups.json +1 -0
- metadata +61 -20
data/CHANGELOG.md
CHANGED
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -51,6 +51,20 @@ Also, you can mess with the group's agendas API. Try this:
|
|
51
51
|
|
52
52
|
It returns a Coop::Agenda object, with `.global`, `.users`, `.user`, which will give you the group's agenda, all the user's individual agendas, and the authenticated user's agenda, respectively.
|
53
53
|
|
54
|
+
### Users
|
55
|
+
|
56
|
+
You can get info about a specific user or a group's users. It's pretty simple.
|
57
|
+
|
58
|
+
For a group's users, just try this:
|
59
|
+
|
60
|
+
group.users.all
|
61
|
+
|
62
|
+
That'll get you the info dump of all the users. For a _specific_ user, you need their id. Then, you call:
|
63
|
+
|
64
|
+
group.users.find(12345)
|
65
|
+
|
66
|
+
Where "12345" would be that user's id. That'll get you just info for that user.
|
67
|
+
|
54
68
|
### The rest of the API
|
55
69
|
|
56
70
|
In further versions of the gem, I'll be implementing the rest of the API. I want to keep it focused, for now. Also, the current Co-op API isn't working completely, so that's another roadblock that should be cleared up soon. I hope.
|
data/lib/coop/api_object/user.rb
CHANGED
data/lib/coop/session.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Coop
|
2
2
|
class Session
|
3
3
|
attr_accessor :email
|
4
|
-
|
4
|
+
|
5
5
|
# Public: Creates a new API session
|
6
6
|
#
|
7
7
|
# email - (String) the user's email
|
@@ -17,7 +17,7 @@ module Coop
|
|
17
17
|
@email = email
|
18
18
|
password = password
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
# Public: Creates a Coop::Group object
|
22
22
|
#
|
23
23
|
# id - (Fixnum) the group id (as found in the app URL: http://coopapp.com/groups/[group_id])
|
@@ -33,7 +33,7 @@ module Coop
|
|
33
33
|
id: id
|
34
34
|
})
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
# Public: Creates a Coop::Group object
|
38
38
|
#
|
39
39
|
# id - (Fixnum) the group id (as found in the app URL: http://coopapp.com/groups/[group_id]/users/[user_id])
|
@@ -47,5 +47,17 @@ module Coop
|
|
47
47
|
def user(id)
|
48
48
|
Coop::User.find(id)
|
49
49
|
end
|
50
|
+
|
51
|
+
# Public: List of all the groups a user belongs to
|
52
|
+
#
|
53
|
+
# Examples
|
54
|
+
#
|
55
|
+
# session.groups
|
56
|
+
# # => [#<Coop::APIObject>, #<Coop::APIObject>, ...]
|
57
|
+
#
|
58
|
+
# Returns Array of APIObjects with group data
|
59
|
+
def groups
|
60
|
+
Coop.get_parsed("/groups")
|
61
|
+
end
|
50
62
|
end
|
51
63
|
end
|
data/lib/coop/version.rb
CHANGED
@@ -34,7 +34,7 @@ class TestGroup < MiniTest::Unit::TestCase
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_post_as_cobot
|
37
|
-
|
37
|
+
stub_request(:post, "http://coopapp.com/groups/12345/statuses").with({
|
38
38
|
headers: { 'Accept' => 'application/xml' },
|
39
39
|
query: { key: "BeepBoopAPIKeyGoesHere", status: "Testing update as Cobot" }
|
40
40
|
}).to_return({
|
@@ -16,7 +16,7 @@ class TestStatus < MiniTest::Unit::TestCase
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_post
|
19
|
-
stub_post("/groups
|
19
|
+
stub_post("/groups/12345/statuses").with({
|
20
20
|
headers: { 'Accept' => 'application/xml' },
|
21
21
|
query: { status: "Testing update" }
|
22
22
|
}).to_return({
|
@@ -27,7 +27,7 @@ class TestStatus < MiniTest::Unit::TestCase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_post_as_cobot
|
30
|
-
|
30
|
+
stub_request(:post, "http://coopapp.com/groups/12345/statuses").with({
|
31
31
|
headers: { 'Accept' => 'application/xml' },
|
32
32
|
query: { key: "BeepBoopAPIKeyGoesHere", status: "Testing update as Cobot" }
|
33
33
|
}).to_return({
|
data/test/coop/test_session.rb
CHANGED
@@ -4,13 +4,23 @@ class TestSession < MiniTest::Unit::TestCase
|
|
4
4
|
def setup
|
5
5
|
@coop = Coop.new("test@example.com", "password")
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def test_new_is_session
|
9
9
|
assert_instance_of Coop::Session, @coop
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def test_group
|
13
13
|
@group = @coop.group(12345)
|
14
14
|
assert_instance_of Coop::Group, @group
|
15
15
|
end
|
16
|
+
|
17
|
+
def test_groups
|
18
|
+
stub_get("/groups").with({
|
19
|
+
headers: { 'Accept' => 'application/json' }
|
20
|
+
}).to_return({
|
21
|
+
body: fixture('groups.json')
|
22
|
+
})
|
23
|
+
|
24
|
+
assert_instance_of Array, @coop.groups
|
25
|
+
end
|
16
26
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"created_at":"2012-03-23T13:15:49Z","feed_key":"1234567890","id":12345,"memberships_count":1,"name":"Team Evan","timezone":"Eastern Time (US & Canada)","updated_at":"2012-03-23T13:15:49Z"}]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
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: 2012-
|
12
|
+
date: 2012-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: minitest
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: 2.11.3
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.11.3
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: guard-minitest
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: 0.5.0
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.5.0
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: turn
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: 0.9.3
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.9.3
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: webmock
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ~>
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: 1.8.2
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.8.2
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: growl
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ~>
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: 1.0.3
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.0.3
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: hashie
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ~>
|
@@ -87,10 +117,15 @@ dependencies:
|
|
87
117
|
version: 1.2.0
|
88
118
|
type: :runtime
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.2.0
|
91
126
|
- !ruby/object:Gem::Dependency
|
92
127
|
name: httparty
|
93
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
94
129
|
none: false
|
95
130
|
requirements:
|
96
131
|
- - ~>
|
@@ -98,7 +133,12 @@ dependencies:
|
|
98
133
|
version: 0.8.1
|
99
134
|
type: :runtime
|
100
135
|
prerelease: false
|
101
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 0.8.1
|
102
142
|
description: Interact with the Co-op API with Ruby
|
103
143
|
email:
|
104
144
|
- evan@nothingconcept.com
|
@@ -130,6 +170,7 @@ files:
|
|
130
170
|
- test/coop/test_api_object.rb
|
131
171
|
- test/coop/test_session.rb
|
132
172
|
- test/fixtures/agenda.json
|
173
|
+
- test/fixtures/groups.json
|
133
174
|
- test/fixtures/my_agenda.json
|
134
175
|
- test/fixtures/show_status.json
|
135
176
|
- test/fixtures/statuses.json
|
@@ -161,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
202
|
version: '0'
|
162
203
|
requirements: []
|
163
204
|
rubyforge_project:
|
164
|
-
rubygems_version: 1.8.
|
205
|
+
rubygems_version: 1.8.19
|
165
206
|
signing_key:
|
166
207
|
specification_version: 3
|
167
208
|
summary: Interact with the Co-op API with Ruby
|
@@ -173,6 +214,7 @@ test_files:
|
|
173
214
|
- test/coop/test_api_object.rb
|
174
215
|
- test/coop/test_session.rb
|
175
216
|
- test/fixtures/agenda.json
|
217
|
+
- test/fixtures/groups.json
|
176
218
|
- test/fixtures/my_agenda.json
|
177
219
|
- test/fixtures/show_status.json
|
178
220
|
- test/fixtures/statuses.json
|
@@ -184,4 +226,3 @@ test_files:
|
|
184
226
|
- test/fixtures/users.json
|
185
227
|
- test/test_coop.rb
|
186
228
|
- test/test_helper.rb
|
187
|
-
has_rdoc:
|