blob: 1ab9ea8ace24f1fd92e0432913d3ab6abe8eeb5f [file] [log] [blame]
Joe Gregorio652898b2011-05-02 21:07:43 -04001# version: v1
2# scope: https://www.googleapis.com/auth/moderator
3# title: Simple command-line example for Moderator.
4# description: Command-line application that exercises the Google Moderator API.
5
6 # Create a new Moderator series.
7 series_body = {
8 "description": "Share and rank tips for eating healthy and cheap!",
9 "name": "Eating Healthy & Cheap",
10 "videoSubmissionAllowed": False
11 }
12 series = service.series().insert(body=series_body).execute()
13 print "Created a new series"
14
15 # Create a new Moderator topic in that series.
16 topic_body = {
17 "description": "Share your ideas on eating healthy!",
18 "name": "Ideas",
19 "presenter": "liz"
20 }
21 topic = service.topics().insert(seriesId=series['id']['seriesId'],
22 body=topic_body).execute()
23 print "Created a new topic"
24
25 # Create a new Submission in that topic.
26 submission_body = {
27 "attachmentUrl": "http://www.youtube.com/watch?v=1a1wyc5Xxpg",
28 "attribution": {
29 "displayName": "Bashan",
30 "location": "Bainbridge Island, WA"
31 },
32 "text": "Charlie Ayers @ Google"
33 }
34 submission = service.submissions().insert(seriesId=topic['id']['seriesId'],
35 topicId=topic['id']['topicId'], body=submission_body).execute()
36 print "Inserted a new submisson on the topic"
37
38 # Vote on that newly added Submission.
39 vote_body = {
40 "vote": "PLUS"
41 }
42 service.votes().insert(seriesId=topic['id']['seriesId'],
43 submissionId=submission['id']['submissionId'],
44 body=vote_body)
45 print "Voted on the submission"
46