totter 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -0
- data/Gemfile +4 -3
- data/Rakefile +6 -0
- data/Readme.markdown +6 -4
- data/lib/totter/client/timelines.rb +12 -0
- data/lib/totter/client.rb +10 -10
- data/lib/totter/version.rb +1 -1
- data/test/cassettes/timelines/random/global.yml +116 -0
- data/test/cassettes/timelines/random/hashtag.yml +57 -0
- data/test/cassettes/timelines/random/sticker.yml +57 -0
- data/test/support/client_macros.rb +4 -0
- data/test/totter/client/timelines_test.rb +27 -0
- metadata +50 -64
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,22 +1,23 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
# Gem dependencies
|
4
|
-
gemspec
|
4
|
+
puts gemspec
|
5
5
|
|
6
6
|
gem 'rake', :group => [:development, :test]
|
7
7
|
|
8
8
|
# Development dependencies
|
9
9
|
group :development do
|
10
10
|
gem 'yard'
|
11
|
-
gem 'redcarpet'
|
11
|
+
gem 'redcarpet', :platform => 'ruby'
|
12
12
|
end
|
13
13
|
|
14
14
|
# Testing dependencies
|
15
15
|
group :test do
|
16
16
|
gem 'minitest'
|
17
|
-
gem '
|
17
|
+
gem 'minitest-wscolor' if RUBY_VERSION >= '1.9.3'
|
18
18
|
gem 'webmock', :require => 'webmock/minitest'
|
19
19
|
gem 'vcr'
|
20
20
|
gem 'mocha', :require => 'mocha/setup'
|
21
21
|
gem 'simplecov', :require => false
|
22
|
+
gem 'hashie' #unknown why this is required for certain dev envs to work (ahem, adam)
|
22
23
|
end
|
data/Rakefile
CHANGED
@@ -6,6 +6,12 @@ Rake::TestTask.new(:test) do |t|
|
|
6
6
|
t.libs << 'test'
|
7
7
|
t.pattern = 'test/**/*_test.rb'
|
8
8
|
end
|
9
|
+
|
10
|
+
desc "Open an irb session preloaded with this library"
|
11
|
+
task :console do
|
12
|
+
sh "irb -rubygems -I lib -r totter.rb"
|
13
|
+
end
|
14
|
+
|
9
15
|
task :default => :test
|
10
16
|
|
11
17
|
begin
|
data/Readme.markdown
CHANGED
@@ -6,10 +6,6 @@ All networking is done with Net::HTTP so you don't have to worry about version c
|
|
6
6
|
|
7
7
|
Read the [documentation](http://rubydoc.info/github/seesawco/totter-rb/master/frames) online.
|
8
8
|
|
9
|
-
[![Build Status](https://travis-ci.org/seesawco/totter-rb.png?branch=master)](https://travis-ci.org/seesawco/totter-rb)
|
10
|
-
|
11
|
-
[![Code Climate](https://codeclimate.com/github/seesawco/totter-rb.png)](https://codeclimate.com/github/seesawco/totter-rb)
|
12
|
-
|
13
9
|
## Installation
|
14
10
|
|
15
11
|
Add this line to your application's Gemfile:
|
@@ -46,6 +42,12 @@ A client takes an optional access token when you initialize it. If you don't pro
|
|
46
42
|
#=> "soffes"
|
47
43
|
```
|
48
44
|
|
45
|
+
## Supported Ruby Versions
|
46
|
+
|
47
|
+
Totter is tested under 1.8.7, 1.9.2, 1.9.3, 2.0.0, JRuby 1.7.2 (1.9 mode), and Rubinius 2.0.0 (1.9 mode).
|
48
|
+
|
49
|
+
[![Build Status](https://travis-ci.org/seesawco/totter-rb.png?branch=master)](https://travis-ci.org/seesawco/totter-rb)
|
50
|
+
|
49
51
|
## Contributing
|
50
52
|
|
51
53
|
See the [contributing guide](Contributing.markdown).
|
@@ -48,6 +48,18 @@ module Totter
|
|
48
48
|
format_timeline_result get('timelines/global', options.merge({:sticker => sticker}))
|
49
49
|
end
|
50
50
|
|
51
|
+
# Get random decision from current timeline
|
52
|
+
#
|
53
|
+
# @param options [Hash] Parameters for returning selected item, defaults to golbal timeline
|
54
|
+
# @option options [String] :hashtag The hashtag timeline to use for random decision
|
55
|
+
# @option options [String] :sticker The sticker timeline to use for random decision
|
56
|
+
# @return Decision A `Hashie::Mash` object representing a random decision
|
57
|
+
# @example
|
58
|
+
# Totter.random_timeline_decision(hashtag: 'testhashtag')
|
59
|
+
def random_timeline_decision(options = {})
|
60
|
+
get('timelines/global/random', options.merge({:limit => 1})).body
|
61
|
+
end
|
62
|
+
|
51
63
|
# Search for published items
|
52
64
|
#
|
53
65
|
# @param query [String] The query to search for
|
data/lib/totter/client.rb
CHANGED
@@ -5,16 +5,16 @@ module Totter
|
|
5
5
|
class Client
|
6
6
|
Dir[File.expand_path('../client/*.rb', __FILE__)].each { |f| require f }
|
7
7
|
|
8
|
-
include
|
9
|
-
include
|
10
|
-
include
|
11
|
-
include
|
12
|
-
include
|
13
|
-
include
|
14
|
-
include
|
15
|
-
include
|
16
|
-
include
|
17
|
-
include
|
8
|
+
include Avatars
|
9
|
+
include Choices
|
10
|
+
include Comments
|
11
|
+
include Configuration
|
12
|
+
include Decisions
|
13
|
+
include Slugs
|
14
|
+
include Stickers
|
15
|
+
include Timelines
|
16
|
+
include Users
|
17
|
+
include Votes
|
18
18
|
|
19
19
|
attr_reader :access_token
|
20
20
|
attr_reader :api_scheme
|
data/lib/totter/version.rb
CHANGED
@@ -0,0 +1,116 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.seesaw.co/v1/timelines/global/random?limit=1
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
X-Seesaw-Client-Token:
|
15
|
+
- 29756b7591819c57e01ac2c6d9ae5311
|
16
|
+
Content-Type:
|
17
|
+
- application/json
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Cache-Control:
|
24
|
+
- max-age=0, private, must-revalidate
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Date:
|
28
|
+
- Thu, 07 Mar 2013 00:44:54 GMT
|
29
|
+
Etag:
|
30
|
+
- ! '"a8a04aefc406b32f19d776bd073f153f"'
|
31
|
+
Server:
|
32
|
+
- thin 1.5.0 codename Knife
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=31536000
|
35
|
+
X-Rack-Cache:
|
36
|
+
- miss
|
37
|
+
X-Request-Id:
|
38
|
+
- f3b18fe8e65b51c64e7318ad0be248ad
|
39
|
+
X-Runtime:
|
40
|
+
- '0.027787'
|
41
|
+
X-Ua-Compatible:
|
42
|
+
- IE=Edge,chrome=1
|
43
|
+
Transfer-Encoding:
|
44
|
+
- chunked
|
45
|
+
Connection:
|
46
|
+
- keep-alive
|
47
|
+
body:
|
48
|
+
encoding: US-ASCII
|
49
|
+
string: ! '{"created_at":"2013-03-07T00:31:06Z","final_vote_id":null,"flag_count":null,"id":17205,"is_private":false,"meta":{"question_display_text":"Which
|
50
|
+
running shoes should I get?","question_display_html":"Which running shoes
|
51
|
+
should I get?","question_entities":[]},"published_at":"2013-03-07T00:38:02Z","question":"Which
|
52
|
+
running shoes should I get?","updated_at":"2013-03-07T00:43:43Z","user_id":3131,"pusher_channel":"decision-3131-17205","timeline_key":"3131,17205","analytics":{"unique_viewers":6,"views":16,"updated_at":"2013-03-07T00:43:43Z","comments":3,"referrers":{},"votes":{"31406":{"user":1,"total":1,"display_percentage":25},"31404":{"user":1,"total":1,"display_percentage":25},"31407":{"user":1,"total":1,"display_percentage":25},"31405":{"user":1,"total":1,"display_percentage":25}},"total_votes":4},"user_vote":null,"choices":[{"created_at":"2013-03-07T00:31:06Z","decision_id":17205,"decision_user_id":3131,"id":31404,"meta":{"subject_display_text":"Nike
|
53
|
+
Flyknit Lunar1+","subject_display_html":"Nike Flyknit Lunar1+","subject_entities":[]},"position":1,"subject":"Nike
|
54
|
+
Flyknit Lunar1+","type":"ImageChoice","updated_at":"2013-03-07T00:38:02Z","image_uri":"https://recess.s3.amazonaws.com/decisions/17205/31404/1362616266/photo.jpg"},{"created_at":"2013-03-07T00:31:15Z","decision_id":17205,"decision_user_id":3131,"id":31405,"meta":{"subject_display_text":"Nike
|
55
|
+
Free Run iD","subject_display_html":"Nike Free Run iD","subject_entities":[]},"position":2,"subject":"Nike
|
56
|
+
Free Run iD","type":"ImageChoice","updated_at":"2013-03-07T00:38:02Z","image_uri":"https://recess.s3.amazonaws.com/decisions/17205/31405/1362616275/photo.jpg"},{"created_at":"2013-03-07T00:31:28Z","decision_id":17205,"decision_user_id":3131,"id":31406,"meta":{"subject_display_text":"Nike
|
57
|
+
Free Run+ 3","subject_display_html":"Nike Free Run+ 3","subject_entities":[]},"position":3,"subject":"Nike
|
58
|
+
Free Run+ 3","type":"ImageChoice","updated_at":"2013-03-07T00:38:02Z","image_uri":"https://recess.s3.amazonaws.com/decisions/17205/31406/1362616288/photo.jpg"},{"created_at":"2013-03-07T00:31:39Z","decision_id":17205,"decision_user_id":3131,"id":31407,"meta":{"subject_display_text":"New
|
59
|
+
Balance Minimus Zero","subject_display_html":"New Balance Minimus Zero","subject_entities":[]},"position":4,"subject":"New
|
60
|
+
Balance Minimus Zero","type":"ImageChoice","updated_at":"2013-03-07T00:38:02Z","image_uri":"https://recess.s3.amazonaws.com/decisions/17205/31407/1362616299/photo.jpg"}],"invitations":[],"user":{"biography":null,"created_at":"2013-02-07T18:49:09Z","family_name":"Romero","given_name":"Jordan","id":3131,"location_name":null,"meta":null,"moderated_decisions_count":null,"phone_number_verified_at":"2013-02-07T18:49:20Z","stickers":["stars"],"updated_at":"2013-03-07T00:31:05Z","username":"justsimplyj","website":null,"avatar_url":"https://recess.s3.amazonaws.com/avatars/3898/1360263024/photo.jpg","full_name":"Jordan
|
61
|
+
Romero","short_name":"Jordan R","display_name":"justsimplyj","short_display_name":"justsimplyj","analytics":{"votes":210,"updated_at":"2013-03-07T00:38:02Z","decisions":11,"following":8,"followers":19}},"slug":"d/1H3T0w"}'
|
62
|
+
http_version:
|
63
|
+
recorded_at: Thu, 07 Mar 2013 00:44:54 GMT
|
64
|
+
- request:
|
65
|
+
method: get
|
66
|
+
uri: https://api.seesaw.co/v1/timelines/global/random?limit=1
|
67
|
+
body:
|
68
|
+
encoding: US-ASCII
|
69
|
+
string: ''
|
70
|
+
headers:
|
71
|
+
Accept:
|
72
|
+
- ! '*/*'
|
73
|
+
User-Agent:
|
74
|
+
- Ruby
|
75
|
+
X-Seesaw-Client-Token:
|
76
|
+
- 29756b7591819c57e01ac2c6d9ae5311
|
77
|
+
Content-Type:
|
78
|
+
- application/json
|
79
|
+
response:
|
80
|
+
status:
|
81
|
+
code: 200
|
82
|
+
message: OK
|
83
|
+
headers:
|
84
|
+
Cache-Control:
|
85
|
+
- max-age=0, private, must-revalidate
|
86
|
+
Content-Type:
|
87
|
+
- application/json; charset=utf-8
|
88
|
+
Date:
|
89
|
+
- Thu, 07 Mar 2013 00:44:54 GMT
|
90
|
+
Etag:
|
91
|
+
- ! '"758ea9b50b6940a4119dcfd84de32c4c"'
|
92
|
+
Server:
|
93
|
+
- thin 1.5.0 codename Knife
|
94
|
+
Strict-Transport-Security:
|
95
|
+
- max-age=31536000
|
96
|
+
X-Rack-Cache:
|
97
|
+
- miss
|
98
|
+
X-Request-Id:
|
99
|
+
- 7611dc7069e76773a33324feca2ba867
|
100
|
+
X-Runtime:
|
101
|
+
- '0.021258'
|
102
|
+
X-Ua-Compatible:
|
103
|
+
- IE=Edge,chrome=1
|
104
|
+
Transfer-Encoding:
|
105
|
+
- chunked
|
106
|
+
Connection:
|
107
|
+
- keep-alive
|
108
|
+
body:
|
109
|
+
encoding: US-ASCII
|
110
|
+
string: ! '{"created_at":"2013-02-23T19:22:25Z","final_vote_id":null,"flag_count":null,"id":13835,"is_private":false,"meta":{"question_display_text":"Which
|
111
|
+
one?","question_display_html":"Which one?","question_entities":[]},"published_at":"2013-02-23T19:23:03Z","question":"Which
|
112
|
+
one?","updated_at":"2013-03-03T13:00:27Z","user_id":5591,"pusher_channel":"decision-5591-13835","timeline_key":"5591,13835","analytics":{"views":107,"updated_at":"2013-03-03T13:00:27Z","unique_viewers":89,"referrers":{},"votes":{"25707":{"user":12,"total":12,"display_percentage":60},"25709":{"user":8,"total":8,"display_percentage":40}},"total_votes":20},"user_vote":null,"choices":[{"created_at":"2013-02-23T19:22:26Z","decision_id":13835,"decision_user_id":5591,"id":25707,"meta":{"subject_display_text":"","subject_display_html":"","subject_entities":[]},"position":1,"subject":"","type":"ImageChoice","updated_at":"2013-02-23T19:23:03Z","image_uri":"https://recess.s3.amazonaws.com/decisions/13835/25707/1361647346/photo.jpg"},{"created_at":"2013-02-23T19:22:45Z","decision_id":13835,"decision_user_id":5591,"id":25709,"meta":{"subject_display_text":"","subject_display_html":"","subject_entities":[]},"position":2,"subject":"","type":"ImageChoice","updated_at":"2013-02-23T19:23:03Z","image_uri":"https://recess.s3.amazonaws.com/decisions/13835/25709/1361647365/photo.jpg"}],"invitations":[],"user":{"biography":"","created_at":"2013-02-11T01:25:54Z","family_name":"D.","given_name":"Kai","id":5591,"meta":{"biography_display_text":"","biography_display_html":"","biography_entities":[]},"moderated_decisions_count":null,"stickers":["stars"],"updated_at":"2013-03-02T04:17:08Z","username":"ikaifl","website":"http://www.twitter.com/ikaifl","avatar_url":"https://recess.s3.amazonaws.com/avatars/7507/1360546226/photo.jpg","full_name":"Kai
|
113
|
+
D.","short_name":"Kai D","display_name":"ikaifl","short_display_name":"ikaifl","analytics":{"votes":550,"updated_at":"2013-03-02T09:10:55Z","decisions":11,"followers":11,"following":24}},"slug":"d/0R1A2A"}'
|
114
|
+
http_version:
|
115
|
+
recorded_at: Thu, 07 Mar 2013 00:44:54 GMT
|
116
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,57 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.seesaw.co/v1/timelines/global/random?hashtag=mycloset&limit=1
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
X-Seesaw-Client-Token:
|
15
|
+
- 29756b7591819c57e01ac2c6d9ae5311
|
16
|
+
Content-Type:
|
17
|
+
- application/json
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Cache-Control:
|
24
|
+
- max-age=0, private, must-revalidate
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Date:
|
28
|
+
- Thu, 07 Mar 2013 00:44:53 GMT
|
29
|
+
Etag:
|
30
|
+
- ! '"3de3bf5f03be55e02bb38a59a28e5434"'
|
31
|
+
Server:
|
32
|
+
- thin 1.5.0 codename Knife
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=31536000
|
35
|
+
X-Rack-Cache:
|
36
|
+
- miss
|
37
|
+
X-Request-Id:
|
38
|
+
- dc4beed13092893ee72fd0e3f6d10cc1
|
39
|
+
X-Runtime:
|
40
|
+
- '0.024890'
|
41
|
+
X-Ua-Compatible:
|
42
|
+
- IE=Edge,chrome=1
|
43
|
+
Transfer-Encoding:
|
44
|
+
- chunked
|
45
|
+
Connection:
|
46
|
+
- keep-alive
|
47
|
+
body:
|
48
|
+
encoding: US-ASCII
|
49
|
+
string: ! '{"created_at":"2013-03-04T17:58:45Z","final_vote_id":null,"flag_count":null,"id":16614,"is_private":false,"meta":{"question_display_text":"Yay
|
50
|
+
or nay? #mycloset","question_display_html":"Yay or nay? <a href=\"https://seesaw.co/hashtag/mycloset\"
|
51
|
+
class=\"hashtag\">#mycloset</a>","question_entities":[{"type":"hashtag","text":"#mycloset","display_text":"#mycloset","indices":[12,21],"hashtag":"mycloset","display_indices":[12,21]}],"is_binary":true},"published_at":"2013-03-04T17:59:21Z","question":"Yay
|
52
|
+
or nay? #mycloset","updated_at":"2013-03-07T00:42:04Z","user_id":467,"pusher_channel":"decision-467-16614","timeline_key":"467,16614","analytics":{"views":152,"updated_at":"2013-03-07T00:42:04Z","unique_viewers":121,"comments":9,"referrers":{},"votes":{"30521":{"user":31,"total":31,"display_percentage":42},"30520":{"user":40,"anonymous":2,"total":42,"display_percentage":58}},"total_votes":73},"user_vote":{"choice_id":30520,"created_at":"2013-03-04T18:22:22Z","decision_id":16614,"id":193844,"meta":null,"reason":"","user":{"biography":null,"created_at":"2013-01-25T19:46:04Z","family_name":"Raji","given_name":"Princess","id":467,"meta":null,"moderated_decisions_count":null,"stickers":["stars"],"updated_at":"2013-03-04T07:08:00Z","username":"princessraji","website":null,"avatar_url":"https://recess.s3.amazonaws.com/avatars/11397/1361557607/photo.jpg","full_name":"Princess
|
53
|
+
Raji","short_name":"Princess R","display_name":"princessraji","short_display_name":"princessraji","analytics":{"votes":212,"updated_at":"2013-03-04T18:01:45Z","followers":51,"following":14,"decisions":14}}},"choices":[{"created_at":"2013-03-04T17:58:46Z","decision_id":16614,"decision_user_id":467,"id":30520,"meta":{"subject_display_text":"","subject_display_html":"","subject_entities":[]},"position":1,"subject":"","type":"ImageChoice","updated_at":"2013-03-04T17:59:21Z","image_uri":"https://recess.s3.amazonaws.com/decisions/16614/30520/1362419926/photo.jpg"},{"created_at":"2013-03-04T17:59:21Z","decision_id":16614,"decision_user_id":467,"id":30521,"meta":{"subject_display_text":"","subject_display_html":"","subject_entities":[]},"position":2,"subject":"","type":"NoChoice","updated_at":"2013-03-04T17:59:21Z"}],"invitations":[],"user":{"biography":null,"created_at":"2013-01-25T19:46:04Z","family_name":"Raji","given_name":"Princess","id":467,"meta":null,"moderated_decisions_count":null,"stickers":["stars"],"updated_at":"2013-03-04T07:08:00Z","username":"princessraji","website":null,"avatar_url":"https://recess.s3.amazonaws.com/avatars/11397/1361557607/photo.jpg","full_name":"Princess
|
54
|
+
Raji","short_name":"Princess R","display_name":"princessraji","short_display_name":"princessraji","analytics":{"votes":212,"updated_at":"2013-03-04T18:01:45Z","followers":51,"following":14,"decisions":14}},"slug":"d/3D2C2Q"}'
|
55
|
+
http_version:
|
56
|
+
recorded_at: Thu, 07 Mar 2013 00:44:53 GMT
|
57
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,57 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.seesaw.co/v1/timelines/global/random?limit=1&sticker=featured
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
X-Seesaw-Client-Token:
|
15
|
+
- 29756b7591819c57e01ac2c6d9ae5311
|
16
|
+
Content-Type:
|
17
|
+
- application/json
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Cache-Control:
|
24
|
+
- max-age=0, private, must-revalidate
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Date:
|
28
|
+
- Thu, 07 Mar 2013 00:44:55 GMT
|
29
|
+
Etag:
|
30
|
+
- ! '"81eedb822aafe6ce5b07b424d1d81e5f"'
|
31
|
+
Server:
|
32
|
+
- thin 1.5.0 codename Knife
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=31536000
|
35
|
+
X-Rack-Cache:
|
36
|
+
- miss
|
37
|
+
X-Request-Id:
|
38
|
+
- c1b538314147cf4ddfa1c2eddd8cb38f
|
39
|
+
X-Runtime:
|
40
|
+
- '0.022196'
|
41
|
+
X-Ua-Compatible:
|
42
|
+
- IE=Edge,chrome=1
|
43
|
+
Transfer-Encoding:
|
44
|
+
- chunked
|
45
|
+
Connection:
|
46
|
+
- keep-alive
|
47
|
+
body:
|
48
|
+
encoding: US-ASCII
|
49
|
+
string: ! '{"created_at":"2013-02-17T18:38:19Z","final_vote_id":null,"flag_count":null,"id":11478,"is_private":false,"meta":{"question_display_text":"Should
|
50
|
+
I test a cookie before gifting them??","question_display_html":"Should I test
|
51
|
+
a cookie before gifting them??","question_entities":[],"is_binary":true},"published_at":"2013-02-17T18:38:59Z","question":"Should
|
52
|
+
I test a cookie before gifting them??","updated_at":"2013-03-06T08:37:10Z","user_id":347,"pusher_channel":"decision-347-11478","timeline_key":"347,11478","analytics":{"unique_viewers":169,"views":272,"updated_at":"2013-03-06T08:37:10Z","comments":2,"referrers":{},"votes":{"20155":{"user":104,"anonymous":8,"total":112,"display_percentage":94},"20156":{"user":6,"total":6,"display_percentage":6}},"total_votes":118},"user_vote":null,"choices":[{"created_at":"2013-02-17T18:38:24Z","decision_id":11478,"decision_user_id":347,"id":20155,"meta":{"subject_display_text":"","subject_display_html":"","subject_entities":[]},"position":1,"subject":"","type":"ImageChoice","updated_at":"2013-02-17T18:38:33Z","image_uri":"https://recess.s3.amazonaws.com/decisions/11478/20155/1361126304/photo.jpg"},{"created_at":"2013-02-17T18:38:59Z","decision_id":11478,"decision_user_id":347,"id":20156,"meta":{"subject_display_text":"","subject_display_html":"","subject_entities":[]},"position":2,"subject":"","type":"NoChoice","updated_at":"2013-02-17T18:38:59Z"}],"invitations":[],"user":{"biography":null,"created_at":"2013-01-25T19:04:35Z","family_name":"","given_name":"Design
|
53
|
+
Crush","id":347,"meta":null,"moderated_decisions_count":null,"stickers":["featured","stars"],"updated_at":"2013-03-03T14:57:06Z","username":"designcrush","website":null,"avatar_url":"https://recess.s3.amazonaws.com/avatars/9256/1360801442/photo.jpg","full_name":"Design
|
54
|
+
Crush","short_name":"Design Crush","display_name":"designcrush","short_display_name":"designcrush","analytics":{"votes":1017,"updated_at":"2013-03-03T20:42:19Z","decisions":14,"followers":53,"following":13}},"slug":"d/3T2l2v"}'
|
55
|
+
http_version:
|
56
|
+
recorded_at: Thu, 07 Mar 2013 00:44:55 GMT
|
57
|
+
recorded_with: VCR 2.4.0
|
@@ -2,4 +2,8 @@ module ClientMacros
|
|
2
2
|
def local_client
|
3
3
|
client = Totter::Client.new(:access_token => '9774e653f7b3c1de5f21b61adc08ba24', :api_host => 'localhost:5000', :api_scheme => 'http')
|
4
4
|
end
|
5
|
+
|
6
|
+
def unauthenticated_monkeybars_production_client
|
7
|
+
Totter::Client.new(:client_token => '29756b7591819c57e01ac2c6d9ae5311')
|
8
|
+
end
|
5
9
|
end
|
@@ -9,6 +9,33 @@ class TimelinesTest < Totter::TestCase
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
+
def test_random_global
|
13
|
+
VCR.use_cassette 'timelines/random/global' do
|
14
|
+
client = unauthenticated_monkeybars_production_client
|
15
|
+
response = client.random_timeline_decision
|
16
|
+
next_response = client.random_timeline_decision
|
17
|
+
refute_equal response, next_response
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_random_hashtag
|
22
|
+
VCR.use_cassette 'timelines/random/hashtag' do
|
23
|
+
client = unauthenticated_monkeybars_production_client
|
24
|
+
response = client.random_timeline_decision({:hashtag => 'mycloset'})
|
25
|
+
hashtags = response.meta.question_entities.map { |ent| ent.hashtag }
|
26
|
+
assert_equal 'hashtag', response.meta.question_entities.first.type
|
27
|
+
assert_includes hashtags, 'mycloset'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_random_sticker
|
32
|
+
VCR.use_cassette 'timelines/random/sticker' do
|
33
|
+
client = unauthenticated_monkeybars_production_client
|
34
|
+
response = client.random_timeline_decision({:sticker => 'featured'})
|
35
|
+
assert response.user.stickers.include? 'featured'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
12
39
|
def test_hashtags
|
13
40
|
VCR.use_cassette 'timelines/hashtags' do
|
14
41
|
client = local_client
|
metadata
CHANGED
@@ -1,69 +1,59 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: totter
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 2
|
10
|
-
version: 0.3.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Sam Soffes
|
14
9
|
- Aaron Gotwalt
|
15
10
|
- Adam Ryan
|
16
11
|
autorequire:
|
17
12
|
bindir: bin
|
18
13
|
cert_chain: []
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
dependencies:
|
23
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
date: 2013-03-07 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
24
17
|
name: multi_json
|
25
|
-
|
26
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
27
19
|
none: false
|
28
|
-
requirements:
|
20
|
+
requirements:
|
29
21
|
- - ~>
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
hash: 3
|
32
|
-
segments:
|
33
|
-
- 1
|
34
|
-
- 5
|
35
|
-
- 0
|
22
|
+
- !ruby/object:Gem::Version
|
36
23
|
version: 1.5.0
|
37
24
|
type: :runtime
|
38
|
-
version_requirements: *id001
|
39
|
-
- !ruby/object:Gem::Dependency
|
40
|
-
name: hashie
|
41
25
|
prerelease: false
|
42
|
-
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ~>
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 1.5.0
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: hashie
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
43
35
|
none: false
|
44
|
-
requirements:
|
36
|
+
requirements:
|
45
37
|
- - ~>
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
hash: 31
|
48
|
-
segments:
|
49
|
-
- 1
|
50
|
-
- 2
|
51
|
-
- 0
|
38
|
+
- !ruby/object:Gem::Version
|
52
39
|
version: 1.2.0
|
53
40
|
type: :runtime
|
54
|
-
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.2.0
|
55
48
|
description: Ruby gem for working with the Seesaw API.
|
56
|
-
email:
|
49
|
+
email:
|
57
50
|
- sam@soff.es
|
58
51
|
- gotwalt@gmail.com
|
59
52
|
- adam.g.ryan@gmail.com
|
60
53
|
executables: []
|
61
|
-
|
62
54
|
extensions: []
|
63
|
-
|
64
55
|
extra_rdoc_files: []
|
65
|
-
|
66
|
-
files:
|
56
|
+
files:
|
67
57
|
- .gitignore
|
68
58
|
- .travis.yml
|
69
59
|
- Contributing.markdown
|
@@ -113,6 +103,9 @@ files:
|
|
113
103
|
- test/cassettes/timelines/flagged.yml
|
114
104
|
- test/cassettes/timelines/global.yml
|
115
105
|
- test/cassettes/timelines/hashtags.yml
|
106
|
+
- test/cassettes/timelines/random/global.yml
|
107
|
+
- test/cassettes/timelines/random/hashtag.yml
|
108
|
+
- test/cassettes/timelines/random/sticker.yml
|
116
109
|
- test/cassettes/timelines/search.yml
|
117
110
|
- test/cassettes/timelines/stickers.yml
|
118
111
|
- test/cassettes/timelines/user.yml
|
@@ -139,43 +132,32 @@ files:
|
|
139
132
|
- test/totter/client_test.rb
|
140
133
|
- test/totter_test.rb
|
141
134
|
- totter.gemspec
|
142
|
-
has_rdoc: true
|
143
135
|
homepage: https://github.com/seesawco/totter-rb
|
144
|
-
licenses:
|
136
|
+
licenses:
|
145
137
|
- MIT
|
146
138
|
post_install_message:
|
147
139
|
rdoc_options: []
|
148
|
-
|
149
|
-
require_paths:
|
140
|
+
require_paths:
|
150
141
|
- lib
|
151
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
143
|
none: false
|
153
|
-
requirements:
|
154
|
-
- -
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
hash: 57
|
157
|
-
segments:
|
158
|
-
- 1
|
159
|
-
- 8
|
160
|
-
- 7
|
144
|
+
requirements:
|
145
|
+
- - ! '>='
|
146
|
+
- !ruby/object:Gem::Version
|
161
147
|
version: 1.8.7
|
162
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
149
|
none: false
|
164
|
-
requirements:
|
165
|
-
- -
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
|
168
|
-
segments:
|
169
|
-
- 0
|
170
|
-
version: "0"
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
171
154
|
requirements: []
|
172
|
-
|
173
155
|
rubyforge_project:
|
174
|
-
rubygems_version: 1.
|
156
|
+
rubygems_version: 1.8.23
|
175
157
|
signing_key:
|
176
158
|
specification_version: 3
|
177
159
|
summary: Ruby gem for working with the Seesaw API.
|
178
|
-
test_files:
|
160
|
+
test_files:
|
179
161
|
- test/cassettes/avatars/create.yml
|
180
162
|
- test/cassettes/avatars/destroy.yml
|
181
163
|
- test/cassettes/avatars/index.yml
|
@@ -201,6 +183,9 @@ test_files:
|
|
201
183
|
- test/cassettes/timelines/flagged.yml
|
202
184
|
- test/cassettes/timelines/global.yml
|
203
185
|
- test/cassettes/timelines/hashtags.yml
|
186
|
+
- test/cassettes/timelines/random/global.yml
|
187
|
+
- test/cassettes/timelines/random/hashtag.yml
|
188
|
+
- test/cassettes/timelines/random/sticker.yml
|
204
189
|
- test/cassettes/timelines/search.yml
|
205
190
|
- test/cassettes/timelines/stickers.yml
|
206
191
|
- test/cassettes/timelines/user.yml
|
@@ -226,3 +211,4 @@ test_files:
|
|
226
211
|
- test/totter/client/votes_test.rb
|
227
212
|
- test/totter/client_test.rb
|
228
213
|
- test/totter_test.rb
|
214
|
+
has_rdoc:
|