update ruby sample

This commit is contained in:
wing328 2016-06-28 17:36:58 +08:00
parent 9e216c0ca2
commit f1f01041ed
38 changed files with 158 additions and 71 deletions

View File

@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-06-28T15:19:55.521+10:00
- Build date: 2016-06-28T17:36:56.204+08:00
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
## Installation
@ -57,30 +57,15 @@ require 'petstore'
api_instance = Petstore::FakeApi.new
number = 3.4 # Float | None
double = 1.2 # Float | None
string = "string_example" # String | None
byte = "B" # String | None
opts = {
integer: 56, # Integer | None
int32: 56, # Integer | None
int64: 789, # Integer | None
float: 3.4, # Float | None
binary: "B", # String | None
date: Date.parse("2013-10-20"), # Date | None
date_time: DateTime.parse("2013-10-20T19:20:30+01:00"), # DateTime | None
password: "password_example" # String | None
test_code_inject__end: "test_code_inject__end_example" # String | To test code injection */
}
begin
#Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
api_instance.test_endpoint_parameters(number, double, string, byte, opts)
#To test code injection */
api_instance.test_code_inject__end(opts)
rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->test_endpoint_parameters: #{e}"
puts "Exception when calling FakeApi->test_code_inject__end: #{e}"
end
```
@ -91,6 +76,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*Petstore::FakeApi* | [**test_code_inject__end**](docs/FakeApi.md#test_code_inject__end) | **PUT** /fake | To test code injection */
*Petstore::FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*Petstore::FakeApi* | [**test_enum_query_parameters**](docs/FakeApi.md#test_enum_query_parameters) | **GET** /fake | To test enum query parameters
*Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
@ -148,6 +134,12 @@ Class | Method | HTTP request | Description
## Documentation for Authorization
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
### petstore_auth
- **Type**: OAuth
@ -157,9 +149,3 @@ Class | Method | HTTP request | Description
- write:pets: modify pets in your account
- read:pets: read your pets
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header

View File

@ -4,10 +4,56 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**test_code_inject__end**](FakeApi.md#test_code_inject__end) | **PUT** /fake | To test code injection */
[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**test_enum_query_parameters**](FakeApi.md#test_enum_query_parameters) | **GET** /fake | To test enum query parameters
# **test_code_inject__end**
> test_code_inject__end(opts)
To test code injection */
### Example
```ruby
# load the gem
require 'petstore'
api_instance = Petstore::FakeApi.new
opts = {
test_code_inject__end: "test_code_inject__end_example" # String | To test code injection */
}
begin
#To test code injection */
api_instance.test_code_inject__end(opts)
rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->test_code_inject__end: #{e}"
end
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**test_code_inject__end** | **String**| To test code injection */ | [optional]
### Return type
nil (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json, */ =end));(phpinfo(
- **Accept**: application/json, */ end
# **test_endpoint_parameters**
> test_endpoint_parameters(number, double, string, byte, opts)

View File

@ -31,6 +31,61 @@ module Petstore
@api_client = api_client
end
# To test code injection */
#
# @param [Hash] opts the optional parameters
# @option opts [String] :test_code_inject__end To test code injection */
# @return [nil]
def test_code_inject__end(opts = {})
test_code_inject__end_with_http_info(opts)
return nil
end
# To test code injection */
#
# @param [Hash] opts the optional parameters
# @option opts [String] :test_code_inject__end To test code injection */
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
def test_code_inject__end_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: FakeApi.test_code_inject__end ..."
end
# resource path
local_var_path = "/fake".sub('{format}','json')
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
local_header_accept = ['application/json', '*/ end']
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 = ['application/json', '*/ =end));(phpinfo(']
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
# form parameters
form_params = {}
form_params["test code inject */ &#x3D;end"] = opts[:'test_code_inject__end'] if !opts[:'test_code_inject__end'].nil?
# http body (model)
post_body = nil
auth_names = []
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: FakeApi#test_code_inject__end\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
# @param number None

View File

@ -188,13 +188,6 @@ module Petstore
# Returns Auth Settings hash for api client.
def auth_settings
{
'petstore_auth' =>
{
type: 'oauth2',
in: 'header',
key: 'Authorization',
value: "Bearer #{access_token}"
},
'api_key' =>
{
type: 'api_key',
@ -202,6 +195,13 @@ module Petstore
key: 'api_key',
value: api_key_with_prefix('api_key')
},
'petstore_auth' =>
{
type: 'oauth2',
in: 'header',
key: 'Authorization',
value: "Bearer #{access_token}"
},
}
end
end