papercallio 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/papercallio +58 -24
- data/lib/papercallio/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d6f9bfeadd5437de30a160eb21f3cf452b1debd
|
4
|
+
data.tar.gz: e56e2c855793bb97c3cbc3142c857710d4a524b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85dcc959243eacf5cc10e6a5fd4a8d42eaa73f9b95d6407babbd5009234724bb6ae0ae580b9ea4bae9540abce85432b73557d879f379dadbdd9978310c1c6387
|
7
|
+
data.tar.gz: fcccea69f1797f4077bb14b5d6a9730c4377feef16092df5cf2495b9382355c44fc2727278657c336be6b8483599d0116afdaf8351f71ab2c33759fa372adb0d
|
data/Gemfile.lock
CHANGED
data/bin/papercallio
CHANGED
@@ -2,10 +2,20 @@
|
|
2
2
|
require 'gli'
|
3
3
|
require 'papercallio'
|
4
4
|
require 'csv'
|
5
|
+
require 'yaml'
|
5
6
|
|
6
7
|
include GLI::App
|
7
8
|
|
8
|
-
program_desc
|
9
|
+
program_desc %(Command line interface for the papercall.io API
|
10
|
+
papercallio requires API access to download data.
|
11
|
+
API access is a paid feature, papercallio will not work with the free papercall plan.
|
12
|
+
To obtain your API token, go to the papercall website, click the events tab, choose your event,
|
13
|
+
then choose the Organisers link on the right hand side. On the list of organisers for your event your API
|
14
|
+
token will be listed under your name.
|
15
|
+
|
16
|
+
Once you have your API key export it in your shell
|
17
|
+
|
18
|
+
export PAPERCALL_API_TOKEN=abcdefghijklmnopqrstuvwxyz1234567890)
|
9
19
|
|
10
20
|
version Papercallio::VERSION
|
11
21
|
|
@@ -14,18 +24,20 @@ api_token = ENV['PAPERCALL_API_TOKEN']
|
|
14
24
|
subcommand_option_handling :normal
|
15
25
|
arguments :strict
|
16
26
|
|
17
|
-
desc 'Describe some switch here'
|
18
|
-
switch [:s,:switch]
|
19
|
-
|
20
27
|
desc 'The file path for output'
|
21
|
-
default_value '
|
28
|
+
default_value 'submissions.csv'
|
22
29
|
arg_name 'The file path (e.g. ./submissions.csv)'
|
23
|
-
flag [:f
|
30
|
+
flag [:f, :file]
|
24
31
|
|
25
|
-
desc
|
26
|
-
|
32
|
+
desc %(Return submissions in csv file.
|
33
|
+
Add your token as an environment variable for the API.
|
34
|
+
|
35
|
+
export PAPERCALL_API_TOKEN=abcdefghijklmnopqrstuvwxyz1234567890)
|
36
|
+
arg_name 'Arguments to manipulate the submissions returned'
|
27
37
|
command :submissions do |c|
|
28
38
|
c.switch 'needs_rating', :desc => 'Filter results needs rating. Default (false).'
|
39
|
+
c.switch 'include_feedback', :desc => 'Include the feedback for all submissions in the csv (Not currently implemented).'
|
40
|
+
c.switch 'include_ratings', :desc => 'Include the ratings for all submissions in the csv'
|
29
41
|
|
30
42
|
c.flag 'state', :default_value => nil,
|
31
43
|
:arg_name => 'state of submissions. ',
|
@@ -38,6 +50,7 @@ command :submissions do |c|
|
|
38
50
|
:desc => 'Sort results. Possible values are: state, rating, ratings_count, title, created_at, talk_format_id, audience_level, confidence'
|
39
51
|
|
40
52
|
c.action do |global_options,options,args|
|
53
|
+
puts global_options
|
41
54
|
pcc = PaperCallClient.new(api_token, options)
|
42
55
|
response = pcc.submissions
|
43
56
|
|
@@ -46,6 +59,7 @@ command :submissions do |c|
|
|
46
59
|
headerset = false
|
47
60
|
response.each do |submission|
|
48
61
|
line = {}
|
62
|
+
id = nil
|
49
63
|
submission.each do |field, value|
|
50
64
|
if value.is_a?(Hash)
|
51
65
|
value.each do |subfield, subvalue|
|
@@ -55,49 +69,71 @@ command :submissions do |c|
|
|
55
69
|
next
|
56
70
|
end
|
57
71
|
line[field] = value
|
72
|
+
id = value if field.eql? 'id'
|
58
73
|
headers << field unless headerset
|
59
74
|
end
|
75
|
+
|
76
|
+
if options[:include_feedback]
|
77
|
+
#puts "OK!"
|
78
|
+
#submission_feedback = pcc.feedback(id)
|
79
|
+
#puts submission_feedback
|
80
|
+
end
|
81
|
+
if options[:include_ratings]
|
82
|
+
submission_ratings = pcc.rating(id)
|
83
|
+
total_ratings = 0
|
84
|
+
individual_ratings = ''
|
85
|
+
raters = ''
|
86
|
+
submission_ratings.each do |rate|
|
87
|
+
rate.each do |rate_field, rate_value|
|
88
|
+
total_ratings += rate_value if rate_field == 'value'
|
89
|
+
individual_ratings << "#{rate_value}, " if rate_field == 'value'
|
90
|
+
raters << "#{rate_value['name']}, " if rate_field == 'user'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
line[:total_ratings] = total_ratings
|
94
|
+
line[:individual_ratings] = individual_ratings
|
95
|
+
line[:raters] = raters
|
96
|
+
headers.concat([:total_ratings, :individual_ratings, :raters]) unless headerset
|
97
|
+
end
|
60
98
|
headerset = true
|
61
99
|
submissions << line
|
62
100
|
line = {}
|
63
101
|
end
|
64
|
-
File.open(
|
102
|
+
File.open(global_options[:file], 'w') do |f|
|
65
103
|
f.puts headers.to_csv
|
66
104
|
submissions.each do |sub|
|
67
105
|
f.puts headers.map { |h| sub[h] }.to_csv
|
68
106
|
end
|
69
107
|
end
|
70
108
|
|
71
|
-
puts "submissions have been output to
|
109
|
+
puts "submissions have been output to #{global_options[:file]}"
|
72
110
|
end
|
73
111
|
end
|
74
112
|
|
75
|
-
desc 'Return event as
|
113
|
+
desc 'Return event as yaml'
|
76
114
|
arg_name 'No arguments'
|
77
115
|
command :event do |c|
|
78
116
|
c.action do |global_options,options,args|
|
79
117
|
pcc = PaperCallClient.new(api_token, {})
|
80
118
|
response = pcc.event
|
81
|
-
puts response
|
82
|
-
puts "event command ran"
|
119
|
+
puts response.parsed_response.to_yaml
|
83
120
|
end
|
84
121
|
end
|
85
122
|
|
86
|
-
desc 'Return submission as
|
123
|
+
desc 'Return a single submission as yaml'
|
87
124
|
arg_name "Arguments: 'id' identifier of the submission"
|
88
|
-
command :
|
125
|
+
command :submission do |c|
|
89
126
|
c.flag 'id', :default_value => 1,
|
90
127
|
:arg_name => 'papercall submission identifier',
|
91
128
|
:desc => 'identifier of the submission'
|
92
129
|
c.action do |global_options,options,args|
|
93
130
|
pcc = PaperCallClient.new(api_token, {})
|
94
|
-
response = pcc.
|
95
|
-
puts response
|
96
|
-
puts "submission for id: #{options[:id]} as json"
|
131
|
+
response = pcc.submission(options[:id])
|
132
|
+
puts response.parsed_response.to_yaml
|
97
133
|
end
|
98
134
|
end
|
99
135
|
|
100
|
-
desc 'Return ratings as
|
136
|
+
desc 'Return ratings for a single submission as yaml'
|
101
137
|
arg_name "Arguments: 'id' identifier of the submission"
|
102
138
|
command :rating do |c|
|
103
139
|
c.flag 'id', :default_value => 1,
|
@@ -106,12 +142,11 @@ command :rating do |c|
|
|
106
142
|
c.action do |global_options,options,args|
|
107
143
|
pcc = PaperCallClient.new(api_token, {})
|
108
144
|
response = pcc.rating(options[:id])
|
109
|
-
puts response
|
110
|
-
puts "ratings for id: #{options[:id]} as json"
|
145
|
+
puts response.parsed_response.to_yaml
|
111
146
|
end
|
112
147
|
end
|
113
148
|
|
114
|
-
desc 'Return feedback as
|
149
|
+
desc 'Return feedback for a single submission as yaml'
|
115
150
|
arg_name "Arguments: 'id' identifier of the submission"
|
116
151
|
command :feedback do |c|
|
117
152
|
c.flag 'id', :default_value => 1,
|
@@ -120,8 +155,7 @@ command :feedback do |c|
|
|
120
155
|
c.action do |global_options,options,args|
|
121
156
|
pcc = PaperCallClient.new(api_token, {})
|
122
157
|
response = pcc.feedback(options[:id])
|
123
|
-
puts response
|
124
|
-
puts "feedback for id: #{options[:id]} as json"
|
158
|
+
puts response.parsed_response.to_yaml
|
125
159
|
end
|
126
160
|
end
|
127
161
|
|
data/lib/papercallio/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: papercallio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aaronblythe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|