Skip to content

Commit adcf54b

Browse files
[ruby] document the *_with_http_info methods (#8094)
1 parent 38dbcdd commit adcf54b

File tree

118 files changed

+1877
-448
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+1877
-448
lines changed

modules/openapi-generator/src/main/resources/ruby-client/api_doc.mustache

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@ All URIs are relative to *{{basePath}}*
1717

1818
## {{operationId}}
1919

20-
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}
20+
> {{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}} {{/returnType}}{{operationId}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}
2121

2222
{{{summary}}}{{#notes}}
2323

2424
{{{notes}}}{{/notes}}
2525

26-
### Example
26+
### Examples
2727

2828
```ruby
29-
# load the gem
3029
require '{{{gemName}}}'
3130
{{#hasAuthMethods}}
3231
# setup authorization
@@ -60,11 +59,31 @@ opts = {
6059
{{/optionalParams}}
6160

6261
begin
63-
{{#summary}} #{{{.}}}
64-
{{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}{{#returnType}}
65-
p result{{/returnType}}
62+
{{#summary}}# {{{.}}}{{/summary}}
63+
{{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}
64+
{{#returnType}}
65+
p result
66+
{{/returnType}}
6667
rescue {{{moduleName}}}::ApiError => e
67-
puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}"
68+
puts "Error when calling {{classname}}->{{{operationId}}}: #{e}"
69+
end
70+
```
71+
72+
#### Using the {{operationId}}_with_http_info variant
73+
74+
This returns an Array which contains the response data{{^returnType}} (`nil` in this case){{/returnType}}, status code and headers.
75+
76+
> <Array({{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil{{/returnType}}, Integer, Hash)> {{operationId}}_with_http_info{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}
77+
78+
```ruby
79+
begin
80+
{{#summary}}# {{{.}}}{{/summary}}
81+
data, status_code, headers = api_instance.{{{operationId}}}_with_http_info{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}
82+
p status_code # => 2xx
83+
p headers # => { ... }
84+
p data # => {{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil{{/returnType}}
85+
rescue {{{moduleName}}}::ApiError => e
86+
puts "Error when calling {{classname}}->{{{operationId}}}_with_http_info: #{e}"
6887
end
6988
```
7089

modules/openapi-generator/src/main/resources/ruby-client/partial_model_generic_doc.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
| **{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional]{{/required}}{{#isReadOnly}}[readonly]{{/isReadOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} |
99
{{/vars}}
1010

11-
## Code Sample
11+
## Example
1212

1313
```ruby
1414
require '{{{gemName}}}'

samples/client/petstore/ruby-faraday/docs/AdditionalPropertiesClass.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
| **map_property** | **Hash&lt;String, String&gt;** | | [optional] |
88
| **map_of_map_property** | **Hash&lt;String, Hash&lt;String, String&gt;&gt;** | | [optional] |
99

10-
## Code Sample
10+
## Example
1111

1212
```ruby
1313
require 'petstore'

samples/client/petstore/ruby-faraday/docs/Animal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
| **class_name** | **String** | | |
88
| **color** | **String** | | [optional][default to &#39;red&#39;] |
99

10-
## Code Sample
10+
## Example
1111

1212
```ruby
1313
require 'petstore'

samples/client/petstore/ruby-faraday/docs/AnotherFakeApi.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,44 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
99

1010
## call_123_test_special_tags
1111

12-
> Client call_123_test_special_tags(client)
12+
> <Client> call_123_test_special_tags(client)
1313
1414
To test special tags
1515

1616
To test special tags and operation ID starting with number
1717

18-
### Example
18+
### Examples
1919

2020
```ruby
21-
# load the gem
2221
require 'petstore'
2322

2423
api_instance = Petstore::AnotherFakeApi.new
2524
client = Petstore::Client.new # Client | client model
2625

2726
begin
28-
#To test special tags
27+
# To test special tags
2928
result = api_instance.call_123_test_special_tags(client)
3029
p result
3130
rescue Petstore::ApiError => e
32-
puts "Exception when calling AnotherFakeApi->call_123_test_special_tags: #{e}"
31+
puts "Error when calling AnotherFakeApi->call_123_test_special_tags: #{e}"
32+
end
33+
```
34+
35+
#### Using the call_123_test_special_tags_with_http_info variant
36+
37+
This returns an Array which contains the response data, status code and headers.
38+
39+
> <Array(<Client>, Integer, Hash)> call_123_test_special_tags_with_http_info(client)
40+
41+
```ruby
42+
begin
43+
# To test special tags
44+
data, status_code, headers = api_instance.call_123_test_special_tags_with_http_info(client)
45+
p status_code # => 2xx
46+
p headers # => { ... }
47+
p data # => <Client>
48+
rescue Petstore::ApiError => e
49+
puts "Error when calling AnotherFakeApi->call_123_test_special_tags_with_http_info: #{e}"
3350
end
3451
```
3552

samples/client/petstore/ruby-faraday/docs/ApiResponse.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
| **type** | **String** | | [optional] |
99
| **message** | **String** | | [optional] |
1010

11-
## Code Sample
11+
## Example
1212

1313
```ruby
1414
require 'petstore'

samples/client/petstore/ruby-faraday/docs/ArrayOfArrayOfNumberOnly.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
| ---- | ---- | ----------- | ----- |
77
| **array_array_number** | **Array&lt;Array&lt;Float&gt;&gt;** | | [optional] |
88

9-
## Code Sample
9+
## Example
1010

1111
```ruby
1212
require 'petstore'

samples/client/petstore/ruby-faraday/docs/ArrayOfNumberOnly.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
| ---- | ---- | ----------- | ----- |
77
| **array_number** | **Array&lt;Float&gt;** | | [optional] |
88

9-
## Code Sample
9+
## Example
1010

1111
```ruby
1212
require 'petstore'

samples/client/petstore/ruby-faraday/docs/ArrayTest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
| **array_array_of_integer** | **Array&lt;Array&lt;Integer&gt;&gt;** | | [optional] |
99
| **array_array_of_model** | **Array&lt;Array&lt;ReadOnlyFirst&gt;&gt;** | | [optional] |
1010

11-
## Code Sample
11+
## Example
1212

1313
```ruby
1414
require 'petstore'

samples/client/petstore/ruby-faraday/docs/Capitalization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
| **sca_eth_flow_points** | **String** | | [optional] |
1212
| **att_name** | **String** | Name of the pet | [optional] |
1313

14-
## Code Sample
14+
## Example
1515

1616
```ruby
1717
require 'petstore'

0 commit comments

Comments
 (0)