totter 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/totter/client/timelines.rb +70 -4
- data/lib/totter/client/users.rb +1 -2
- data/lib/totter/client.rb +14 -2
- data/lib/totter/version.rb +1 -1
- data/test/cassettes/timelines/flagged.yml +51 -0
- data/test/cassettes/timelines/hashtags.yml +49 -0
- data/test/cassettes/timelines/search.yml +54 -0
- data/test/cassettes/timelines/stickers.yml +49 -0
- data/test/totter/client/timelines_test.rb +29 -1
- data/totter.gemspec +1 -0
- metadata +26 -2
@@ -4,12 +4,78 @@ module Totter
|
|
4
4
|
module Timelines
|
5
5
|
# Get recent decisions from the global timeline.
|
6
6
|
#
|
7
|
-
# @param
|
7
|
+
# @param options [Hash] Parameters for returning selected items
|
8
|
+
# @option options [Numeric] :limit Number of items to return. Default is 20
|
9
|
+
# @option options [String] :since A user_id/decision_id pair in the format '1,15' when paging forward
|
10
|
+
# @option options [String] :until A user_id/decision_id pair in the format '1,15' when paging backwards
|
8
11
|
# @return [Array]
|
9
12
|
# @example
|
10
|
-
# Seesaw.
|
11
|
-
def global_timeline(
|
12
|
-
get "timelines/global
|
13
|
+
# Seesaw.global_timeline(limit: 20, since: '1,15')
|
14
|
+
def global_timeline(options = default_options)
|
15
|
+
get "timelines/global", options
|
16
|
+
end
|
17
|
+
|
18
|
+
# Get recent decisions from a hashtag timeline
|
19
|
+
#
|
20
|
+
# @param hashtag [String] The hashtag to return
|
21
|
+
# @param options [Hash] Parameters for returning selected items
|
22
|
+
# @option options [Numeric] :limit Number of items to return. Default is 20
|
23
|
+
# @option options [String] :since A user_id/decision_id pair in the format '1,15' when paging forward
|
24
|
+
# @option options [String] :until A user_id/decision_id pair in the format '1,15' when paging backwards
|
25
|
+
# @return [Array]
|
26
|
+
# @example
|
27
|
+
# Seesaw.global_timeline(limit: 20, since: '1,15')
|
28
|
+
def hashtag_timeline(hashtag, options = default_options)
|
29
|
+
get "timelines/global", options.merge({hashtag: hashtag})
|
30
|
+
end
|
31
|
+
|
32
|
+
# Get recent decisions from a sticker timeline
|
33
|
+
#
|
34
|
+
# @param sticker [String] The sticker to return
|
35
|
+
# @param options [Hash] Parameters for returning selected items
|
36
|
+
# @option options [Numeric] :limit Number of items to return. Default is 20
|
37
|
+
# @option options [String] :since A user_id/decision_id pair in the format '1,15' when paging forward
|
38
|
+
# @option options [String] :until A user_id/decision_id pair in the format '1,15' when paging backwards
|
39
|
+
# @return [Array]
|
40
|
+
# @example
|
41
|
+
# Seesaw.global_timeline(limit: 20, since: '1,15')
|
42
|
+
def sticker_timeline(sticker, options = default_options)
|
43
|
+
get "timelines/global", options.merge({sticker: sticker})
|
44
|
+
end
|
45
|
+
|
46
|
+
# Search for published items
|
47
|
+
#
|
48
|
+
# @param query [String] The query to search for
|
49
|
+
# @param options [Hash] Parameters for returning selected items
|
50
|
+
# @option options [Numeric] :limit Number of items to return. Default is 20
|
51
|
+
# @option options [String] :since A user_id/decision_id pair in the format '1,15' when paging forward
|
52
|
+
# @option options [String] :until A user_id/decision_id pair in the format '1,15' when paging backwards
|
53
|
+
# @return [Array]
|
54
|
+
# @example
|
55
|
+
# Seesaw.global_timeline(limit: 20, since: '1,15')
|
56
|
+
def search_timeline(query, options = default_options)
|
57
|
+
get "timelines/search", options.merge({query: query})
|
58
|
+
end
|
59
|
+
|
60
|
+
# Get recent decisions from the flagged-for-review timeline
|
61
|
+
#
|
62
|
+
# @param options [Hash] Parameters for returning selected items
|
63
|
+
# @option options [Numeric] :limit Number of items to return. Default is 20
|
64
|
+
# @option options [String] :since A user_id/decision_id pair in the format '1,15' when paging forward
|
65
|
+
# @option options [String] :until A user_id/decision_id pair in the format '1,15' when paging backwards
|
66
|
+
# @return [Array]
|
67
|
+
# @example
|
68
|
+
# Seesaw.global_timeline(limit: 20, since: '1,15')
|
69
|
+
def flagged_timeline(options = default_options)
|
70
|
+
get "timelines/flagged", options
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def default_options
|
76
|
+
{
|
77
|
+
limit: 20
|
78
|
+
}
|
13
79
|
end
|
14
80
|
end
|
15
81
|
end
|
data/lib/totter/client/users.rb
CHANGED
@@ -24,9 +24,8 @@ module Totter
|
|
24
24
|
get "users/#{user}"
|
25
25
|
end
|
26
26
|
|
27
|
-
# Updates
|
27
|
+
# Updates the authenticating user
|
28
28
|
#
|
29
|
-
# @param user_id [Numeric] A Seesaw user ID.
|
30
29
|
# @param options [Hash] Properties to be updated
|
31
30
|
# @option options [String] :given_name The given name of the user
|
32
31
|
# @option options [String] :family_name The Family name of the user
|
data/lib/totter/client.rb
CHANGED
@@ -3,6 +3,7 @@ require 'net/https'
|
|
3
3
|
require 'uri'
|
4
4
|
require 'multi_json'
|
5
5
|
require 'hashie'
|
6
|
+
require 'addressable/uri'
|
6
7
|
|
7
8
|
require 'totter/client/users'
|
8
9
|
require 'totter/client/decisions'
|
@@ -74,8 +75,15 @@ module Totter
|
|
74
75
|
end
|
75
76
|
|
76
77
|
def request(method, path, params = nil)
|
78
|
+
uri = Addressable::URI.parse("#{self.base_url}#{path}")
|
79
|
+
|
80
|
+
# if the request requires parameters in the query string, merge them in
|
81
|
+
if params and !can_post_data?(method)
|
82
|
+
uri.query_values = (uri.query_values || {}).merge(params)
|
83
|
+
end
|
84
|
+
|
77
85
|
# Build request
|
78
|
-
request = build_request(method,
|
86
|
+
request = build_request(method, uri)
|
79
87
|
|
80
88
|
# Add headers
|
81
89
|
request['Authorization'] = "Bearer #{self.access_token}" if authenticated?
|
@@ -83,7 +91,7 @@ module Totter
|
|
83
91
|
request['Content-Type'] = 'application/json'
|
84
92
|
|
85
93
|
# Add params as JSON if they exist
|
86
|
-
request.body = MultiJson.dump(params) if
|
94
|
+
request.body = MultiJson.dump(params) if can_post_data?(method) and params
|
87
95
|
|
88
96
|
# Request
|
89
97
|
response = http.request(request)
|
@@ -145,6 +153,10 @@ module Totter
|
|
145
153
|
(200..299).include? response.code.to_i
|
146
154
|
end
|
147
155
|
|
156
|
+
def can_post_data?(method)
|
157
|
+
[:post, :put].include?(method)
|
158
|
+
end
|
159
|
+
|
148
160
|
[:get, :post, :put, :delete].each do |method|
|
149
161
|
define_method method do |*args|
|
150
162
|
json_request(method, *args)
|
data/lib/totter/version.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:5000/v1/timelines/flagged?limit=20
|
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
|
+
X-Pusher-Channel:
|
24
|
+
- timeline-flagged
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
X-Ua-Compatible:
|
28
|
+
- IE=Edge
|
29
|
+
Etag:
|
30
|
+
- ! '"0acd8cac74006491b795cea4a88fd4eb"'
|
31
|
+
Cache-Control:
|
32
|
+
- max-age=0, private, must-revalidate
|
33
|
+
X-Request-Id:
|
34
|
+
- 61a5061aaaceb232be0ca641b6035677
|
35
|
+
X-Runtime:
|
36
|
+
- '0.266770'
|
37
|
+
Connection:
|
38
|
+
- close
|
39
|
+
Server:
|
40
|
+
- thin 1.5.0 codename Knife
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: ! '[{"created_at":"2013-01-30T21:12:28Z","final_vote_id":null,"flag_count":1,"id":18,"is_private":false,"meta":{"is_binary":true,"question_display_text":"Is
|
44
|
+
bacon delicious?","question_display_html":"Is bacon delicious?","question_entities":[]},"published_at":"2013-01-30T21:12:28Z","question":"Is
|
45
|
+
bacon delicious?","updated_at":"2013-02-04T19:18:57Z","user_id":1,"pusher_channel":"decision-1-18","timeline_key":"1,18","analytics":{"views":0,"unique_viewers":0,"referrers":{},"votes":{},"total_votes":0},"user_vote":null,"choices":[{"created_at":"2013-01-30T21:12:28Z","decision_id":18,"decision_user_id":1,"id":5,"meta":{"link_url":"http://seesaw.co","link_title":"Seesaw"},"position":1,"subject":"Test
|
46
|
+
Image","type":"ImageChoice","updated_at":"2013-01-30T21:12:28Z","image_uri":"https://recess-dev.s3.amazonaws.com/gotwalt-pro.sf.gotwalt.com/decisions/18/5/1359580348/photo.png"},{"created_at":"2013-01-30T21:12:28Z","decision_id":18,"decision_user_id":1,"id":6,"meta":null,"position":2,"subject":null,"type":"NoChoice","updated_at":"2013-01-30T21:12:28Z"}],"invitations":[],"user":{"biography":null,"created_at":"2013-01-23T03:22:06Z","family_name":"Gotwalt","given_name":"Aaron","id":1,"meta":null,"moderated_decisions_count":null,"updated_at":"2013-02-04T19:29:42Z","username":null,"website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_1.png","full_name":"Aaron
|
47
|
+
Gotwalt","short_name":"Aaron G","display_name":"Aaron Gotwalt","short_display_name":"Aaron
|
48
|
+
G","analytics":{"votes":0,"decisions":0,"followers":0,"following":0}},"slug":"d/3I1H0y"}]'
|
49
|
+
http_version:
|
50
|
+
recorded_at: Mon, 04 Feb 2013 19:29:56 GMT
|
51
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:5000/v1/timelines/global?hashtag=test&limit=20
|
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
|
+
X-Pusher-Channel:
|
24
|
+
- timeline-hashtag-test
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
X-Ua-Compatible:
|
28
|
+
- IE=Edge
|
29
|
+
Etag:
|
30
|
+
- ! '"c1d0337dfe70d635647580d02353f205"'
|
31
|
+
Cache-Control:
|
32
|
+
- max-age=0, private, must-revalidate
|
33
|
+
X-Request-Id:
|
34
|
+
- a83418585d2c5d07038bcef9cb0d0486
|
35
|
+
X-Runtime:
|
36
|
+
- '0.337964'
|
37
|
+
Connection:
|
38
|
+
- close
|
39
|
+
Server:
|
40
|
+
- thin 1.5.0 codename Knife
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: ! '[{"created_at":"2013-01-30T21:12:28Z","final_vote_id":null,"flag_count":null,"id":18,"is_private":false,"meta":{"is_binary":true},"published_at":"2013-01-30T21:12:28Z","question":null,"updated_at":"2013-01-30T21:12:28Z","user_id":1,"pusher_channel":"decision-1-18","timeline_key":"1,18","analytics":{"views":0,"unique_viewers":0,"referrers":{},"votes":{},"total_votes":0},"user_vote":null,"choices":[{"created_at":"2013-01-30T21:12:28Z","decision_id":18,"decision_user_id":1,"id":5,"meta":{"link_url":"http://seesaw.co","link_title":"Seesaw"},"position":1,"subject":"Test
|
44
|
+
Image","type":"ImageChoice","updated_at":"2013-01-30T21:12:28Z","image_uri":"https://recess-dev.s3.amazonaws.com/gotwalt-pro.sf.gotwalt.com/decisions/18/5/1359580348/photo.png"},{"created_at":"2013-01-30T21:12:28Z","decision_id":18,"decision_user_id":1,"id":6,"meta":null,"position":2,"subject":null,"type":"NoChoice","updated_at":"2013-01-30T21:12:28Z"}],"invitations":[],"user":{"biography":null,"created_at":"2013-01-23T03:22:06Z","family_name":"Gotwalt","given_name":"Aaron","id":1,"meta":null,"moderated_decisions_count":null,"updated_at":"2013-02-03T06:41:56Z","username":null,"website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_1.png","full_name":"Aaron
|
45
|
+
Gotwalt","short_name":"Aaron G","display_name":"Aaron Gotwalt","short_display_name":"Aaron
|
46
|
+
G","analytics":{"votes":0,"decisions":0,"followers":0,"following":0}},"slug":"d/3I1H0y"}]'
|
47
|
+
http_version:
|
48
|
+
recorded_at: Mon, 04 Feb 2013 19:07:15 GMT
|
49
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:5000/v1/timelines/search?limit=20&query=bacon
|
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
|
+
- ! '"9740321d7584c33d22f5bf297e767267"'
|
29
|
+
Cache-Control:
|
30
|
+
- max-age=0, private, must-revalidate
|
31
|
+
X-Request-Id:
|
32
|
+
- 8f9f928e84450131f026d85998866d15
|
33
|
+
X-Runtime:
|
34
|
+
- '0.053194'
|
35
|
+
Connection:
|
36
|
+
- close
|
37
|
+
Server:
|
38
|
+
- thin 1.5.0 codename Knife
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '[{"created_at":"2013-01-30T21:14:26Z","final_vote_id":null,"flag_count":null,"id":19,"is_private":false,"meta":{"is_binary":true,"question_display_text":"Should
|
42
|
+
I add more bacon?","question_display_html":"Should I add more bacon?","question_entities":[]},"published_at":"2013-01-30T21:14:26Z","question":"Should
|
43
|
+
I add more bacon?","updated_at":"2013-02-04T19:17:43Z","user_id":1,"pusher_channel":"decision-1-19","timeline_key":"1,19","analytics":{"views":0,"unique_viewers":0,"referrers":{},"votes":{},"total_votes":0},"user_vote":null,"choices":[{"created_at":"2013-01-30T21:14:26Z","decision_id":19,"decision_user_id":1,"id":7,"meta":{"link_url":"http://seesaw.co","link_title":"Seesaw"},"position":1,"subject":"Test
|
44
|
+
Image","type":"ImageChoice","updated_at":"2013-01-30T21:14:26Z","image_uri":"https://recess-dev.s3.amazonaws.com/gotwalt-pro.sf.gotwalt.com/decisions/19/7/1359580466/photo.png"},{"created_at":"2013-01-30T21:14:26Z","decision_id":19,"decision_user_id":1,"id":8,"meta":null,"position":2,"subject":null,"type":"NoChoice","updated_at":"2013-01-30T21:14:26Z"}],"invitations":[],"user":{"biography":null,"created_at":"2013-01-23T03:22:06Z","family_name":"Gotwalt","given_name":"Aaron","id":1,"meta":null,"moderated_decisions_count":null,"updated_at":"2013-02-03T06:41:56Z","username":null,"website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_1.png","full_name":"Aaron
|
45
|
+
Gotwalt","short_name":"Aaron G","display_name":"Aaron Gotwalt","short_display_name":"Aaron
|
46
|
+
G","analytics":{"votes":0,"decisions":0,"followers":0,"following":0}},"slug":"d/0P082U"},{"created_at":"2013-01-30T21:12:28Z","final_vote_id":null,"flag_count":null,"id":18,"is_private":false,"meta":{"is_binary":true,"question_display_text":"Is
|
47
|
+
bacon delicious?","question_display_html":"Is bacon delicious?","question_entities":[]},"published_at":"2013-01-30T21:12:28Z","question":"Is
|
48
|
+
bacon delicious?","updated_at":"2013-02-04T19:17:31Z","user_id":1,"pusher_channel":"decision-1-18","timeline_key":"1,18","analytics":{"views":0,"unique_viewers":0,"referrers":{},"votes":{},"total_votes":0},"user_vote":null,"choices":[{"created_at":"2013-01-30T21:12:28Z","decision_id":18,"decision_user_id":1,"id":5,"meta":{"link_url":"http://seesaw.co","link_title":"Seesaw"},"position":1,"subject":"Test
|
49
|
+
Image","type":"ImageChoice","updated_at":"2013-01-30T21:12:28Z","image_uri":"https://recess-dev.s3.amazonaws.com/gotwalt-pro.sf.gotwalt.com/decisions/18/5/1359580348/photo.png"},{"created_at":"2013-01-30T21:12:28Z","decision_id":18,"decision_user_id":1,"id":6,"meta":null,"position":2,"subject":null,"type":"NoChoice","updated_at":"2013-01-30T21:12:28Z"}],"invitations":[],"user":{"biography":null,"created_at":"2013-01-23T03:22:06Z","family_name":"Gotwalt","given_name":"Aaron","id":1,"meta":null,"moderated_decisions_count":null,"updated_at":"2013-02-03T06:41:56Z","username":null,"website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_1.png","full_name":"Aaron
|
50
|
+
Gotwalt","short_name":"Aaron G","display_name":"Aaron Gotwalt","short_display_name":"Aaron
|
51
|
+
G","analytics":{"votes":0,"decisions":0,"followers":0,"following":0}},"slug":"d/3I1H0y"}]'
|
52
|
+
http_version:
|
53
|
+
recorded_at: Mon, 04 Feb 2013 19:18:03 GMT
|
54
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:5000/v1/timelines/global?limit=20&sticker=test
|
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
|
+
X-Pusher-Channel:
|
24
|
+
- timeline-hashtag-test
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
X-Ua-Compatible:
|
28
|
+
- IE=Edge
|
29
|
+
Etag:
|
30
|
+
- ! '"c1d0337dfe70d635647580d02353f205"'
|
31
|
+
Cache-Control:
|
32
|
+
- max-age=0, private, must-revalidate
|
33
|
+
X-Request-Id:
|
34
|
+
- a83418585d2c5d07038bcef9cb0d0486
|
35
|
+
X-Runtime:
|
36
|
+
- '0.337964'
|
37
|
+
Connection:
|
38
|
+
- close
|
39
|
+
Server:
|
40
|
+
- thin 1.5.0 codename Knife
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: ! '[{"created_at":"2013-01-30T21:12:28Z","final_vote_id":null,"flag_count":null,"id":18,"is_private":false,"meta":{"is_binary":true},"published_at":"2013-01-30T21:12:28Z","question":null,"updated_at":"2013-01-30T21:12:28Z","user_id":1,"pusher_channel":"decision-1-18","timeline_key":"1,18","analytics":{"views":0,"unique_viewers":0,"referrers":{},"votes":{},"total_votes":0},"user_vote":null,"choices":[{"created_at":"2013-01-30T21:12:28Z","decision_id":18,"decision_user_id":1,"id":5,"meta":{"link_url":"http://seesaw.co","link_title":"Seesaw"},"position":1,"subject":"Test
|
44
|
+
Image","type":"ImageChoice","updated_at":"2013-01-30T21:12:28Z","image_uri":"https://recess-dev.s3.amazonaws.com/gotwalt-pro.sf.gotwalt.com/decisions/18/5/1359580348/photo.png"},{"created_at":"2013-01-30T21:12:28Z","decision_id":18,"decision_user_id":1,"id":6,"meta":null,"position":2,"subject":null,"type":"NoChoice","updated_at":"2013-01-30T21:12:28Z"}],"invitations":[],"user":{"biography":null,"created_at":"2013-01-23T03:22:06Z","family_name":"Gotwalt","given_name":"Aaron","id":1,"meta":null,"moderated_decisions_count":null,"updated_at":"2013-02-03T06:41:56Z","username":null,"website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_1.png","full_name":"Aaron
|
45
|
+
Gotwalt","short_name":"Aaron G","display_name":"Aaron Gotwalt","short_display_name":"Aaron
|
46
|
+
G","analytics":{"votes":0,"decisions":0,"followers":0,"following":0}},"slug":"d/3I1H0y"}]'
|
47
|
+
http_version:
|
48
|
+
recorded_at: Mon, 04 Feb 2013 19:07:15 GMT
|
49
|
+
recorded_with: VCR 2.4.0
|
@@ -3,7 +3,35 @@ require 'test_helper'
|
|
3
3
|
class TimelinesTest < Totter::TestCase
|
4
4
|
def test_global
|
5
5
|
VCR.use_cassette 'timelines/global' do
|
6
|
-
assert_equal 15, Totter.global_timeline(15).length
|
6
|
+
assert_equal 15, Totter.global_timeline(limit: 15).length
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_hashtags
|
11
|
+
VCR.use_cassette 'timelines/hashtags' do
|
12
|
+
client = local_client
|
13
|
+
assert_equal 1, local_client.hashtag_timeline('test').length
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_stickers
|
18
|
+
VCR.use_cassette 'timelines/stickers' do
|
19
|
+
client = local_client
|
20
|
+
assert_equal 1, local_client.sticker_timeline('test').length
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_search
|
25
|
+
VCR.use_cassette 'timelines/search' do
|
26
|
+
client = local_client
|
27
|
+
assert_equal 2, local_client.search_timeline('bacon').length
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_flagged
|
32
|
+
VCR.use_cassette 'timelines/flagged' do
|
33
|
+
client = local_client
|
34
|
+
assert_equal 1, local_client.flagged_timeline.length
|
7
35
|
end
|
8
36
|
end
|
9
37
|
end
|
data/totter.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-02-
|
13
|
+
date: 2013-02-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
@@ -44,6 +44,22 @@ dependencies:
|
|
44
44
|
- - ~>
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 1.2.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: addressable
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.3.0
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.3.0
|
47
63
|
description: Ruby gem for working with the Seesaw API.
|
48
64
|
email:
|
49
65
|
- sam@soff.es
|
@@ -86,7 +102,11 @@ files:
|
|
86
102
|
- test/cassettes/decisions/show.yml
|
87
103
|
- test/cassettes/decisions/unflag.yml
|
88
104
|
- test/cassettes/slugs/show.yml
|
105
|
+
- test/cassettes/timelines/flagged.yml
|
89
106
|
- test/cassettes/timelines/global.yml
|
107
|
+
- test/cassettes/timelines/hashtags.yml
|
108
|
+
- test/cassettes/timelines/search.yml
|
109
|
+
- test/cassettes/timelines/stickers.yml
|
90
110
|
- test/cassettes/users/following.yml
|
91
111
|
- test/cassettes/users/me.yml
|
92
112
|
- test/cassettes/users/update.yml
|
@@ -146,7 +166,11 @@ test_files:
|
|
146
166
|
- test/cassettes/decisions/show.yml
|
147
167
|
- test/cassettes/decisions/unflag.yml
|
148
168
|
- test/cassettes/slugs/show.yml
|
169
|
+
- test/cassettes/timelines/flagged.yml
|
149
170
|
- test/cassettes/timelines/global.yml
|
171
|
+
- test/cassettes/timelines/hashtags.yml
|
172
|
+
- test/cassettes/timelines/search.yml
|
173
|
+
- test/cassettes/timelines/stickers.yml
|
150
174
|
- test/cassettes/users/following.yml
|
151
175
|
- test/cassettes/users/me.yml
|
152
176
|
- test/cassettes/users/update.yml
|