Class: Tester::ResponseTypesController
- Inherits:
-
BaseController
- Object
- BaseController
- Tester::ResponseTypesController
- Defined in:
- lib/tester/controllers/response_types_controller.rb
Overview
ResponseTypesController
Class Attribute Summary collapse
-
.instance ⇒ Object
Returns the value of attribute instance.
Attributes inherited from BaseController
Instance Method Summary collapse
-
#get_1123_date_time ⇒ Object
TODO: type endpoint description here.
-
#get_1123_date_time_array ⇒ Object
TODO: type endpoint description here.
-
#get_3339_datetime ⇒ Object
TODO: type endpoint description here.
-
#get_3339_datetime_array ⇒ Object
TODO: type endpoint description here.
-
#get_binary ⇒ Object
gets a binary object.
-
#get_boolean ⇒ Object
TODO: type endpoint description here.
-
#get_boolean_array ⇒ Object
TODO: type endpoint description here.
-
#get_date ⇒ Object
TODO: type endpoint description here.
-
#get_date_array ⇒ Object
TODO: type endpoint description here.
-
#get_dynamic ⇒ Object
TODO: type endpoint description here.
-
#get_dynamic_array ⇒ Object
TODO: type endpoint description here.
-
#get_headers ⇒ Object
TODO: type endpoint description here.
-
#get_int_enum ⇒ Object
TODO: type endpoint description here.
-
#get_int_enum_array ⇒ Object
TODO: type endpoint description here.
-
#get_integer ⇒ Object
Gets a integer response.
-
#get_integer_array ⇒ Object
Get an array of integers.
-
#get_long ⇒ Object
TODO: type endpoint description here.
-
#get_model ⇒ Object
TODO: type endpoint description here.
-
#get_model_array ⇒ Object
TODO: type endpoint description here.
-
#get_precision ⇒ Object
TODO: type endpoint description here.
-
#get_string_enum ⇒ Object
TODO: type endpoint description here.
-
#get_string_enum_array ⇒ Object
TODO: type endpoint description here.
-
#get_unix_date_time ⇒ Object
TODO: type endpoint description here.
-
#get_unix_date_time_array ⇒ Object
TODO: type endpoint description here.
- #instance ⇒ Object
Methods inherited from BaseController
#execute_request, #initialize, #validate_parameters, #validate_response
Constructor Details
This class inherits a constructor from Tester::BaseController
Class Attribute Details
.instance ⇒ Object
Returns the value of attribute instance.
12 13 14 |
# File 'lib/tester/controllers/response_types_controller.rb', line 12 def instance @instance end |
Instance Method Details
#get_1123_date_time ⇒ Object
TODO: type endpoint description here
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 |
# File 'lib/tester/controllers/response_types_controller.rb', line 603 def get_1123_date_time # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/1123datetime' _query_url = APIHelper.clean_url _query_builder # Prepare and execute HttpRequest. _request = @http_client.get( _query_url ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. DateTime.httpdate(_context.response.raw_body) end |
#get_1123_date_time_array ⇒ Object
TODO: type endpoint description here
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 |
# File 'lib/tester/controllers/response_types_controller.rb', line 647 def get_1123_date_time_array # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/1123datetime' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, { 'array' => true }, array_serialization: Configuration.array_serialization ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = @http_client.get( _query_url, headers: _headers ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. decoded = APIHelper.json_deserialize(_context.response.raw_body) decoded.map { |element| DateTime.httpdate(element) } end |
#get_3339_datetime ⇒ Object
TODO: type endpoint description here
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
# File 'lib/tester/controllers/response_types_controller.rb', line 471 def get_3339_datetime # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/3339datetime' _query_url = APIHelper.clean_url _query_builder # Prepare and execute HttpRequest. _request = @http_client.get( _query_url ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. DateTime.rfc3339(_context.response.raw_body) end |
#get_3339_datetime_array ⇒ Object
TODO: type endpoint description here
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
# File 'lib/tester/controllers/response_types_controller.rb', line 493 def get_3339_datetime_array # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/3339datetime' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, { 'array' => true }, array_serialization: Configuration.array_serialization ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = @http_client.get( _query_url, headers: _headers ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. decoded = APIHelper.json_deserialize(_context.response.raw_body) decoded.map { |element| DateTime.rfc3339(element) } end |
#get_binary ⇒ Object
gets a binary object
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/tester/controllers/response_types_controller.rb', line 322 def get_binary # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/binary' _query_url = APIHelper.clean_url _query_builder # Prepare and execute HttpRequest. _request = @http_client.get( _query_url ) _context = execute_request(_request, binary: true) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. _context.response.raw_body end |
#get_boolean ⇒ Object
TODO: type endpoint description here
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/tester/controllers/response_types_controller.rb', line 529 def get_boolean # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/boolean' _query_url = APIHelper.clean_url _query_builder # Prepare and execute HttpRequest. _request = @http_client.get( _query_url ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. _context.response.raw_body.to_bool end |
#get_boolean_array ⇒ Object
TODO: type endpoint description here
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 |
# File 'lib/tester/controllers/response_types_controller.rb', line 551 def get_boolean_array # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/boolean' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, { 'array' => true }, array_serialization: Configuration.array_serialization ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = @http_client.get( _query_url, headers: _headers ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. decoded = APIHelper.json_deserialize(_context.response.raw_body) decoded end |
#get_date ⇒ Object
TODO: type endpoint description here
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/tester/controllers/response_types_controller.rb', line 57 def get_date # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/date' _query_url = APIHelper.clean_url _query_builder # Prepare and execute HttpRequest. _request = @http_client.get( _query_url ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. Date.iso8601(_context.response.raw_body) end |
#get_date_array ⇒ Object
TODO: type endpoint description here
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/tester/controllers/response_types_controller.rb', line 21 def get_date_array # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/date' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, { 'array' => true }, array_serialization: Configuration.array_serialization ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = @http_client.get( _query_url, headers: _headers ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. decoded = APIHelper.json_deserialize(_context.response.raw_body) decoded.map { |element| Date.iso8601(element) } end |
#get_dynamic ⇒ Object
TODO: type endpoint description here
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/tester/controllers/response_types_controller.rb', line 402 def get_dynamic # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/dynamic' _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = @http_client.get( _query_url, headers: _headers ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. decoded = APIHelper.json_deserialize(_context.response.raw_body) unless _context.response.raw_body.nil? || _context.response.raw_body.to_s.strip.empty? decoded end |
#get_dynamic_array ⇒ Object
TODO: type endpoint description here
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 |
# File 'lib/tester/controllers/response_types_controller.rb', line 433 def get_dynamic_array # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/dynamic' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, { 'array' => true }, array_serialization: Configuration.array_serialization ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = @http_client.get( _query_url, headers: _headers ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. decoded = APIHelper.json_deserialize(_context.response.raw_body) unless _context.response.raw_body.nil? || _context.response.raw_body.to_s.strip.empty? decoded end |
#get_headers ⇒ Object
TODO: type endpoint description here
587 588 589 590 591 592 593 594 595 596 597 598 599 |
# File 'lib/tester/controllers/response_types_controller.rb', line 587 def get_headers # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/headers' _query_url = APIHelper.clean_url _query_builder # Prepare and execute HttpRequest. _request = @http_client.get( _query_url ) _context = execute_request(_request) validate_response(_context) end |
#get_int_enum ⇒ Object
TODO: type endpoint description here
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/tester/controllers/response_types_controller.rb', line 234 def get_int_enum # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/enum' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, { 'type' => 'int' }, array_serialization: Configuration.array_serialization ) _query_url = APIHelper.clean_url _query_builder # Prepare and execute HttpRequest. _request = @http_client.get( _query_url ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. _context.response.raw_body.to_i end |
#get_int_enum_array ⇒ Object
TODO: type endpoint description here
263 264 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 |
# File 'lib/tester/controllers/response_types_controller.rb', line 263 def get_int_enum_array # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/enum' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, { 'array' => true, 'type' => 'int' }, array_serialization: Configuration.array_serialization ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = @http_client.get( _query_url, headers: _headers ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. decoded = APIHelper.json_deserialize(_context.response.raw_body) decoded end |
#get_integer ⇒ Object
Gets a integer response
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File 'lib/tester/controllers/response_types_controller.rb', line 344 def get_integer # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/integer' _query_url = APIHelper.clean_url _query_builder # Prepare and execute HttpRequest. _request = @http_client.get( _query_url ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. _context.response.raw_body.to_i end |
#get_integer_array ⇒ Object
Get an array of integers.
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/tester/controllers/response_types_controller.rb', line 366 def get_integer_array # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/integer' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, { 'array' => true }, array_serialization: Configuration.array_serialization ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = @http_client.get( _query_url, headers: _headers ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. decoded = APIHelper.json_deserialize(_context.response.raw_body) decoded end |
#get_long ⇒ Object
TODO: type endpoint description here
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/tester/controllers/response_types_controller.rb', line 79 def get_long # Prepare query url. _query_builder = Configuration.get_base_uri( Configuration::Server::DEFAULT ) _query_builder << '/response/long' _query_url = APIHelper.clean_url _query_builder # Prepare and execute HttpRequest. _request = @http_client.get( _query_url ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. _context.response.raw_body.to_i end |
#get_model ⇒ Object
TODO: type endpoint description here
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/tester/controllers/response_types_controller.rb', line 103 def get_model # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/model' _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = @http_client.get( _query_url, headers: _headers ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. decoded = APIHelper.json_deserialize(_context.response.raw_body) Person.from_hash(decoded) end |
#get_model_array ⇒ Object
TODO: type endpoint description here
198 199 200 201 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 |
# File 'lib/tester/controllers/response_types_controller.rb', line 198 def get_model_array # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/model' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, { 'array' => true }, array_serialization: Configuration.array_serialization ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = @http_client.get( _query_url, headers: _headers ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. decoded = APIHelper.json_deserialize(_context.response.raw_body) decoded.map { |element| Person.from_hash(element) } end |
#get_precision ⇒ Object
TODO: type endpoint description here
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/tester/controllers/response_types_controller.rb', line 300 def get_precision # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/precision' _query_url = APIHelper.clean_url _query_builder # Prepare and execute HttpRequest. _request = @http_client.get( _query_url ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. _context.response.raw_body.to_f end |
#get_string_enum ⇒ Object
TODO: type endpoint description here
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/tester/controllers/response_types_controller.rb', line 169 def get_string_enum # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/enum' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, { 'type' => 'string' }, array_serialization: Configuration.array_serialization ) _query_url = APIHelper.clean_url _query_builder # Prepare and execute HttpRequest. _request = @http_client.get( _query_url ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. _context.response.raw_body end |
#get_string_enum_array ⇒ Object
TODO: type endpoint description here
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/tester/controllers/response_types_controller.rb', line 132 def get_string_enum_array # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/enum' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, { 'array' => true, 'type' => 'string' }, array_serialization: Configuration.array_serialization ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = @http_client.get( _query_url, headers: _headers ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. decoded = APIHelper.json_deserialize(_context.response.raw_body) decoded end |
#get_unix_date_time ⇒ Object
TODO: type endpoint description here
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 |
# File 'lib/tester/controllers/response_types_controller.rb', line 625 def get_unix_date_time # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/unixdatetime' _query_url = APIHelper.clean_url _query_builder # Prepare and execute HttpRequest. _request = @http_client.get( _query_url ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. Time.at(_context.response.raw_body.to_i).utc.to_datetime end |
#get_unix_date_time_array ⇒ Object
TODO: type endpoint description here
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 |
# File 'lib/tester/controllers/response_types_controller.rb', line 683 def get_unix_date_time_array # Prepare query url. _query_builder = Configuration.get_base_uri _query_builder << '/response/unixdatetime' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, { 'array' => true }, array_serialization: Configuration.array_serialization ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = @http_client.get( _query_url, headers: _headers ) _context = execute_request(_request) # Validate response against endpoint and global error codes. return nil if _context.response.status_code == 404 validate_response(_context) # Return appropriate response type. decoded = APIHelper.json_deserialize(_context.response.raw_body) decoded.map { |element| Time.at(element).utc.to_datetime } end |
#instance ⇒ Object
15 16 17 |
# File 'lib/tester/controllers/response_types_controller.rb', line 15 def instance self.class.instance end |