totter 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,17 @@ module Totter
|
|
23
23
|
post("users/#{user_id}/decisions").body
|
24
24
|
end
|
25
25
|
|
26
|
+
# Clone a decision
|
27
|
+
#
|
28
|
+
# @param decision_id [Numeric] A Seesaw decision id
|
29
|
+
# @param user_id [Numeric] A Seesaw user id
|
30
|
+
# @return [Hashie::Mash]
|
31
|
+
# @example
|
32
|
+
# Totter.clone_decision(1, 2)
|
33
|
+
def clone_decision(user_id, decision_id, question = nil)
|
34
|
+
post("users/#{user_id}/decisions/#{decision_id}/clone", question: question).body
|
35
|
+
end
|
36
|
+
|
26
37
|
# Publish a decision
|
27
38
|
#
|
28
39
|
# @param user_id [Numeric] The decision's user id
|
data/lib/totter/version.rb
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:5000/v1/users/6/decisions/14/clone
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ! '{"question":null}'
|
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
|
+
- ! '"fbf422e3b4ad7a20deaa61f66a7e19ca"'
|
29
|
+
Cache-Control:
|
30
|
+
- max-age=0, private, must-revalidate
|
31
|
+
X-Request-Id:
|
32
|
+
- 291075a3f0dd9d8547140b0ba345b72d
|
33
|
+
X-Runtime:
|
34
|
+
- '0.372199'
|
35
|
+
Connection:
|
36
|
+
- close
|
37
|
+
Server:
|
38
|
+
- thin 1.5.0 codename Knife
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '{"created_at":"2013-04-11T16:47:16Z","final_vote_id":null,"flag_count":null,"id":16,"is_private":false,"meta":{"question_display_text":"what
|
42
|
+
time is it?","question_display_html":"what time is it?","question_entities":[]},"parent_id":14,"parent_user_id":6,"published_at":null,"question":"what
|
43
|
+
time is it?","updated_at":"2013-04-11T16:47:16Z","user_id":4,"pusher_channel":"decision-4-16","timeline_key":"4,16","analytics":{"views":0,"unique_viewers":0,"referrers":{},"votes":{},"total_votes":0},"user_vote":null,"composite_image_url":"https://recess-dev.s3.amazonaws.com/decisions/16/composite.jpg","cached_parent_decision":{"created_at":"2013-04-11T16:29:42Z","final_vote_id":null,"flag_count":null,"id":14,"is_private":false,"meta":{"question_display_text":"what
|
44
|
+
time is it?","question_display_html":"what time is it?","question_entities":[]},"parent_id":null,"parent_user_id":null,"published_at":"2013-04-11T16:29:41Z","question":"what
|
45
|
+
time is it?","updated_at":"2013-04-11T16:29:42Z","user_id":6,"pusher_channel":"decision-6-14","timeline_key":"6,14","analytics":{"views":0,"unique_viewers":0,"referrers":{},"votes":{},"total_votes":0},"user_vote":null,"composite_image_url":"https://recess-dev.s3.amazonaws.com/decisions/14/composite.jpg","cached_parent_decision":null,"choices":[],"invitations":[],"user":{"biography":null,"created_at":"2013-04-11T16:29:16Z","family_name":null,"given_name":null,"id":6,"location_name":null,"meta":null,"moderated_decisions_count":null,"phone_number_verified_at":null,"stickers":[],"updated_at":"2013-04-11T16:29:16Z","username":null,"website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_3.png","full_name":"6","short_name":"6","display_name":"6","short_display_name":"6","analytics":{"votes":0,"decisions":0,"followers":0,"following":0}},"slug":"d/3O3s1E"},"choices":[],"invitations":[],"user":{"biography":null,"created_at":"2013-04-11T00:05:00Z","family_name":"Soffes","given_name":"Sam","id":4,"location_name":null,"meta":null,"moderated_decisions_count":null,"phone_number_verified_at":null,"stickers":[],"updated_at":"2013-04-11T00:05:00Z","username":"soffes","website":null,"avatar_url":"https://recess-dev.s3.amazonaws.com/default_avatars/v1/photo_2.png","full_name":"Sam
|
46
|
+
Soffes","short_name":"Sam S","display_name":"soffes","short_display_name":"soffes","analytics":{"decisions":11,"updated_at":"2013-04-11T16:25:58Z","votes":0,"followers":0,"following":0}},"slug":"d/1o0H3r"}'
|
47
|
+
http_version:
|
48
|
+
recorded_at: Thu, 11 Apr 2013 16:47:16 GMT
|
49
|
+
recorded_with: VCR 2.4.0
|
@@ -18,6 +18,15 @@ class DecisionsTest < Totter::TestCase
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
def test_clone_decision
|
22
|
+
VCR.use_cassette 'decisions/clone' do
|
23
|
+
client = local_client
|
24
|
+
cloned_decision = client.clone_decision(6, 14)
|
25
|
+
assert_equal 14, cloned_decision.parent_id
|
26
|
+
assert_equal 6, cloned_decision.parent_user_id
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
21
30
|
def test_publish_decision
|
22
31
|
VCR.use_cassette 'decisions/publish' do
|
23
32
|
client = local_client
|
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.3.
|
4
|
+
version: 0.3.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-04-
|
14
|
+
date: 2013-04-11 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: multi_json
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- test/cassettes/configuration/configuration.yml
|
95
95
|
- test/cassettes/configuration/explore.yml
|
96
96
|
- test/cassettes/decisions/analytics.yml
|
97
|
+
- test/cassettes/decisions/clone.yml
|
97
98
|
- test/cassettes/decisions/create.yml
|
98
99
|
- test/cassettes/decisions/destroy.yml
|
99
100
|
- test/cassettes/decisions/flag.yml
|
@@ -177,6 +178,7 @@ test_files:
|
|
177
178
|
- test/cassettes/configuration/configuration.yml
|
178
179
|
- test/cassettes/configuration/explore.yml
|
179
180
|
- test/cassettes/decisions/analytics.yml
|
181
|
+
- test/cassettes/decisions/clone.yml
|
180
182
|
- test/cassettes/decisions/create.yml
|
181
183
|
- test/cassettes/decisions/destroy.yml
|
182
184
|
- test/cassettes/decisions/flag.yml
|