Class: Pollster::Api
- Inherits:
-
Object
- Object
- Pollster::Api
- Defined in:
- lib/pollster/api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#charts_get(opts = {}) ⇒ InlineResponse200
Charts Returns a list of Charts, ordered by creation date (newest first).
-
#charts_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse200, Fixnum, Hash)>
Charts Returns a list of Charts, ordered by creation date (newest first).
-
#charts_slug_get(slug, opts = {}) ⇒ Chart
Chart A Chart is chosen by Pollster editors.
-
#charts_slug_get_with_http_info(slug, opts = {}) ⇒ Array<(Chart, Fixnum, Hash)>
Chart A Chart is chosen by Pollster editors.
-
#charts_slug_pollster_chart_poll_questions_tsv_get(slug, opts = {}) ⇒ PollsterChartPollQuestions
One row per poll plotted on a Chart Derived data presented on a Pollster Chart.
-
#charts_slug_pollster_chart_poll_questions_tsv_get_with_http_info(slug, opts = {}) ⇒ Array<(PollsterChartPollQuestions, Fixnum, Hash)>
One row per poll plotted on a Chart Derived data presented on a Pollster Chart.
-
#charts_slug_pollster_trendlines_tsv_get(slug, opts = {}) ⇒ ChartPollsterTrendlines
Estimates of what the polls suggest about trends Derived data presented on a Pollster Chart.
-
#charts_slug_pollster_trendlines_tsv_get_with_http_info(slug, opts = {}) ⇒ Array<(ChartPollsterTrendlines, Fixnum, Hash)>
Estimates of what the polls suggest about trends Derived data presented on a Pollster Chart.
-
#initialize(api_client = ApiClient.default) ⇒ Api
constructor
A new instance of Api.
-
#polls_get(opts = {}) ⇒ InlineResponse2003
Polls A Poll on Pollster is a collection of questions and responses published by a reputable survey house.
-
#polls_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse2003, Fixnum, Hash)>
Polls A Poll on Pollster is a collection of questions and responses published by a reputable survey house.
-
#polls_slug_get(slug, opts = {}) ⇒ Poll
Poll A Poll on Pollster is a collection of questions and responses published by a reputable survey house.
-
#polls_slug_get_with_http_info(slug, opts = {}) ⇒ Array<(Poll, Fixnum, Hash)>
Poll A Poll on Pollster is a collection of questions and responses published by a reputable survey house.
-
#questions_get(opts = {}) ⇒ InlineResponse2004
Questions Returns a list of Questions.
-
#questions_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse2004, Fixnum, Hash)>
Questions Returns a list of Questions.
-
#questions_slug_get(slug, opts = {}) ⇒ Question
Question A Question is chosen by Pollster editors.
-
#questions_slug_get_with_http_info(slug, opts = {}) ⇒ Array<(Question, Fixnum, Hash)>
Question A Question is chosen by Pollster editors.
-
#questions_slug_poll_responses_clean_tsv_get(slug, opts = {}) ⇒ QuestionPollResponsesClean
One row of response values per PollQuestion+Subpopulation concerning the given Question We include one TSV column per response label.
-
#questions_slug_poll_responses_clean_tsv_get_with_http_info(slug, opts = {}) ⇒ Array<(QuestionPollResponsesClean, Fixnum, Hash)>
One row of response values per PollQuestion+Subpopulation concerning the given Question We include one TSV column per response label.
-
#questions_slug_poll_responses_raw_tsv_get(slug, opts = {}) ⇒ QuestionPollResponsesRaw
One row per PollQuestion+Subpopulation+Response concerning the given Question (Large) Raw data from which we derived ‘poll-responses-clean.tsv`.
-
#questions_slug_poll_responses_raw_tsv_get_with_http_info(slug, opts = {}) ⇒ Array<(QuestionPollResponsesRaw, Fixnum, Hash)>
One row per PollQuestion+Subpopulation+Response concerning the given Question (Large) Raw data from which we derived `poll-responses-clean.tsv`.
-
#tags_get(opts = {}) ⇒ Array<Tag>
Tags Returns the list of Tags.
-
#tags_get_with_http_info(opts = {}) ⇒ Array<(Array<Tag>, Fixnum, Hash)>
Tags Returns the list of Tags.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
5 6 7 |
# File 'lib/pollster/api.rb', line 5 def api_client @api_client end |
Instance Method Details
#charts_get(opts = {}) ⇒ InlineResponse200
Charts Returns a list of Charts, ordered by creation date (newest first). A Chart is chosen by Pollster editors. One example is "Obama job approval - Democrats". It is always based upon a single Question. Users should strongly consider basing their analysis on Questions instead. Charts are derived data; Pollster editors publish them and change them as editorial priorities change.
18 19 20 21 |
# File 'lib/pollster/api.rb', line 18 def charts_get(opts = {}) data, _status_code, _headers = charts_get_with_http_info(opts) return data end |
#charts_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse200, Fixnum, Hash)>
Charts Returns a list of Charts, ordered by creation date (newest first). A Chart is chosen by Pollster editors. One example is "Obama job approval - Democrats". It is always based upon a single Question. Users should strongly consider basing their analysis on Questions instead. Charts are derived data; Pollster editors publish them and change them as editorial priorities change.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/pollster/api.rb', line 30 def charts_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: Api.charts_get ..." end # resource path local_var_path = "/charts".sub('{format}','json') # query parameters query_params = {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil? query_params[:'election_date'] = opts[:'election_date'] if !opts[:'election_date'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json', 'application/xml'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = [] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'InlineResponse200') if @api_client.config.debugging @api_client.config.logger.debug "API called: Api#charts_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#charts_slug_get(slug, opts = {}) ⇒ Chart
Chart A Chart is chosen by Pollster editors. One example is "Obama job approval - Democrats". It is always based upon a single Question. Users should strongly consider basing their analysis on Questions instead. Charts are derived data; Pollster editors publish them and change them as editorial priorities change.
78 79 80 81 |
# File 'lib/pollster/api.rb', line 78 def charts_slug_get(slug, opts = {}) data, _status_code, _headers = charts_slug_get_with_http_info(slug, opts) return data end |
#charts_slug_get_with_http_info(slug, opts = {}) ⇒ Array<(Chart, Fixnum, Hash)>
Chart A Chart is chosen by Pollster editors. One example is "Obama job approval - Democrats". It is always based upon a single Question. Users should strongly consider basing their analysis on Questions instead. Charts are derived data; Pollster editors publish them and change them as editorial priorities change.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/pollster/api.rb', line 88 def charts_slug_get_with_http_info(slug, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: Api.charts_slug_get ..." end # verify the required parameter 'slug' is set fail ArgumentError, "Missing the required parameter 'slug' when calling Api.charts_slug_get" if slug.nil? # resource path local_var_path = "/charts/{slug}".sub('{format}','json').sub('{' + 'slug' + '}', slug.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json', 'application/xml'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = [] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Chart') if @api_client.config.debugging @api_client.config.logger.debug "API called: Api#charts_slug_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#charts_slug_pollster_chart_poll_questions_tsv_get(slug, opts = {}) ⇒ PollsterChartPollQuestions
One row per poll plotted on a Chart Derived data presented on a Pollster Chart. Rules for which polls and responses are plotted on a chart can shift over time. Here are some examples of behaviors Pollster has used in the past: * We’ve omitted "Registered Voters" from a chart when "Likely Voters" responded to the same poll question. * We’ve omitted poll questions that asked about Gary Johnson on a chart about Trump v Clinton. * We’ve omitted polls when their date ranges overlapped. * We’ve omitted labels (and their responses) for dark-horse candidates. In short: this endpoint is about Pollster, not the polls. For complete data, use a TSV from the Questions API. The response follows the exact same format as ‘questions/slug/poll-responses-clean.tsv`, which you should strongly consider before settling on the Chart TSV.
135 136 137 138 |
# File 'lib/pollster/api.rb', line 135 def charts_slug_pollster_chart_poll_questions_tsv_get(slug, opts = {}) data, _status_code, _headers = charts_slug_pollster_chart_poll_questions_tsv_get_with_http_info(slug, opts) return data end |
#charts_slug_pollster_chart_poll_questions_tsv_get_with_http_info(slug, opts = {}) ⇒ Array<(PollsterChartPollQuestions, Fixnum, Hash)>
One row per poll plotted on a Chart Derived data presented on a Pollster Chart. Rules for which polls and responses are plotted on a chart can shift over time. Here are some examples of behaviors Pollster has used in the past: * We've omitted "Registered Voters" from a chart when "Likely Voters" responded to the same poll question. * We've omitted poll questions that asked about Gary Johnson on a chart about Trump v Clinton. * We've omitted polls when their date ranges overlapped. * We've omitted labels (and their responses) for dark-horse candidates. In short: this endpoint is about Pollster, not the polls. For complete data, use a TSV from the Questions API. The response follows the exact same format as `questions/slug/poll-responses-clean.tsv`, which you should strongly consider before settling on the Chart TSV.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/pollster/api.rb', line 145 def charts_slug_pollster_chart_poll_questions_tsv_get_with_http_info(slug, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: Api.charts_slug_pollster_chart_poll_questions_tsv_get ..." end # verify the required parameter 'slug' is set fail ArgumentError, "Missing the required parameter 'slug' when calling Api.charts_slug_pollster_chart_poll_questions_tsv_get" if slug.nil? # resource path local_var_path = "/charts/{slug}/pollster-chart-poll-questions.tsv".sub('{format}','json').sub('{' + 'slug' + '}', slug.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['text/tab-separated-values'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = [] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api_tsv(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'PollsterChartPollQuestions') if @api_client.config.debugging @api_client.config.logger.debug "API called: Api#charts_slug_pollster_chart_poll_questions_tsv_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#charts_slug_pollster_trendlines_tsv_get(slug, opts = {}) ⇒ ChartPollsterTrendlines
Estimates of what the polls suggest about trends Derived data presented on a Pollster Chart. The trendlines on a Pollster chart don’t add up to 100: we calculate each label’s trendline separately. Use the ‘charts/slug` response’s ‘chart.pollster_estimates.algorithm` to find the algorithm Pollster used to generate these estimates. Pollster recalculates trendlines every time a new poll is entered. It also recalculates trendlines daily if they use the `bayesian-kallman` algorithm, because that algorithm’s output changes depending on the end date.
192 193 194 195 |
# File 'lib/pollster/api.rb', line 192 def charts_slug_pollster_trendlines_tsv_get(slug, opts = {}) data, _status_code, _headers = charts_slug_pollster_trendlines_tsv_get_with_http_info(slug, opts) return data end |
#charts_slug_pollster_trendlines_tsv_get_with_http_info(slug, opts = {}) ⇒ Array<(ChartPollsterTrendlines, Fixnum, Hash)>
Estimates of what the polls suggest about trends Derived data presented on a Pollster Chart. The trendlines on a Pollster chart don't add up to 100: we calculate each label's trendline separately. Use the `charts/slug` response's `chart.pollster_estimates.algorithm` to find the algorithm Pollster used to generate these estimates. Pollster recalculates trendlines every time a new poll is entered. It also recalculates trendlines daily if they use the `bayesian-kallman` algorithm, because that algorithm's output changes depending on the end date.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/pollster/api.rb', line 202 def charts_slug_pollster_trendlines_tsv_get_with_http_info(slug, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: Api.charts_slug_pollster_trendlines_tsv_get ..." end # verify the required parameter 'slug' is set fail ArgumentError, "Missing the required parameter 'slug' when calling Api.charts_slug_pollster_trendlines_tsv_get" if slug.nil? # resource path local_var_path = "/charts/{slug}/pollster-trendlines.tsv".sub('{format}','json').sub('{' + 'slug' + '}', slug.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['text/tab-separated-values'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = [] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api_tsv(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ChartPollsterTrendlines') if @api_client.config.debugging @api_client.config.logger.debug "API called: Api#charts_slug_pollster_trendlines_tsv_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#polls_get(opts = {}) ⇒ InlineResponse2003
Polls A Poll on Pollster is a collection of questions and responses published by a reputable survey house. This endpoint provides raw data from the survey house, plus Pollster-provided metadata about each question. Pollster editors don’t include every question when they enter Polls, and they don’t necessarily enter every subpopulation for the responses they do enter. They make editorial decisions about which questions belong in the database. The response will contain a maximum of 25 Poll objects, even if the database contains more than 25 polls. Use the ‘next_cursor` parameter to fetch the rest, 25 Polls at a time.
252 253 254 255 |
# File 'lib/pollster/api.rb', line 252 def polls_get(opts = {}) data, _status_code, _headers = polls_get_with_http_info(opts) return data end |
#polls_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse2003, Fixnum, Hash)>
Polls A Poll on Pollster is a collection of questions and responses published by a reputable survey house. This endpoint provides raw data from the survey house, plus Pollster-provided metadata about each question. Pollster editors don't include every question when they enter Polls, and they don't necessarily enter every subpopulation for the responses they do enter. They make editorial decisions about which questions belong in the database. The response will contain a maximum of 25 Poll objects, even if the database contains more than 25 polls. Use the `next_cursor` parameter to fetch the rest, 25 Polls at a time.
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/pollster/api.rb', line 265 def polls_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: Api.polls_get ..." end if opts[:'sort'] && !['created_at', 'updated_at'].include?(opts[:'sort']) fail ArgumentError, 'invalid value for "sort", must be one of created_at, updated_at' end # resource path local_var_path = "/polls".sub('{format}','json') # query parameters query_params = {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil? query_params[:'question'] = opts[:'question'] if !opts[:'question'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json', 'application/xml'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = [] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'InlineResponse2003') if @api_client.config.debugging @api_client.config.logger.debug "API called: Api#polls_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#polls_slug_get(slug, opts = {}) ⇒ Poll
Poll A Poll on Pollster is a collection of questions and responses published by a reputable survey house. This endpoint provides raw data from the survey house, plus Pollster-provided metadata about each question. Pollster editors don’t include every question when they enter Polls, and they don’t necessarily enter every subpopulation for the responses they do enter. They make editorial decisions about which questions belong in the database.
317 318 319 320 |
# File 'lib/pollster/api.rb', line 317 def polls_slug_get(slug, opts = {}) data, _status_code, _headers = polls_slug_get_with_http_info(slug, opts) return data end |
#polls_slug_get_with_http_info(slug, opts = {}) ⇒ Array<(Poll, Fixnum, Hash)>
Poll A Poll on Pollster is a collection of questions and responses published by a reputable survey house. This endpoint provides raw data from the survey house, plus Pollster-provided metadata about each question. Pollster editors don't include every question when they enter Polls, and they don't necessarily enter every subpopulation for the responses they do enter. They make editorial decisions about which questions belong in the database.
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/pollster/api.rb', line 327 def polls_slug_get_with_http_info(slug, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: Api.polls_slug_get ..." end # verify the required parameter 'slug' is set fail ArgumentError, "Missing the required parameter 'slug' when calling Api.polls_slug_get" if slug.nil? # resource path local_var_path = "/polls/{slug}".sub('{format}','json').sub('{' + 'slug' + '}', slug.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json', 'application/xml'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = [] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Poll') if @api_client.config.debugging @api_client.config.logger.debug "API called: Api#polls_slug_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#questions_get(opts = {}) ⇒ InlineResponse2004
Questions Returns a list of Questions. A Question is chosen by Pollster editors. One example is "Obama job approval". Different survey houses may publish varying phrasings ("Do you approve or disapprove" vs "What do you think of the job") and prompt readers with varying responses (one poll might have "Approve" and "Disapprove"; another poll might have "Strongly approve" and "Somewhat approve"). Those variations do not appear in this API endpoint.
376 377 378 379 |
# File 'lib/pollster/api.rb', line 376 def questions_get(opts = {}) data, _status_code, _headers = questions_get_with_http_info(opts) return data end |
#questions_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse2004, Fixnum, Hash)>
Questions Returns a list of Questions. A Question is chosen by Pollster editors. One example is "Obama job approval". Different survey houses may publish varying phrasings ("Do you approve or disapprove" vs "What do you think of the job") and prompt readers with varying responses (one poll might have "Approve" and "Disapprove"; another poll might have "Strongly approve" and "Somewhat approve"). Those variations do not appear in this API endpoint.
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
# File 'lib/pollster/api.rb', line 388 def questions_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: Api.questions_get ..." end # resource path local_var_path = "/questions".sub('{format}','json') # query parameters query_params = {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil? query_params[:'election_date'] = opts[:'election_date'] if !opts[:'election_date'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json', 'application/xml'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = [] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'InlineResponse2004') if @api_client.config.debugging @api_client.config.logger.debug "API called: Api#questions_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#questions_slug_get(slug, opts = {}) ⇒ Question
Question A Question is chosen by Pollster editors. One example is "Obama job approval". Different survey houses may publish varying phrasings ("Do you approve or disapprove" vs "What do you think of the job") and prompt readers with varying responses (one poll might have "Approve" and "Disapprove"; another poll might have "Strongly approve" and "Somewhat approve"). Those variations do not appear in this API endpoint.
436 437 438 439 |
# File 'lib/pollster/api.rb', line 436 def questions_slug_get(slug, opts = {}) data, _status_code, _headers = questions_slug_get_with_http_info(slug, opts) return data end |
#questions_slug_get_with_http_info(slug, opts = {}) ⇒ Array<(Question, Fixnum, Hash)>
Question A Question is chosen by Pollster editors. One example is "Obama job approval". Different survey houses may publish varying phrasings ("Do you approve or disapprove" vs "What do you think of the job") and prompt readers with varying responses (one poll might have "Approve" and "Disapprove"; another poll might have "Strongly approve" and "Somewhat approve"). Those variations do not appear in this API endpoint.
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 |
# File 'lib/pollster/api.rb', line 446 def questions_slug_get_with_http_info(slug, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: Api.questions_slug_get ..." end # verify the required parameter 'slug' is set fail ArgumentError, "Missing the required parameter 'slug' when calling Api.questions_slug_get" if slug.nil? # resource path local_var_path = "/questions/{slug}".sub('{format}','json').sub('{' + 'slug' + '}', slug.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json', 'application/xml'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = [] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Question') if @api_client.config.debugging @api_client.config.logger.debug "API called: Api#questions_slug_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#questions_slug_poll_responses_clean_tsv_get(slug, opts = {}) ⇒ QuestionPollResponsesClean
One row of response values per PollQuestion+Subpopulation concerning the given Question We include one TSV column per response label. See ‘questions/slug` for the Question’s list of response labels, which are chosen by Pollster editors. Each row represents a single PollQuestion+Subpopulation. The value for each label column is the sum of the PollQuestion+Subpopulation responses that map to that ‘pollster_label`. For instance, on a hypothetical row, the `Approve` column might be the sum of that poll’s ‘Strongly Approve` and `Somewhat Approve`. After the first TSV columns – which are always response labels – the next column will be `poll_slug`. `poll_slug` and subsequent columns are described in this API documentation. During the lifetime of a Question, Pollster editors may add, rename or reorder response labels. Such edits will change the TSV column headers. Column headers after `poll_slug` are never reordered or edited (but we may add new column headers). Sometimes a Poll may ask the same Question twice, leading to two similar rows with different values. Those rows will differ by `question_text` or by the set of response labels that have values.
493 494 495 496 |
# File 'lib/pollster/api.rb', line 493 def questions_slug_poll_responses_clean_tsv_get(slug, opts = {}) data, _status_code, _headers = questions_slug_poll_responses_clean_tsv_get_with_http_info(slug, opts) return data end |
#questions_slug_poll_responses_clean_tsv_get_with_http_info(slug, opts = {}) ⇒ Array<(QuestionPollResponsesClean, Fixnum, Hash)>
One row of response values per PollQuestion+Subpopulation concerning the given Question We include one TSV column per response label. See `questions/slug` for the Question's list of response labels, which are chosen by Pollster editors. Each row represents a single PollQuestion+Subpopulation. The value for each label column is the sum of the PollQuestion+Subpopulation responses that map to that `pollster_label`. For instance, on a hypothetical row, the `Approve` column might be the sum of that poll's `Strongly Approve` and `Somewhat Approve`. After the first TSV columns – which are always response labels – the next column will be `poll_slug`. `poll_slug` and subsequent columns are described in this API documentation. During the lifetime of a Question, Pollster editors may add, rename or reorder response labels. Such edits will change the TSV column headers. Column headers after `poll_slug` are never reordered or edited (but we may add new column headers). Sometimes a Poll may ask the same Question twice, leading to two similar rows with different values. Those rows will differ by `question_text` or by the set of response labels that have values.
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 |
# File 'lib/pollster/api.rb', line 503 def questions_slug_poll_responses_clean_tsv_get_with_http_info(slug, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: Api.questions_slug_poll_responses_clean_tsv_get ..." end # verify the required parameter 'slug' is set fail ArgumentError, "Missing the required parameter 'slug' when calling Api.questions_slug_poll_responses_clean_tsv_get" if slug.nil? # resource path local_var_path = "/questions/{slug}/poll-responses-clean.tsv".sub('{format}','json').sub('{' + 'slug' + '}', slug.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['text/tab-separated-values'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = [] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api_tsv(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'QuestionPollResponsesClean') if @api_client.config.debugging @api_client.config.logger.debug "API called: Api#questions_slug_poll_responses_clean_tsv_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#questions_slug_poll_responses_raw_tsv_get(slug, opts = {}) ⇒ QuestionPollResponsesRaw
One row per PollQuestion+Subpopulation+Response concerning the given Question (Large) Raw data from which we derived ‘poll-responses-clean.tsv`. Each row represents a single PollQuestion+Subpopulation+Response. See the Poll API for a description of these terms. Group results by `(poll_slug, subpopulation, question_text)`: that’s how the survey houses group them. This response can be several megabytes large. We encourage you to consider ‘poll-responses-clean.tsv` instead.
550 551 552 553 |
# File 'lib/pollster/api.rb', line 550 def questions_slug_poll_responses_raw_tsv_get(slug, opts = {}) data, _status_code, _headers = questions_slug_poll_responses_raw_tsv_get_with_http_info(slug, opts) return data end |
#questions_slug_poll_responses_raw_tsv_get_with_http_info(slug, opts = {}) ⇒ Array<(QuestionPollResponsesRaw, Fixnum, Hash)>
One row per PollQuestion+Subpopulation+Response concerning the given Question (Large) Raw data from which we derived `poll-responses-clean.tsv`. Each row represents a single PollQuestion+Subpopulation+Response. See the Poll API for a description of these terms. Group results by `(poll_slug, subpopulation, question_text)`: that's how the survey houses group them. This response can be several megabytes large. We encourage you to consider `poll-responses-clean.tsv` instead.
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 |
# File 'lib/pollster/api.rb', line 560 def questions_slug_poll_responses_raw_tsv_get_with_http_info(slug, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: Api.questions_slug_poll_responses_raw_tsv_get ..." end # verify the required parameter 'slug' is set fail ArgumentError, "Missing the required parameter 'slug' when calling Api.questions_slug_poll_responses_raw_tsv_get" if slug.nil? # resource path local_var_path = "/questions/{slug}/poll-responses-raw.tsv".sub('{format}','json').sub('{' + 'slug' + '}', slug.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['text/tab-separated-values'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = [] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api_tsv(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'QuestionPollResponsesRaw') if @api_client.config.debugging @api_client.config.logger.debug "API called: Api#questions_slug_poll_responses_raw_tsv_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#tags_get(opts = {}) ⇒ Array<Tag>
Tags Returns the list of Tags. A Tag can apply to any number of Charts and Questions; Charts and Questions, in turn, can have any number of Tags. Tags all look ‘like-this`: lowercase letters, numbers and hyphens.
606 607 608 609 |
# File 'lib/pollster/api.rb', line 606 def (opts = {}) data, _status_code, _headers = (opts) return data end |
#tags_get_with_http_info(opts = {}) ⇒ Array<(Array<Tag>, Fixnum, Hash)>
Tags Returns the list of Tags. A Tag can apply to any number of Charts and Questions; Charts and Questions, in turn, can have any number of Tags. Tags all look `like-this`: lowercase letters, numbers and hyphens.
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 |
# File 'lib/pollster/api.rb', line 615 def (opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: Api.tags_get ..." end # resource path local_var_path = "/tags".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json', 'application/xml'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = [] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array<Tag>') if @api_client.config.debugging @api_client.config.logger.debug "API called: Api#tags_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |