totter 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/totter/client/users.rb +25 -0
- data/lib/totter/version.rb +1 -1
- data/test/cassettes/users/get_followers.yml +87 -0
- data/test/cassettes/users/get_following.yml +87 -0
- data/test/cassettes/users/votes.yml +50 -0
- data/test/totter/client/users_test.rb +25 -0
- data/totter.gemspec +2 -2
- metadata +10 -5
data/lib/totter/client/users.rb
CHANGED
@@ -71,6 +71,31 @@ module Totter
|
|
71
71
|
def unfollow(user)
|
72
72
|
boolean_from_response :post, "users/#{user}/unfollow"
|
73
73
|
end
|
74
|
+
|
75
|
+
# @return Array of [Hashie::Mash]
|
76
|
+
# @param user_id [String] ID of the user
|
77
|
+
# @example
|
78
|
+
# client.followers('5')
|
79
|
+
def followers(user_id)
|
80
|
+
get "users/#{user_id}/followers"
|
81
|
+
end
|
82
|
+
|
83
|
+
# @return Array of [Hashie::Mash]
|
84
|
+
# @param user_id [String] ID of the user
|
85
|
+
# @example
|
86
|
+
# client.following('5')
|
87
|
+
def following(user_id)
|
88
|
+
get "users/#{user_id}/following"
|
89
|
+
end
|
90
|
+
|
91
|
+
# @return Array of [Hashie::Mash]
|
92
|
+
# @param user_id [String] ID of the user
|
93
|
+
# @example
|
94
|
+
# client.user_votes('5')
|
95
|
+
def votes(user_id)
|
96
|
+
get "users/#{user_id}/votes"
|
97
|
+
end
|
98
|
+
|
74
99
|
end
|
75
100
|
end
|
76
101
|
end
|
data/lib/totter/version.rb
CHANGED
@@ -0,0 +1,87 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:5000/v1/users/4/followers
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
Authorization:
|
15
|
+
- Bearer 9774e653f7b3c1de5f21b61adc08ba24
|
16
|
+
Content-Type:
|
17
|
+
- application/json
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
X-Ua-Compatible:
|
26
|
+
- IE=Edge
|
27
|
+
Etag:
|
28
|
+
- ! '"984ab6ec1921c5e8e76e486ea2555386"'
|
29
|
+
Cache-Control:
|
30
|
+
- max-age=0, private, must-revalidate
|
31
|
+
X-Request-Id:
|
32
|
+
- 23ba06b42ca2349c4108f45efb82d09f
|
33
|
+
X-Runtime:
|
34
|
+
- '0.467594'
|
35
|
+
Connection:
|
36
|
+
- close
|
37
|
+
Server:
|
38
|
+
- thin 1.5.0 codename Knife
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '[{"biography":null,"created_at":"2013-02-13T20:34:59Z","family_name":"Ryan","given_name":"Adam","id":5,"meta":null,"moderated_decisions_count":null,"stickers":[],"updated_at":"2013-02-13T20:34:59Z","username":"adam","website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_1.png","full_name":"Adam
|
42
|
+
Ryan","short_name":"Adam R","display_name":"adam","short_display_name":"adam","analytics":{"votes":0,"decisions":0,"followers":0,"following":0},"following":true}]'
|
43
|
+
http_version:
|
44
|
+
recorded_at: Wed, 13 Feb 2013 20:38:21 GMT
|
45
|
+
- request:
|
46
|
+
method: get
|
47
|
+
uri: http://localhost:5000/v1/users/adam
|
48
|
+
body:
|
49
|
+
encoding: US-ASCII
|
50
|
+
string: ''
|
51
|
+
headers:
|
52
|
+
Accept:
|
53
|
+
- ! '*/*'
|
54
|
+
User-Agent:
|
55
|
+
- Ruby
|
56
|
+
Authorization:
|
57
|
+
- Bearer 9774e653f7b3c1de5f21b61adc08ba24
|
58
|
+
Content-Type:
|
59
|
+
- application/json
|
60
|
+
response:
|
61
|
+
status:
|
62
|
+
code: 200
|
63
|
+
message: OK
|
64
|
+
headers:
|
65
|
+
Content-Type:
|
66
|
+
- application/json; charset=utf-8
|
67
|
+
X-Ua-Compatible:
|
68
|
+
- IE=Edge
|
69
|
+
Etag:
|
70
|
+
- ! '"527bbb246a9d1e7f7bbeebaa4c8b9dea"'
|
71
|
+
Cache-Control:
|
72
|
+
- max-age=0, private, must-revalidate
|
73
|
+
X-Request-Id:
|
74
|
+
- 27f777b4cb64fb62c4e43d19738063a2
|
75
|
+
X-Runtime:
|
76
|
+
- '0.037453'
|
77
|
+
Connection:
|
78
|
+
- close
|
79
|
+
Server:
|
80
|
+
- thin 1.5.0 codename Knife
|
81
|
+
body:
|
82
|
+
encoding: US-ASCII
|
83
|
+
string: ! '{"biography":null,"created_at":"2013-02-13T20:34:59Z","family_name":"Ryan","given_name":"Adam","id":5,"meta":null,"moderated_decisions_count":null,"stickers":[],"updated_at":"2013-02-13T20:34:59Z","username":"adam","website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_1.png","full_name":"Adam
|
84
|
+
Ryan","short_name":"Adam R","display_name":"adam","short_display_name":"adam","analytics":{"votes":0,"decisions":0,"followers":0,"following":0},"following":true}'
|
85
|
+
http_version:
|
86
|
+
recorded_at: Wed, 13 Feb 2013 20:38:21 GMT
|
87
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,87 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:5000/v1/users/4/following
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
Authorization:
|
15
|
+
- Bearer 9774e653f7b3c1de5f21b61adc08ba24
|
16
|
+
Content-Type:
|
17
|
+
- application/json
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
X-Ua-Compatible:
|
26
|
+
- IE=Edge
|
27
|
+
Etag:
|
28
|
+
- ! '"984ab6ec1921c5e8e76e486ea2555386"'
|
29
|
+
Cache-Control:
|
30
|
+
- max-age=0, private, must-revalidate
|
31
|
+
X-Request-Id:
|
32
|
+
- 68ed6a4ea11595d674e6f7c59c9c77b3
|
33
|
+
X-Runtime:
|
34
|
+
- '0.012123'
|
35
|
+
Connection:
|
36
|
+
- close
|
37
|
+
Server:
|
38
|
+
- thin 1.5.0 codename Knife
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '[{"biography":null,"created_at":"2013-02-13T20:34:59Z","family_name":"Ryan","given_name":"Adam","id":5,"meta":null,"moderated_decisions_count":null,"stickers":[],"updated_at":"2013-02-13T20:34:59Z","username":"adam","website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_1.png","full_name":"Adam
|
42
|
+
Ryan","short_name":"Adam R","display_name":"adam","short_display_name":"adam","analytics":{"votes":0,"decisions":0,"followers":0,"following":0},"following":true}]'
|
43
|
+
http_version:
|
44
|
+
recorded_at: Wed, 13 Feb 2013 20:38:21 GMT
|
45
|
+
- request:
|
46
|
+
method: get
|
47
|
+
uri: http://localhost:5000/v1/users/adam
|
48
|
+
body:
|
49
|
+
encoding: US-ASCII
|
50
|
+
string: ''
|
51
|
+
headers:
|
52
|
+
Accept:
|
53
|
+
- ! '*/*'
|
54
|
+
User-Agent:
|
55
|
+
- Ruby
|
56
|
+
Authorization:
|
57
|
+
- Bearer 9774e653f7b3c1de5f21b61adc08ba24
|
58
|
+
Content-Type:
|
59
|
+
- application/json
|
60
|
+
response:
|
61
|
+
status:
|
62
|
+
code: 200
|
63
|
+
message: OK
|
64
|
+
headers:
|
65
|
+
Content-Type:
|
66
|
+
- application/json; charset=utf-8
|
67
|
+
X-Ua-Compatible:
|
68
|
+
- IE=Edge
|
69
|
+
Etag:
|
70
|
+
- ! '"527bbb246a9d1e7f7bbeebaa4c8b9dea"'
|
71
|
+
Cache-Control:
|
72
|
+
- max-age=0, private, must-revalidate
|
73
|
+
X-Request-Id:
|
74
|
+
- 9e3ef96108251c611885c284d30caa62
|
75
|
+
X-Runtime:
|
76
|
+
- '0.060119'
|
77
|
+
Connection:
|
78
|
+
- close
|
79
|
+
Server:
|
80
|
+
- thin 1.5.0 codename Knife
|
81
|
+
body:
|
82
|
+
encoding: US-ASCII
|
83
|
+
string: ! '{"biography":null,"created_at":"2013-02-13T20:34:59Z","family_name":"Ryan","given_name":"Adam","id":5,"meta":null,"moderated_decisions_count":null,"stickers":[],"updated_at":"2013-02-13T20:34:59Z","username":"adam","website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_1.png","full_name":"Adam
|
84
|
+
Ryan","short_name":"Adam R","display_name":"adam","short_display_name":"adam","analytics":{"votes":0,"decisions":0,"followers":0,"following":0},"following":true}'
|
85
|
+
http_version:
|
86
|
+
recorded_at: Wed, 13 Feb 2013 20:38:21 GMT
|
87
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:5000/v1/users/13/votes
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
Authorization:
|
15
|
+
- Bearer 9774e653f7b3c1de5f21b61adc08ba24
|
16
|
+
Content-Type:
|
17
|
+
- application/json
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
X-Ua-Compatible:
|
26
|
+
- IE=Edge
|
27
|
+
Etag:
|
28
|
+
- ! '"f823a98641e0c704bf82a436b4b6c11a"'
|
29
|
+
Cache-Control:
|
30
|
+
- max-age=0, private, must-revalidate
|
31
|
+
X-Request-Id:
|
32
|
+
- bcf93b6920dac50f3f40a386ff9e28b6
|
33
|
+
X-Runtime:
|
34
|
+
- '0.024938'
|
35
|
+
Connection:
|
36
|
+
- close
|
37
|
+
Server:
|
38
|
+
- thin 1.5.0 codename Knife
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '[{"choice_id":3,"created_at":"2013-02-13T20:54:36Z","decision_id":2,"id":8,"meta":null,"reason":null,"user":{"biography":null,"created_at":"2013-02-13T20:54:35Z","family_name":"Mills","given_name":"Dustin","id":13,"meta":null,"moderated_decisions_count":null,"stickers":[],"updated_at":"2013-02-13T20:54:35Z","username":"rickie_haag","website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_5.png","full_name":"Dustin
|
42
|
+
Mills","short_name":"Dustin M","display_name":"rickie_haag","short_display_name":"rickie_haag","analytics":{"votes":0,"decisions":0,"followers":0,"following":0}},"decision":{"created_at":"2013-02-13T20:54:35Z","final_vote_id":null,"flag_count":null,"id":2,"is_private":false,"meta":{"question_display_text":"Does
|
43
|
+
it work yet?","question_display_html":"Does it work yet?","question_entities":[]},"published_at":"2013-02-13T20:54:35Z","question":"Does
|
44
|
+
it work yet?","updated_at":"2013-02-13T20:54:36Z","user_id":12,"pusher_channel":"decision-12-2","timeline_key":"12,2","analytics":{"updated_at":"2013-02-13T20:54:36Z","views":0,"unique_viewers":0,"referrers":{},"votes":{"3":{"invited":1,"user":1,"anonymous":1,"total":3,"display_percentage":50},"4":{"invited":1,"user":1,"anonymous":1,"total":3,"display_percentage":50}},"total_votes":6},"user_vote":null,"choices":[{"created_at":"2013-02-13T20:54:35Z","decision_id":2,"decision_user_id":12,"id":3,"meta":null,"position":1,"subject":null,"type":"ImageChoice","updated_at":"2013-02-13T20:54:35Z","image_uri":"https://recess-dev.s3.amazonaws.com//Users/adamryan/src/seesawapi/lib/assets/image_1.jpg"},{"created_at":"2013-02-13T20:54:35Z","decision_id":2,"decision_user_id":12,"id":4,"meta":null,"position":2,"subject":null,"type":"ImageChoice","updated_at":"2013-02-13T20:54:35Z","image_uri":"https://recess-dev.s3.amazonaws.com//Users/adamryan/src/seesawapi/lib/assets/image_2.jpg"}],"invitations":[{"created_at":"2013-02-13T20:54:36Z","id":4,"notification_type":null,"read_at":null,"sent_at":null,"updated_at":"2013-02-13T20:54:36Z","user":{"biography":null,"created_at":"2013-02-13T20:54:35Z","family_name":"DuBuque","given_name":"Fredy","id":14,"meta":null,"moderated_decisions_count":null,"stickers":[],"updated_at":"2013-02-13T20:54:35Z","username":"nedra","website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_1.png","full_name":"Fredy
|
45
|
+
DuBuque","short_name":"Fredy D","display_name":"nedra","short_display_name":"nedra","analytics":{"votes":0,"decisions":0,"followers":0,"following":0}}},{"created_at":"2013-02-13T20:54:36Z","id":3,"notification_type":null,"read_at":null,"sent_at":null,"updated_at":"2013-02-13T20:54:36Z","user":{"biography":null,"created_at":"2013-02-13T20:54:35Z","family_name":"Mills","given_name":"Dustin","id":13,"meta":null,"moderated_decisions_count":null,"stickers":[],"updated_at":"2013-02-13T20:54:35Z","username":"rickie_haag","website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_5.png","full_name":"Dustin
|
46
|
+
Mills","short_name":"Dustin M","display_name":"rickie_haag","short_display_name":"rickie_haag","analytics":{"votes":0,"decisions":0,"followers":0,"following":0}}}],"user":{"biography":null,"created_at":"2013-02-13T20:54:34Z","family_name":"Jenkins","given_name":"Colleen","id":12,"meta":null,"moderated_decisions_count":null,"stickers":[],"updated_at":"2013-02-13T20:54:35Z","username":"annalise_kris","website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_1.png","full_name":"Colleen
|
47
|
+
Jenkins","short_name":"Colleen J","display_name":"annalise_kris","short_display_name":"annalise_kris","analytics":{"votes":0,"decisions":0,"followers":0,"following":0}},"slug":"d/3g002U"}}]'
|
48
|
+
http_version:
|
49
|
+
recorded_at: Wed, 13 Feb 2013 20:59:24 GMT
|
50
|
+
recorded_with: VCR 2.4.0
|
@@ -34,6 +34,31 @@ class UsersTest < Totter::TestCase
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
def test_user_following
|
38
|
+
VCR.use_cassette 'users/get_following' do
|
39
|
+
following = local_client.following('4')
|
40
|
+
other_user = local_client.user('adam')
|
41
|
+
assert_includes following, other_user
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_user_followers
|
46
|
+
VCR.use_cassette 'users/get_followers' do
|
47
|
+
followers = local_client.followers('4')
|
48
|
+
other_user = local_client.user('adam')
|
49
|
+
assert_includes followers, other_user
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_user_votes
|
54
|
+
VCR.use_cassette 'users/votes' do
|
55
|
+
votes = local_client.votes('13')
|
56
|
+
vote = votes.first
|
57
|
+
assert_equal 2, vote.decision_id
|
58
|
+
assert_equal 12, vote.decision.user_id
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
37
62
|
|
38
63
|
def test_following
|
39
64
|
VCR.use_cassette 'users/following' do
|
data/totter.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'totter/version'
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = 'totter'
|
8
8
|
gem.version = Totter::VERSION
|
9
|
-
gem.authors = ['Sam Soffes', 'Aaron Gotwalt']
|
10
|
-
gem.email = ['sam@soff.es', 'gotwalt@gmail.com']
|
9
|
+
gem.authors = ['Sam Soffes', 'Aaron Gotwalt', 'Adam Ryan']
|
10
|
+
gem.email = ['sam@soff.es', 'gotwalt@gmail.com', 'adam.g.ryan@gmail.com']
|
11
11
|
gem.description = 'Ruby gem for working with the Seesaw API.'
|
12
12
|
gem.summary = gem.description
|
13
13
|
gem.homepage = 'https://github.com/seesawco/totter-rb'
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: totter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sam Soffes
|
9
9
|
- Aaron Gotwalt
|
10
|
+
- Adam Ryan
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date: 2013-02-
|
14
|
+
date: 2013-02-13 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: multi_json
|
@@ -48,6 +49,7 @@ description: Ruby gem for working with the Seesaw API.
|
|
48
49
|
email:
|
49
50
|
- sam@soff.es
|
50
51
|
- gotwalt@gmail.com
|
52
|
+
- adam.g.ryan@gmail.com
|
51
53
|
executables: []
|
52
54
|
extensions: []
|
53
55
|
extra_rdoc_files: []
|
@@ -101,9 +103,12 @@ files:
|
|
101
103
|
- test/cassettes/timelines/stickers.yml
|
102
104
|
- test/cassettes/timelines/user.yml
|
103
105
|
- test/cassettes/users/following.yml
|
106
|
+
- test/cassettes/users/get_followers.yml
|
107
|
+
- test/cassettes/users/get_following.yml
|
104
108
|
- test/cassettes/users/me.yml
|
105
109
|
- test/cassettes/users/update.yml
|
106
110
|
- test/cassettes/users/user.yml
|
111
|
+
- test/cassettes/users/votes.yml
|
107
112
|
- test/cassettes/votes/create.yml
|
108
113
|
- test/support/client_macros.rb
|
109
114
|
- test/test_helper.rb
|
@@ -138,9 +143,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
143
|
- - ! '>='
|
139
144
|
- !ruby/object:Gem::Version
|
140
145
|
version: '0'
|
141
|
-
segments:
|
142
|
-
- 0
|
143
|
-
hash: -1018930971706952464
|
144
146
|
requirements: []
|
145
147
|
rubyforge_project:
|
146
148
|
rubygems_version: 1.8.23
|
@@ -175,9 +177,12 @@ test_files:
|
|
175
177
|
- test/cassettes/timelines/stickers.yml
|
176
178
|
- test/cassettes/timelines/user.yml
|
177
179
|
- test/cassettes/users/following.yml
|
180
|
+
- test/cassettes/users/get_followers.yml
|
181
|
+
- test/cassettes/users/get_following.yml
|
178
182
|
- test/cassettes/users/me.yml
|
179
183
|
- test/cassettes/users/update.yml
|
180
184
|
- test/cassettes/users/user.yml
|
185
|
+
- test/cassettes/users/votes.yml
|
181
186
|
- test/cassettes/votes/create.yml
|
182
187
|
- test/support/client_macros.rb
|
183
188
|
- test/test_helper.rb
|