docspring 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/AGENTS.md +33 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +2 -2
- data/README.md +145 -178
- data/docs/Template.md +2 -0
- data/docs/TemplatePreview.md +2 -0
- data/lib/docspring/api_client.rb +1 -1
- data/lib/docspring/models/template.rb +27 -1
- data/lib/docspring/models/template_preview.rb +27 -1
- data/lib/docspring/version.rb +1 -1
- data/spec/models/template_preview_spec.rb +6 -0
- data/spec/models/template_spec.rb +6 -0
- metadata +2 -2
- data/git_push.sh +0 -57
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b0d687b11706d412a3672e312f6692a173079a58a4b83ce336f8dd7a1df94230
|
|
4
|
+
data.tar.gz: c7848c09b5e8bae983300846564e1741b034bdb09f4a18732ff6400a589b5a76
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 817c3f7a9e81959050e59a8786488f13762435109ec3db569d4d2887ffe95715765624569f4effbd6e89792f13de38a83c7cb0ba770ed144c00c0f6a2135d67f
|
|
7
|
+
data.tar.gz: 01a9c3e07d089e33f87315ed855c73cfe42fb67b8ec0d201efdc99375d1bedc72d279028b81d5d4418435b0776b4e4b7aa2eda8696b2216d4b6004f01f65080c
|
data/.travis.yml
CHANGED
data/AGENTS.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Notes for AI coding agents working with the DocSpring Ruby SDK (`docspring`), in this repository or
|
|
4
|
+
as a dependency of an app.
|
|
5
|
+
|
|
6
|
+
## This code is generated
|
|
7
|
+
|
|
8
|
+
Every file here is generated from DocSpring's OpenAPI spec by
|
|
9
|
+
[DocSpring's fork of OpenAPI Generator](https://github.com/DocSpring/openapi-generator/tree/docspring/all_patches), and each release replaces
|
|
10
|
+
all of it. Don't edit it or open pull requests that change it, and don't patch an installed copy: the next release
|
|
11
|
+
overwrites the change. Report bugs at https://github.com/DocSpring/docspring-ruby/issues or to support@docspring.com, and DocSpring fixes them in
|
|
12
|
+
the generator.
|
|
13
|
+
|
|
14
|
+
## Where to look
|
|
15
|
+
|
|
16
|
+
- [README.md](README.md): install, configuration, an example and how errors and API changes are handled.
|
|
17
|
+
- [docs/Client.md](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md): every method, with its parameters and return type.
|
|
18
|
+
- [docs/](https://github.com/DocSpring/docspring-ruby/tree/main/docs): every model and its fields.
|
|
19
|
+
- https://docspring.com/docs/llms.txt: DocSpring's documentation for LLMs (`llms-small.txt`, `llms-full.txt`).
|
|
20
|
+
- https://docspring.com/docs/api/: the API reference, with Ruby code for every method.
|
|
21
|
+
- https://docspring.com/api-docs/v1/openapi.json: the OpenAPI spec this SDK is generated from.
|
|
22
|
+
|
|
23
|
+
## Using it in an app
|
|
24
|
+
|
|
25
|
+
- Credentials come from `DOCSPRING_TOKEN_ID` and `DOCSPRING_TOKEN_SECRET`. Keep them in the environment or a secret
|
|
26
|
+
store, never in code. Accounts in the EU region also need `DOCSPRING_REGION=EU`.
|
|
27
|
+
- Template IDs look like `tpl_...` and submission IDs like `sub_...`.
|
|
28
|
+
- Pass `test: true` when you generate PDFs during development: test PDFs are free and watermarked.
|
|
29
|
+
- Generating a PDF waits for it, for up to 95 seconds. For many PDFs or slow templates, set `wait` to false and use
|
|
30
|
+
webhooks or check the submission later (https://docspring.com/docs/api-guide/synchronous-requests/).
|
|
31
|
+
- Errors: Methods raise `DocSpring::ApiError` for an error response, with the HTTP status in `code` and the body in `response_body`.
|
|
32
|
+
- Responses can be newer than this SDK, because DocSpring adds fields and enum values to API v1 without a new
|
|
33
|
+
version. The model leaves out a response field added to the API after this release. An enum value added to the API after this release comes back as a string, so handle values you don't recognize.
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
### 3.4.0 [October 18, 2026]
|
|
2
|
+
|
|
3
|
+
- Templates: new `parse_dates_using_template_date_format` setting, when you create or update a template. When it's
|
|
4
|
+
true, date values sent as NN/NN/YYYY (with slashes, dashes or dots) are read in the order of the template's default
|
|
5
|
+
date format: month first for `%m/%d/%Y`, day first for `%d/%m/%Y`. When it's false, they're read day first.
|
|
6
|
+
- A new README: installing, a quick start, every API method, errors, and how API changes are handled. The repository
|
|
7
|
+
also has an AGENTS.md for coding agents.
|
|
8
|
+
|
|
1
9
|
### 3.3.0 [October 15, 2026]
|
|
2
10
|
|
|
3
11
|
- Submissions and data requests can now be in the `declined` state, when a signer declines to sign. Data
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
docspring (3.
|
|
4
|
+
docspring (3.4.0)
|
|
5
5
|
logger
|
|
6
6
|
typhoeus (~> 1.0, >= 1.0.1)
|
|
7
7
|
|
|
@@ -104,7 +104,7 @@ CHECKSUMS
|
|
|
104
104
|
coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b
|
|
105
105
|
date (3.6.0) sha256=18ac945c4e24ebd93534f8eab8c2fd8c5604b3e977105b3798d62a1e8d27b580
|
|
106
106
|
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
|
|
107
|
-
docspring (3.
|
|
107
|
+
docspring (3.4.0)
|
|
108
108
|
ethon (0.18.0) sha256=b598afc9f30448cb068b850714b7d6948e941476095d04f90a4ac65b8d6efcb2
|
|
109
109
|
ffi (1.17.4) sha256=bcd1642e06f0d16fc9e09ac6d49c3a7298b9789bcb58127302f934e437d60acf
|
|
110
110
|
ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df
|
data/README.md
CHANGED
|
@@ -1,203 +1,170 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DocSpring Ruby SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The official Ruby client for the [DocSpring API](https://docspring.com/docs/api/). DocSpring fills PDF
|
|
4
|
+
templates with your data, generates PDFs from HTML templates, combines PDFs and collects e-signatures.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
[Documentation](https://docspring.com/docs/) · [API reference](https://docspring.com/docs/api/) ·
|
|
7
|
+
[RubyGems](https://rubygems.org/gems/docspring) · [Changelog](https://github.com/DocSpring/docspring-ruby/blob/main/CHANGELOG.md)
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Version 3.4.0. Requires Ruby >= 2.7.
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
- Package version: 3.3.0
|
|
11
|
-
- Generator version: 7.16.0-DOCSPRING
|
|
12
|
-
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
|
11
|
+
## Install and configure
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
Add the following line to your Gemfile:
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
To build the Ruby code into a gem:
|
|
19
|
-
|
|
20
|
-
```shell
|
|
21
|
-
gem build docspring.gemspec
|
|
15
|
+
```ruby
|
|
16
|
+
gem "docspring"
|
|
22
17
|
```
|
|
23
18
|
|
|
24
|
-
Then
|
|
19
|
+
Then run:
|
|
25
20
|
|
|
26
|
-
```
|
|
27
|
-
|
|
21
|
+
```bash
|
|
22
|
+
bundle install
|
|
28
23
|
```
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
Configure authentication via environment variables:
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
gem 'docspring', '~> 3.3.0'
|
|
27
|
+
```bash
|
|
28
|
+
export DOCSPRING_TOKEN_ID="API_TOKEN_ID"
|
|
29
|
+
export DOCSPRING_TOKEN_SECRET="API_TOKEN_SECRET"
|
|
30
|
+
```
|
|
37
31
|
|
|
38
|
-
|
|
32
|
+
You can also configure the region or host. The host takes priority over the region:
|
|
39
33
|
|
|
40
|
-
|
|
34
|
+
```bash
|
|
35
|
+
export DOCSPRING_REGION="US" # US or EU (defaults to US)
|
|
36
|
+
export DOCSPRING_HOST="docspring.yourcompany.com" # For on-premise deployments
|
|
37
|
+
```
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
Initialize the DocSpring client with no arguments:
|
|
43
40
|
|
|
44
|
-
|
|
41
|
+
```ruby
|
|
42
|
+
client = DocSpring::Client.new
|
|
43
|
+
```
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
Or pass credentials directly as arguments:
|
|
47
46
|
|
|
48
|
-
```
|
|
49
|
-
|
|
47
|
+
```ruby
|
|
48
|
+
client = DocSpring::Client.new(
|
|
49
|
+
api_token_id: 'API_TOKEN_ID',
|
|
50
|
+
api_token_secret: 'API_TOKEN_SECRET'
|
|
51
|
+
)
|
|
50
52
|
```
|
|
51
53
|
|
|
52
|
-
##
|
|
54
|
+
## Generate a PDF
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
Fill a template with data (use your template's ID in place of `tpl_1234567890abcdef01`):
|
|
55
57
|
|
|
56
58
|
```ruby
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
begin
|
|
72
|
-
#Add new fields to a Template
|
|
73
|
-
result = api_instance.add_fields_to_template(template_id, data)
|
|
74
|
-
p result
|
|
75
|
-
rescue DocSpring::ApiError => e
|
|
76
|
-
puts "Exception when calling Client->add_fields_to_template: #{e}"
|
|
77
|
-
end
|
|
78
|
-
|
|
59
|
+
template_id = 'tpl_1234567890abcdef01'
|
|
60
|
+
submission = {
|
|
61
|
+
data: { first_name: 'John', last_name: 'Smith', phone_number: '+11234567890' },
|
|
62
|
+
metadata: { foo: 123, bar: :baz },
|
|
63
|
+
}
|
|
64
|
+
wait = nil
|
|
65
|
+
|
|
66
|
+
response = client.generate_pdf(
|
|
67
|
+
template_id,
|
|
68
|
+
submission,
|
|
69
|
+
wait: wait
|
|
70
|
+
)
|
|
71
|
+
puts response
|
|
79
72
|
```
|
|
80
73
|
|
|
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
|
-
- [DocSpring::SubmissionDataRequestToken](docs/SubmissionDataRequestToken.md)
|
|
179
|
-
- [DocSpring::SubmissionPreview](docs/SubmissionPreview.md)
|
|
180
|
-
- [DocSpring::SuccessErrorResponse](docs/SuccessErrorResponse.md)
|
|
181
|
-
- [DocSpring::SuccessMultipleErrorsResponse](docs/SuccessMultipleErrorsResponse.md)
|
|
182
|
-
- [DocSpring::Template](docs/Template.md)
|
|
183
|
-
- [DocSpring::TemplateAddFieldsResponse](docs/TemplateAddFieldsResponse.md)
|
|
184
|
-
- [DocSpring::TemplateDeleteResponse](docs/TemplateDeleteResponse.md)
|
|
185
|
-
- [DocSpring::TemplateModelCodeResponse](docs/TemplateModelCodeResponse.md)
|
|
186
|
-
- [DocSpring::TemplatePreview](docs/TemplatePreview.md)
|
|
187
|
-
- [DocSpring::TemplatePublishVersionResponse](docs/TemplatePublishVersionResponse.md)
|
|
188
|
-
- [DocSpring::UpdateHtmlTemplate](docs/UpdateHtmlTemplate.md)
|
|
189
|
-
- [DocSpring::UpdatePdfTemplate](docs/UpdatePdfTemplate.md)
|
|
190
|
-
- [DocSpring::UpdateSubmissionDataRequestData](docs/UpdateSubmissionDataRequestData.md)
|
|
191
|
-
- [DocSpring::UpdateWebhookData](docs/UpdateWebhookData.md)
|
|
192
|
-
- [DocSpring::UploadPresignResponse](docs/UploadPresignResponse.md)
|
|
193
|
-
- [DocSpring::Webhook](docs/Webhook.md)
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
## Documentation for Authorization
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
Authentication schemes defined for the API:
|
|
200
|
-
### api_token_basic
|
|
201
|
-
|
|
202
|
-
- **Type**: HTTP basic authentication
|
|
203
|
-
|
|
74
|
+
By default the call waits for the PDF, for up to 95 seconds, and the submission in the response has its
|
|
75
|
+
`download_url`. Set `wait` to false to get a pending submission straight away.
|
|
76
|
+
[Sync vs. async processing](https://docspring.com/docs/api-guide/synchronous-requests/) covers the time limit, status
|
|
77
|
+
checks and webhooks.
|
|
78
|
+
|
|
79
|
+
## Methods
|
|
80
|
+
|
|
81
|
+
[docs/Client.md](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md) has each method's parameters and return type, and
|
|
82
|
+
[docs/](https://github.com/DocSpring/docspring-ruby/tree/main/docs) has the models. The [API reference](https://docspring.com/docs/api/) has
|
|
83
|
+
Ruby code for every method.
|
|
84
|
+
|
|
85
|
+
| Method | Description |
|
|
86
|
+
| ------ | ----------- |
|
|
87
|
+
| [`add_fields_to_template`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#add_fields_to_template) | Add new fields to a Template |
|
|
88
|
+
| [`batch_generate_pdfs`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#batch_generate_pdfs) | Generate multiple PDFs |
|
|
89
|
+
| [`combine_pdfs`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#combine_pdfs) | Merge submission PDFs, template PDFs, or custom files |
|
|
90
|
+
| [`copy_template`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#copy_template) | Copy a template |
|
|
91
|
+
| [`create_custom_file_from_upload`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#create_custom_file_from_upload) | Create a new custom file from a cached S3 upload |
|
|
92
|
+
| [`create_data_request_event`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#create_data_request_event) | Create a new event for emailing a signee a request for signature |
|
|
93
|
+
| [`create_data_request_token`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#create_data_request_token) | Create a new data request token for form authentication |
|
|
94
|
+
| [`create_folder`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#create_folder) | Create a folder |
|
|
95
|
+
| [`create_html_template`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#create_html_template) | Create a new HTML template |
|
|
96
|
+
| [`create_pdf_template`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#create_pdf_template) | Create a new PDF template with a form POST file upload |
|
|
97
|
+
| [`create_pdf_template_from_upload`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#create_pdf_template_from_upload) | Create a new PDF template from a cached S3 file upload |
|
|
98
|
+
| [`create_webhook`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#create_webhook) | Create a webhook |
|
|
99
|
+
| [`delete_folder`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#delete_folder) | Delete a folder |
|
|
100
|
+
| [`delete_template`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#delete_template) | Delete a template |
|
|
101
|
+
| [`delete_webhook`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#delete_webhook) | Delete a webhook |
|
|
102
|
+
| [`expire_combined_submission`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#expire_combined_submission) | Expire a combined submission |
|
|
103
|
+
| [`expire_submission`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#expire_submission) | Expire a PDF submission |
|
|
104
|
+
| [`generate_pdf`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#generate_pdf) | Generate a PDF |
|
|
105
|
+
| [`generate_preview`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#generate_preview) | Generate a preview PDF for partially completed data requests |
|
|
106
|
+
| [`get_combined_submission`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#get_combined_submission) | Check the status of a combined submission (merged PDFs) |
|
|
107
|
+
| [`get_data_request`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#get_data_request) | Look up a submission data request |
|
|
108
|
+
| [`get_full_template`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#get_full_template) | Fetch the full attributes for a PDF template |
|
|
109
|
+
| [`get_presign_url`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#get_presign_url) | Get a presigned S3 URL for direct file upload |
|
|
110
|
+
| [`get_submission`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#get_submission) | Check the status of a PDF |
|
|
111
|
+
| [`get_submission_batch`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#get_submission_batch) | Check the status of a submission batch job |
|
|
112
|
+
| [`get_template`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#get_template) | Check the status of an uploaded template |
|
|
113
|
+
| [`get_template_model_code`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#get_template_model_code) | Generate typed model code for a template |
|
|
114
|
+
| [`get_template_schema`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#get_template_schema) | Fetch the JSON schema for a template |
|
|
115
|
+
| [`get_webhook`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#get_webhook) | Get a webhook |
|
|
116
|
+
| [`list_combined_submissions`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#list_combined_submissions) | Get a list of all combined submissions |
|
|
117
|
+
| [`list_folders`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#list_folders) | Get a list of all folders |
|
|
118
|
+
| [`list_submissions`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#list_submissions) | List all submissions |
|
|
119
|
+
| [`list_template_submissions`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#list_template_submissions) | List all submissions for a given template |
|
|
120
|
+
| [`list_templates`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#list_templates) | Get a list of all templates |
|
|
121
|
+
| [`list_webhooks`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#list_webhooks) | Get a list of all webhooks |
|
|
122
|
+
| [`move_folder_to_folder`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#move_folder_to_folder) | Move a folder |
|
|
123
|
+
| [`move_template_to_folder`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#move_template_to_folder) | Move Template to folder |
|
|
124
|
+
| [`publish_template_version`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#publish_template_version) | Publish a template version |
|
|
125
|
+
| [`rename_folder`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#rename_folder) | Rename a folder |
|
|
126
|
+
| [`restore_template_version`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#restore_template_version) | Restore a template version |
|
|
127
|
+
| [`test_authentication`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#test_authentication) | Test authentication |
|
|
128
|
+
| [`update_data_request`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#update_data_request) | Update a submission data request |
|
|
129
|
+
| [`update_template`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#update_template) | Update a Template |
|
|
130
|
+
| [`update_template_document`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#update_template_document) | Update a template's document with a form POST file upload |
|
|
131
|
+
| [`update_template_document_from_upload`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#update_template_document_from_upload) | Update a template's document with a cached S3 file upload |
|
|
132
|
+
| [`update_webhook`](https://github.com/DocSpring/docspring-ruby/blob/main/docs/Client.md#update_webhook) | Update a webhook |
|
|
133
|
+
|
|
134
|
+
## Errors
|
|
135
|
+
|
|
136
|
+
Methods raise `DocSpring::ApiError` for an error response, with the HTTP status in `code` and the body in `response_body`.
|
|
137
|
+
|
|
138
|
+
## API changes
|
|
139
|
+
|
|
140
|
+
DocSpring adds fields and enum values to API v1 without releasing a new API version. Changes that would break
|
|
141
|
+
existing code, such as removing or renaming a field, go in a new API version
|
|
142
|
+
([API changes](https://docspring.com/docs/api-guide/openapi-schema/#api-changes)). So this SDK keeps working with
|
|
143
|
+
responses that are newer than it is:
|
|
144
|
+
|
|
145
|
+
- The model leaves out a response field added to the API after this release.
|
|
146
|
+
- An enum value added to the API after this release comes back as a string, so handle values you don't recognize.
|
|
147
|
+
|
|
148
|
+
Upgrade the SDK to read new fields and enum values. The [changelog](https://github.com/DocSpring/docspring-ruby/blob/main/CHANGELOG.md) lists
|
|
149
|
+
what each release adds.
|
|
150
|
+
|
|
151
|
+
## About this SDK
|
|
152
|
+
|
|
153
|
+
This SDK is generated from DocSpring's [OpenAPI spec](https://docspring.com/api-docs/v1/openapi.json) with
|
|
154
|
+
[DocSpring's fork of OpenAPI Generator](https://github.com/DocSpring/openapi-generator/tree/docspring/all_patches) 7.16.0.
|
|
155
|
+
The fork changes the Ruby generator:
|
|
156
|
+
|
|
157
|
+
- Responses with an enum value added to the API after this release don't raise `ArgumentError`. Setting an attribute yourself still checks its value.
|
|
158
|
+
|
|
159
|
+
On top of the generated code, we add:
|
|
160
|
+
|
|
161
|
+
- A client constructor that reads your credentials, region and host from the environment.
|
|
162
|
+
- A fix for multipart PUT requests in Ethon (file uploads to `update_template_document`).
|
|
163
|
+
|
|
164
|
+
Because the code is generated, we can't merge pull requests that change it. Please
|
|
165
|
+
[open an issue](https://github.com/DocSpring/docspring-ruby/issues) or email [support@docspring.com](mailto:support@docspring.com) instead, and
|
|
166
|
+
we'll fix it in the generator. [AGENTS.md](https://github.com/DocSpring/docspring-ruby/blob/main/AGENTS.md) is a short guide for AI coding agents.
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
MIT. See [LICENSE](https://github.com/DocSpring/docspring-ruby/blob/main/LICENSE).
|
data/docs/Template.md
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
| **page_count** | **Integer** | | |
|
|
34
34
|
| **page_dimensions** | **Array<Array<Float>>** | | |
|
|
35
35
|
| **parent_folder_id** | **String** | | |
|
|
36
|
+
| **parse_dates_using_template_date_format** | **Boolean** | | |
|
|
36
37
|
| **path** | **String** | | |
|
|
37
38
|
| **permanent_document_url** | **String** | | |
|
|
38
39
|
| **public_submissions** | **Boolean** | | |
|
|
@@ -102,6 +103,7 @@ instance = DocSpring::Template.new(
|
|
|
102
103
|
page_count: null,
|
|
103
104
|
page_dimensions: null,
|
|
104
105
|
parent_folder_id: null,
|
|
106
|
+
parse_dates_using_template_date_format: null,
|
|
105
107
|
path: null,
|
|
106
108
|
permanent_document_url: null,
|
|
107
109
|
public_submissions: null,
|
data/docs/TemplatePreview.md
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
| **page_count** | **Integer** | | |
|
|
34
34
|
| **page_dimensions** | **Array<Array<Float>>** | | |
|
|
35
35
|
| **parent_folder_id** | **String** | | |
|
|
36
|
+
| **parse_dates_using_template_date_format** | **Boolean** | | |
|
|
36
37
|
| **path** | **String** | | |
|
|
37
38
|
| **permanent_document_url** | **String** | | |
|
|
38
39
|
| **public_submissions** | **Boolean** | | |
|
|
@@ -89,6 +90,7 @@ instance = DocSpring::TemplatePreview.new(
|
|
|
89
90
|
page_count: null,
|
|
90
91
|
page_dimensions: null,
|
|
91
92
|
parent_folder_id: null,
|
|
93
|
+
parse_dates_using_template_date_format: null,
|
|
92
94
|
path: null,
|
|
93
95
|
permanent_document_url: null,
|
|
94
96
|
public_submissions: null,
|
data/lib/docspring/api_client.rb
CHANGED
|
@@ -33,7 +33,7 @@ module DocSpring
|
|
|
33
33
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
|
34
34
|
def initialize(config = Configuration.default)
|
|
35
35
|
@config = config
|
|
36
|
-
@user_agent = "docspring-ruby-3.
|
|
36
|
+
@user_agent = "docspring-ruby-3.4.0"
|
|
37
37
|
@default_headers = {
|
|
38
38
|
'Content-Type' => 'application/json',
|
|
39
39
|
'User-Agent' => @user_agent
|
|
@@ -73,6 +73,8 @@ module DocSpring
|
|
|
73
73
|
|
|
74
74
|
attr_accessor :parent_folder_id
|
|
75
75
|
|
|
76
|
+
attr_accessor :parse_dates_using_template_date_format
|
|
77
|
+
|
|
76
78
|
attr_accessor :path
|
|
77
79
|
|
|
78
80
|
attr_accessor :permanent_document_url
|
|
@@ -193,6 +195,7 @@ module DocSpring
|
|
|
193
195
|
:'page_count' => :'page_count',
|
|
194
196
|
:'page_dimensions' => :'page_dimensions',
|
|
195
197
|
:'parent_folder_id' => :'parent_folder_id',
|
|
198
|
+
:'parse_dates_using_template_date_format' => :'parse_dates_using_template_date_format',
|
|
196
199
|
:'path' => :'path',
|
|
197
200
|
:'permanent_document_url' => :'permanent_document_url',
|
|
198
201
|
:'public_submissions' => :'public_submissions',
|
|
@@ -271,6 +274,7 @@ module DocSpring
|
|
|
271
274
|
:'page_count' => :'Integer',
|
|
272
275
|
:'page_dimensions' => :'Array<Array<Float>>',
|
|
273
276
|
:'parent_folder_id' => :'String',
|
|
277
|
+
:'parse_dates_using_template_date_format' => :'Boolean',
|
|
274
278
|
:'path' => :'String',
|
|
275
279
|
:'permanent_document_url' => :'String',
|
|
276
280
|
:'public_submissions' => :'Boolean',
|
|
@@ -536,6 +540,12 @@ module DocSpring
|
|
|
536
540
|
self.parent_folder_id = nil
|
|
537
541
|
end
|
|
538
542
|
|
|
543
|
+
if attributes.key?(:'parse_dates_using_template_date_format')
|
|
544
|
+
self.parse_dates_using_template_date_format = attributes[:'parse_dates_using_template_date_format']
|
|
545
|
+
else
|
|
546
|
+
self.parse_dates_using_template_date_format = nil
|
|
547
|
+
end
|
|
548
|
+
|
|
539
549
|
if attributes.key?(:'path')
|
|
540
550
|
self.path = attributes[:'path']
|
|
541
551
|
else
|
|
@@ -814,6 +824,10 @@ module DocSpring
|
|
|
814
824
|
invalid_properties.push('invalid value for "page_count", page_count cannot be nil.')
|
|
815
825
|
end
|
|
816
826
|
|
|
827
|
+
if @parse_dates_using_template_date_format.nil?
|
|
828
|
+
invalid_properties.push('invalid value for "parse_dates_using_template_date_format", parse_dates_using_template_date_format cannot be nil.')
|
|
829
|
+
end
|
|
830
|
+
|
|
817
831
|
if @path.nil?
|
|
818
832
|
invalid_properties.push('invalid value for "path", path cannot be nil.')
|
|
819
833
|
end
|
|
@@ -896,6 +910,7 @@ module DocSpring
|
|
|
896
910
|
return false if @locked.nil?
|
|
897
911
|
return false if @merge_audit_trail_pdf.nil?
|
|
898
912
|
return false if @page_count.nil?
|
|
913
|
+
return false if @parse_dates_using_template_date_format.nil?
|
|
899
914
|
return false if @path.nil?
|
|
900
915
|
return false if @public_submissions.nil?
|
|
901
916
|
return false if @public_web_form.nil?
|
|
@@ -1088,6 +1103,16 @@ module DocSpring
|
|
|
1088
1103
|
@page_count = page_count
|
|
1089
1104
|
end
|
|
1090
1105
|
|
|
1106
|
+
# Custom attribute writer method with validation
|
|
1107
|
+
# @param [Object] parse_dates_using_template_date_format Value to be assigned
|
|
1108
|
+
def parse_dates_using_template_date_format=(parse_dates_using_template_date_format)
|
|
1109
|
+
if parse_dates_using_template_date_format.nil?
|
|
1110
|
+
fail ArgumentError, 'parse_dates_using_template_date_format cannot be nil'
|
|
1111
|
+
end
|
|
1112
|
+
|
|
1113
|
+
@parse_dates_using_template_date_format = parse_dates_using_template_date_format
|
|
1114
|
+
end
|
|
1115
|
+
|
|
1091
1116
|
# Custom attribute writer method with validation
|
|
1092
1117
|
# @param [Object] path Value to be assigned
|
|
1093
1118
|
def path=(path)
|
|
@@ -1274,6 +1299,7 @@ module DocSpring
|
|
|
1274
1299
|
page_count == o.page_count &&
|
|
1275
1300
|
page_dimensions == o.page_dimensions &&
|
|
1276
1301
|
parent_folder_id == o.parent_folder_id &&
|
|
1302
|
+
parse_dates_using_template_date_format == o.parse_dates_using_template_date_format &&
|
|
1277
1303
|
path == o.path &&
|
|
1278
1304
|
permanent_document_url == o.permanent_document_url &&
|
|
1279
1305
|
public_submissions == o.public_submissions &&
|
|
@@ -1318,7 +1344,7 @@ module DocSpring
|
|
|
1318
1344
|
# Calculates hash code according to all attributes.
|
|
1319
1345
|
# @return [Integer] Hash code
|
|
1320
1346
|
def hash
|
|
1321
|
-
[add_data_request_submission_id_footers, allow_additional_properties, description, document_filename, document_md5, document_parse_error, document_processed, document_state, document_url, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs_password, encrypt_pdfs, expiration_interval, expire_after, expire_submissions, external_predefined_fields_template_id, external_predefined_fields_template_name, first_template, id, locked, merge_audit_trail_pdf, name, page_count, page_dimensions, parent_folder_id, path, permanent_document_url, public_submissions, public_web_form, redirect_url, slack_webhook_url, template_type, updated_at, version_published_at, version, webhook_url, embed_edit_token, demo, latest_version, last_changed_at, last_changed_by_type, last_changed_by_id, last_changed_by_external_name, last_changed_by_external_email, last_changed_by_external_id, defaults, field_dependencies, field_order, fields, footer_html, header_html, html_engine_options, html, predefined_fields, scss, shared_field_data, template_schema_version, versions].hash
|
|
1347
|
+
[add_data_request_submission_id_footers, allow_additional_properties, description, document_filename, document_md5, document_parse_error, document_processed, document_state, document_url, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs_password, encrypt_pdfs, expiration_interval, expire_after, expire_submissions, external_predefined_fields_template_id, external_predefined_fields_template_name, first_template, id, locked, merge_audit_trail_pdf, name, page_count, page_dimensions, parent_folder_id, parse_dates_using_template_date_format, path, permanent_document_url, public_submissions, public_web_form, redirect_url, slack_webhook_url, template_type, updated_at, version_published_at, version, webhook_url, embed_edit_token, demo, latest_version, last_changed_at, last_changed_by_type, last_changed_by_id, last_changed_by_external_name, last_changed_by_external_email, last_changed_by_external_id, defaults, field_dependencies, field_order, fields, footer_html, header_html, html_engine_options, html, predefined_fields, scss, shared_field_data, template_schema_version, versions].hash
|
|
1322
1348
|
end
|
|
1323
1349
|
|
|
1324
1350
|
# Builds the object from hash
|
|
@@ -73,6 +73,8 @@ module DocSpring
|
|
|
73
73
|
|
|
74
74
|
attr_accessor :parent_folder_id
|
|
75
75
|
|
|
76
|
+
attr_accessor :parse_dates_using_template_date_format
|
|
77
|
+
|
|
76
78
|
attr_accessor :path
|
|
77
79
|
|
|
78
80
|
attr_accessor :permanent_document_url
|
|
@@ -167,6 +169,7 @@ module DocSpring
|
|
|
167
169
|
:'page_count' => :'page_count',
|
|
168
170
|
:'page_dimensions' => :'page_dimensions',
|
|
169
171
|
:'parent_folder_id' => :'parent_folder_id',
|
|
172
|
+
:'parse_dates_using_template_date_format' => :'parse_dates_using_template_date_format',
|
|
170
173
|
:'path' => :'path',
|
|
171
174
|
:'permanent_document_url' => :'permanent_document_url',
|
|
172
175
|
:'public_submissions' => :'public_submissions',
|
|
@@ -232,6 +235,7 @@ module DocSpring
|
|
|
232
235
|
:'page_count' => :'Integer',
|
|
233
236
|
:'page_dimensions' => :'Array<Array<Float>>',
|
|
234
237
|
:'parent_folder_id' => :'String',
|
|
238
|
+
:'parse_dates_using_template_date_format' => :'Boolean',
|
|
235
239
|
:'path' => :'String',
|
|
236
240
|
:'permanent_document_url' => :'String',
|
|
237
241
|
:'public_submissions' => :'Boolean',
|
|
@@ -480,6 +484,12 @@ module DocSpring
|
|
|
480
484
|
self.parent_folder_id = nil
|
|
481
485
|
end
|
|
482
486
|
|
|
487
|
+
if attributes.key?(:'parse_dates_using_template_date_format')
|
|
488
|
+
self.parse_dates_using_template_date_format = attributes[:'parse_dates_using_template_date_format']
|
|
489
|
+
else
|
|
490
|
+
self.parse_dates_using_template_date_format = nil
|
|
491
|
+
end
|
|
492
|
+
|
|
483
493
|
if attributes.key?(:'path')
|
|
484
494
|
self.path = attributes[:'path']
|
|
485
495
|
else
|
|
@@ -672,6 +682,10 @@ module DocSpring
|
|
|
672
682
|
invalid_properties.push('invalid value for "page_count", page_count cannot be nil.')
|
|
673
683
|
end
|
|
674
684
|
|
|
685
|
+
if @parse_dates_using_template_date_format.nil?
|
|
686
|
+
invalid_properties.push('invalid value for "parse_dates_using_template_date_format", parse_dates_using_template_date_format cannot be nil.')
|
|
687
|
+
end
|
|
688
|
+
|
|
675
689
|
if @path.nil?
|
|
676
690
|
invalid_properties.push('invalid value for "path", path cannot be nil.')
|
|
677
691
|
end
|
|
@@ -718,6 +732,7 @@ module DocSpring
|
|
|
718
732
|
return false if @locked.nil?
|
|
719
733
|
return false if @merge_audit_trail_pdf.nil?
|
|
720
734
|
return false if @page_count.nil?
|
|
735
|
+
return false if @parse_dates_using_template_date_format.nil?
|
|
721
736
|
return false if @path.nil?
|
|
722
737
|
return false if @public_submissions.nil?
|
|
723
738
|
return false if @public_web_form.nil?
|
|
@@ -901,6 +916,16 @@ module DocSpring
|
|
|
901
916
|
@page_count = page_count
|
|
902
917
|
end
|
|
903
918
|
|
|
919
|
+
# Custom attribute writer method with validation
|
|
920
|
+
# @param [Object] parse_dates_using_template_date_format Value to be assigned
|
|
921
|
+
def parse_dates_using_template_date_format=(parse_dates_using_template_date_format)
|
|
922
|
+
if parse_dates_using_template_date_format.nil?
|
|
923
|
+
fail ArgumentError, 'parse_dates_using_template_date_format cannot be nil'
|
|
924
|
+
end
|
|
925
|
+
|
|
926
|
+
@parse_dates_using_template_date_format = parse_dates_using_template_date_format
|
|
927
|
+
end
|
|
928
|
+
|
|
904
929
|
# Custom attribute writer method with validation
|
|
905
930
|
# @param [Object] path Value to be assigned
|
|
906
931
|
def path=(path)
|
|
@@ -997,6 +1022,7 @@ module DocSpring
|
|
|
997
1022
|
page_count == o.page_count &&
|
|
998
1023
|
page_dimensions == o.page_dimensions &&
|
|
999
1024
|
parent_folder_id == o.parent_folder_id &&
|
|
1025
|
+
parse_dates_using_template_date_format == o.parse_dates_using_template_date_format &&
|
|
1000
1026
|
path == o.path &&
|
|
1001
1027
|
permanent_document_url == o.permanent_document_url &&
|
|
1002
1028
|
public_submissions == o.public_submissions &&
|
|
@@ -1028,7 +1054,7 @@ module DocSpring
|
|
|
1028
1054
|
# Calculates hash code according to all attributes.
|
|
1029
1055
|
# @return [Integer] Hash code
|
|
1030
1056
|
def hash
|
|
1031
|
-
[add_data_request_submission_id_footers, allow_additional_properties, description, document_filename, document_md5, document_parse_error, document_processed, document_state, document_url, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs_password, encrypt_pdfs, expiration_interval, expire_after, expire_submissions, external_predefined_fields_template_id, external_predefined_fields_template_name, first_template, id, locked, merge_audit_trail_pdf, name, page_count, page_dimensions, parent_folder_id, path, permanent_document_url, public_submissions, public_web_form, redirect_url, slack_webhook_url, template_type, updated_at, version_published_at, version, webhook_url, embed_edit_token, demo, latest_version, last_changed_at, last_changed_by_type, last_changed_by_id, last_changed_by_external_name, last_changed_by_external_email, last_changed_by_external_id].hash
|
|
1057
|
+
[add_data_request_submission_id_footers, allow_additional_properties, description, document_filename, document_md5, document_parse_error, document_processed, document_state, document_url, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs_password, encrypt_pdfs, expiration_interval, expire_after, expire_submissions, external_predefined_fields_template_id, external_predefined_fields_template_name, first_template, id, locked, merge_audit_trail_pdf, name, page_count, page_dimensions, parent_folder_id, parse_dates_using_template_date_format, path, permanent_document_url, public_submissions, public_web_form, redirect_url, slack_webhook_url, template_type, updated_at, version_published_at, version, webhook_url, embed_edit_token, demo, latest_version, last_changed_at, last_changed_by_type, last_changed_by_id, last_changed_by_external_name, last_changed_by_external_email, last_changed_by_external_id].hash
|
|
1032
1058
|
end
|
|
1033
1059
|
|
|
1034
1060
|
# Builds the object from hash
|
data/lib/docspring/version.rb
CHANGED
|
@@ -205,6 +205,12 @@ describe DocSpring::TemplatePreview do
|
|
|
205
205
|
end
|
|
206
206
|
end
|
|
207
207
|
|
|
208
|
+
describe 'test attribute "parse_dates_using_template_date_format"' do
|
|
209
|
+
it 'should work' do
|
|
210
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
|
|
208
214
|
describe 'test attribute "path"' do
|
|
209
215
|
it 'should work' do
|
|
210
216
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
@@ -205,6 +205,12 @@ describe DocSpring::Template do
|
|
|
205
205
|
end
|
|
206
206
|
end
|
|
207
207
|
|
|
208
|
+
describe 'test attribute "parse_dates_using_template_date_format"' do
|
|
209
|
+
it 'should work' do
|
|
210
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
|
|
208
214
|
describe 'test attribute "path"' do
|
|
209
215
|
it 'should work' do
|
|
210
216
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: docspring
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- DocSpring
|
|
@@ -78,6 +78,7 @@ files:
|
|
|
78
78
|
- ".rspec"
|
|
79
79
|
- ".rubocop.yml"
|
|
80
80
|
- ".travis.yml"
|
|
81
|
+
- AGENTS.md
|
|
81
82
|
- CHANGELOG.md
|
|
82
83
|
- Gemfile
|
|
83
84
|
- Gemfile.lock
|
|
@@ -143,7 +144,6 @@ files:
|
|
|
143
144
|
- docs/UploadPresignResponse.md
|
|
144
145
|
- docs/Webhook.md
|
|
145
146
|
- docspring.gemspec
|
|
146
|
-
- git_push.sh
|
|
147
147
|
- lib/docspring.rb
|
|
148
148
|
- lib/docspring/api/client.rb
|
|
149
149
|
- lib/docspring/api_client.rb
|
data/git_push.sh
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
3
|
-
#
|
|
4
|
-
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
|
5
|
-
|
|
6
|
-
git_user_id=$1
|
|
7
|
-
git_repo_id=$2
|
|
8
|
-
release_note=$3
|
|
9
|
-
git_host=$4
|
|
10
|
-
|
|
11
|
-
if [ "$git_host" = "" ]; then
|
|
12
|
-
git_host="github.com"
|
|
13
|
-
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
|
14
|
-
fi
|
|
15
|
-
|
|
16
|
-
if [ "$git_user_id" = "" ]; then
|
|
17
|
-
git_user_id="GIT_USER_ID"
|
|
18
|
-
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
19
|
-
fi
|
|
20
|
-
|
|
21
|
-
if [ "$git_repo_id" = "" ]; then
|
|
22
|
-
git_repo_id="GIT_REPO_ID"
|
|
23
|
-
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
24
|
-
fi
|
|
25
|
-
|
|
26
|
-
if [ "$release_note" = "" ]; then
|
|
27
|
-
release_note="Minor update"
|
|
28
|
-
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
# Initialize the local directory as a Git repository
|
|
32
|
-
git init
|
|
33
|
-
|
|
34
|
-
# Adds the files in the local repository and stages them for commit.
|
|
35
|
-
git add .
|
|
36
|
-
|
|
37
|
-
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
|
38
|
-
git commit -m "$release_note"
|
|
39
|
-
|
|
40
|
-
# Sets the new remote
|
|
41
|
-
git_remote=$(git remote)
|
|
42
|
-
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
43
|
-
|
|
44
|
-
if [ "$GIT_TOKEN" = "" ]; then
|
|
45
|
-
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
46
|
-
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
|
47
|
-
else
|
|
48
|
-
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
fi
|
|
52
|
-
|
|
53
|
-
git pull origin master
|
|
54
|
-
|
|
55
|
-
# Pushes (Forces) the changes in the local repository up to the remote repository
|
|
56
|
-
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
|
57
|
-
git push origin master 2>&1 | grep -v 'To https'
|