forked from loafle/openapi-generator-original
update dart, ruby petstore samples
This commit is contained in:
parent
91bd7ac3b9
commit
a59c325cb7
@ -1 +1 @@
|
||||
2.3.1
|
||||
2.4.0-SNAPSHOT
|
@ -59,7 +59,7 @@ try {
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
@ -5,7 +5,7 @@
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
|
@ -5,7 +5,7 @@
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
|
@ -5,7 +5,7 @@
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
|
@ -18,7 +18,7 @@ class ApiClient {
|
||||
final _RegList = new RegExp(r'^List<(.*)>$');
|
||||
final _RegMap = new RegExp(r'^Map<String,(.*)>$');
|
||||
|
||||
ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) {
|
||||
ApiClient({this.basePath: "http://localhost/v2"}) {
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
_authentications['api_key'] = new ApiKeyAuth("header", "api_key");
|
||||
_authentications['petstore_auth'] = new OAuth();
|
||||
@ -149,4 +149,12 @@ class ApiClient {
|
||||
auth.applyToParams(queryParams, headerParams);
|
||||
});
|
||||
}
|
||||
|
||||
void setAccessToken(String accessToken) {
|
||||
_authentications.forEach((key, auth) {
|
||||
if (auth is OAuth) {
|
||||
auth.setAccessToken(accessToken);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,19 @@
|
||||
part of swagger.api;
|
||||
|
||||
class OAuth implements Authentication {
|
||||
String accessToken;
|
||||
|
||||
OAuth({this.accessToken}) {
|
||||
}
|
||||
|
||||
@override
|
||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||
// TODO: support oauth
|
||||
if (accessToken != null) {
|
||||
headerParams["Authorization"] = "Bearer " + accessToken;
|
||||
}
|
||||
}
|
||||
|
||||
void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
2.3.1
|
||||
2.4.0-SNAPSHOT
|
@ -59,7 +59,7 @@ try {
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
@ -5,7 +5,7 @@
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
|
@ -5,7 +5,7 @@
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
|
@ -5,7 +5,7 @@
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
|
@ -18,7 +18,7 @@ class ApiClient {
|
||||
final _RegList = new RegExp(r'^List<(.*)>$');
|
||||
final _RegMap = new RegExp(r'^Map<String,(.*)>$');
|
||||
|
||||
ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) {
|
||||
ApiClient({this.basePath: "http://localhost/v2"}) {
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
_authentications['api_key'] = new ApiKeyAuth("header", "api_key");
|
||||
_authentications['petstore_auth'] = new OAuth();
|
||||
@ -149,4 +149,12 @@ class ApiClient {
|
||||
auth.applyToParams(queryParams, headerParams);
|
||||
});
|
||||
}
|
||||
|
||||
void setAccessToken(String accessToken) {
|
||||
_authentications.forEach((key, auth) {
|
||||
if (auth is OAuth) {
|
||||
auth.setAccessToken(accessToken);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,19 @@
|
||||
part of swagger.api;
|
||||
|
||||
class OAuth implements Authentication {
|
||||
String accessToken;
|
||||
|
||||
OAuth({this.accessToken}) {
|
||||
}
|
||||
|
||||
@override
|
||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||
// TODO: support oauth
|
||||
if (accessToken != null) {
|
||||
headerParams["Authorization"] = "Bearer " + accessToken;
|
||||
}
|
||||
}
|
||||
|
||||
void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
2.3.1
|
||||
2.4.0-SNAPSHOT
|
@ -59,7 +59,7 @@ try {
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
@ -5,7 +5,7 @@
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
|
@ -5,7 +5,7 @@
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
|
@ -5,7 +5,7 @@
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
|
@ -18,7 +18,7 @@ class ApiClient {
|
||||
final _RegList = new RegExp(r'^List<(.*)>$');
|
||||
final _RegMap = new RegExp(r'^Map<String,(.*)>$');
|
||||
|
||||
ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) {
|
||||
ApiClient({this.basePath: "http://localhost/v2"}) {
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
_authentications['api_key'] = new ApiKeyAuth("header", "api_key");
|
||||
_authentications['petstore_auth'] = new OAuth();
|
||||
@ -149,4 +149,12 @@ class ApiClient {
|
||||
auth.applyToParams(queryParams, headerParams);
|
||||
});
|
||||
}
|
||||
|
||||
void setAccessToken(String accessToken) {
|
||||
_authentications.forEach((key, auth) {
|
||||
if (auth is OAuth) {
|
||||
auth.setAccessToken(accessToken);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,19 @@
|
||||
part of swagger.api;
|
||||
|
||||
class OAuth implements Authentication {
|
||||
String accessToken;
|
||||
|
||||
OAuth({this.accessToken}) {
|
||||
}
|
||||
|
||||
@override
|
||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||
// TODO: support oauth
|
||||
if (accessToken != null) {
|
||||
headerParams["Authorization"] = "Bearer " + accessToken;
|
||||
}
|
||||
}
|
||||
|
||||
void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license)
|
||||
# Automatically generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen)
|
||||
AllCops:
|
||||
TargetRubyVersion: 2.2
|
||||
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
||||
# to ignore them, so only the ones explicitly set in this file are enabled.
|
||||
DisabledByDefault: true
|
||||
Exclude:
|
||||
- '**/spec/**/*'
|
||||
- '**/templates/**/*'
|
||||
- '**/vendor/**/*'
|
||||
- 'actionpack/lib/action_dispatch/journey/parser.rb'
|
||||
@ -113,9 +114,9 @@ Layout/SpaceInsideParens:
|
||||
Enabled: true
|
||||
|
||||
# Check quotes usage according to lint rule below.
|
||||
Style/StringLiterals:
|
||||
Enabled: true
|
||||
EnforcedStyle: single_quotes
|
||||
#Style/StringLiterals:
|
||||
# Enabled: true
|
||||
# EnforcedStyle: single_quotes
|
||||
|
||||
# Detect hard tabs, no hard tabs.
|
||||
Layout/Tab:
|
||||
|
@ -12,6 +12,8 @@ Method | HTTP request | Description
|
||||
|
||||
To test class name in snake case
|
||||
|
||||
To test class name in snake case
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
|
@ -20,6 +20,7 @@ module Petstore
|
||||
@api_client = api_client
|
||||
end
|
||||
# To test class name in snake case
|
||||
# To test class name in snake case
|
||||
# @param body client model
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Client]
|
||||
@ -28,6 +29,7 @@ module Petstore
|
||||
data
|
||||
end
|
||||
|
||||
# To test class name in snake case
|
||||
# To test class name in snake case
|
||||
# @param body client model
|
||||
# @param [Hash] opts the optional parameters
|
||||
|
@ -248,7 +248,7 @@ module Petstore
|
||||
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
||||
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
||||
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
||||
'explicitly with `tempfile.delete`'
|
||||
"explicitly with `tempfile.delete`"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
#
|
||||
|
||||
=begin
|
||||
#Swagger Petstore
|
||||
|
||||
@ -24,8 +24,7 @@ Gem::Specification.new do |s|
|
||||
s.homepage = "https://github.com/swagger-api/swagger-codegen"
|
||||
s.summary = "Swagger Petstore Ruby Gem"
|
||||
s.description = "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\"
|
||||
# TODO uncomment and update below with a proper license
|
||||
#s.license = "Apache 2.0"
|
||||
s.license = "Unlicense"
|
||||
s.required_ruby_version = ">= 1.9"
|
||||
|
||||
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
||||
|
Loading…
x
Reference in New Issue
Block a user