-
Notifications
You must be signed in to change notification settings - Fork 14
/
README.mustache
220 lines (177 loc) · 8.03 KB
/
README.mustache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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
129
130
131
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
166
167
168
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# {{gemName}}
{{moduleName}} - the Ruby gem for the {{appName}}
{{#appDescriptionWithNewLines}}
{{{.}}}
{{/appDescriptionWithNewLines}}
{{#useCustomTemplateCode}}
## Migrating from legacy SDK
This SDK is generated from our officially maintained [OpenAPI spec](https://github.com/hellosign/hellosign-openapi/blob/main/openapi.yaml).
We've made important updates that introduce new functionality and create feature parity between the Dropbox Sign API and the SDK.
However, some of these changes are considered "breaking" in the sense that they'll require you to update your existing code in order to continue using the SDK.
Please refer to this [migration guide](https://developers.hellosign.com/docs/sdks/ruby/migration-guide/) for more information.
## Contributing
This repo is no longer accepting new issues or Pull Requests. All issues or
Pull Requests *must* be opened against the
[hellosign/hellosign-openapi](https://github.com/hellosign/hellosign-openapi) repo!
### Changes to the SDK code
You must make SDK code changes in the mustache file within the `templates`
directory that corresponds to the file you want updated.
{{/useCustomTemplateCode}}
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: {{appVersion}}
- Package version: {{gemVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Generator version: {{generatorVersion}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}
## Installation
{{#useCustomTemplateCode}}
### Install gem
```shell
gem install {{{gemName}}}
```
{{/useCustomTemplateCode}}
### Build a gem
To build the Ruby code into a gem:
```shell
gem build {{{gemName}}}.gemspec
```
{{^useCustomTemplateCode}}
Then either install the gem locally:
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
Then install the gem locally:
{{/useCustomTemplateCode}}
```shell
gem install ./{{{gemName}}}-{{{gemVersion}}}.gem
```
(for development, run `gem install --dev ./{{{gemName}}}-{{{gemVersion}}}.gem` to install the development dependencies)
{{^useCustomTemplateCode}}
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
{{/useCustomTemplateCode}}
Finally add this to the Gemfile:
gem '{{{gemName}}}', '~> {{{gemVersion}}}'
### Install from Git
If the Ruby gem is hosted at a git repository: https://{{gitHost}}/{{gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}, then add the following in the Gemfile:
gem '{{{gemName}}}', :git => 'https://{{gitHost}}/{{gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}.git'
### Include the Ruby code directly
Include the Ruby code directly using `-I` as follows:
```shell
ruby -Ilib script.rb
```
## Getting Started
Please follow the [installation](#installation) procedure and then run the following code:
{{^useCustomTemplateCode}}
```ruby
# Load the gem
require '{{{gemName}}}'
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}
# Setup authorization
{{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
# Configure HTTP basic authorization: {{{name}}}
config.username = 'YOUR_USERNAME'
config.password = 'YOUR_PASSWORD'{{/isBasicBasic}}{{#isBasicBearer}}
# Configure Bearer authorization{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}: {{{name}}}
config.access_token = 'YOUR_BEARER_TOKEN'
# Configure a proc to get access tokens in lieu of the static access_token configuration
config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } {{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
# Configure API key authorization: {{{name}}}
config.api_key['{{{name}}}'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['{{{name}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}}
# Configure OAuth2 access token for authorization: {{{name}}}
config.access_token = 'YOUR ACCESS TOKEN'
# Configure a proc to get access tokens in lieu of the static access_token configuration
config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } {{/isOAuth}}
{{#isFaraday}}
# Configure faraday connection
config.configure_faraday_connection { |connection| 'YOUR CONNECTION CONFIG PROC' }
{{/isFaraday}}
{{#isHttpx}}
# Configure httpx session
config.configure_session { |session| 'YOUR CONNECTION CONFIG PROC' }
{{/isHttpx}}
{{/authMethods}}end
{{/hasAuthMethods}}
api_instance = {{{moduleName}}}::{{{classname}}}.new
{{#requiredParams}}
{{{paramName}}} = {{{vendorExtensions.x-ruby-example}}} # {{{dataType}}} | {{{description}}}
{{/requiredParams}}
{{#optionalParams}}
{{#-first}}
opts = {
{{/-first}}
{{{paramName}}}: {{{vendorExtensions.x-ruby-example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}}
{{#-last}}
}
{{/-last}}
{{/optionalParams}}
begin
{{#summary}} #{{{.}}}
{{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}{{#returnType}}
p result{{/returnType}}
rescue {{{moduleName}}}::ApiError => e
puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}"
end
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
```
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
```ruby
REPLACE_ME_WITH_EXAMPLE_FOR__{{{operationId}}}_Ruby_CODE
```
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
{{/useCustomTemplateCode}}
## Documentation for API Endpoints
All URIs are relative to *{{basePath}}*
{{^useCustomTemplateCode}}
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{{summary}}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
|Class | Method | HTTP request | Description|
|------------ | ------------- | ------------- | -------------|
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}|*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{{summary}}} |
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
{{/useCustomTemplateCode}}
## Documentation for Models
{{#models}}{{#model}} - [{{moduleName}}::{{classname}}]({{modelDocPath}}{{classname}}.md)
{{/model}}{{/models}}
## Documentation for Authorization
{{^useCustomTemplateCode}}
{{^authMethods}}Endpoints do not require authorization.{{/authMethods}}
{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}}
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
{{^authMethods}} All endpoints do not require authorization.
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
{{/useCustomTemplateCode}}
{{#authMethods}}
### {{name}}
{{#isApiKey}}
- **Type**: API key
- **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}
{{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasicBasic}}{{#isBasicBearer}}- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}{{#isHttpSignature}}- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{/isBasic}}
{{#isOAuth}}
- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - {{scope}}: {{description}}
{{/scopes}}
{{/isOAuth}}
{{/authMethods}}