docusign_click 1.1.0.rc1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/docusign_click/api/accounts_api.rb +61 -0
- data/lib/docusign_click/api_client.rb +382 -0
- data/lib/docusign_click/api_error.rb +37 -0
- data/lib/docusign_click/client/api_client.rb +1 -1
- data/lib/docusign_click/models/clickwrap_request.rb +14 -2
- data/lib/docusign_click/models/clickwrap_version.rb +13 -1
- data/lib/docusign_click/models/clickwrap_version_delete_response.rb +13 -1
- data/lib/docusign_click/models/clickwrap_version_response.rb +13 -1
- data/lib/docusign_click/models/clickwrap_version_summary_response.rb +13 -1
- data/lib/docusign_click/models/data_field.rb +204 -0
- data/lib/docusign_click/models/display_settings.rb +14 -4
- data/lib/docusign_click/models/document.rb +31 -1
- data/lib/docusign_click/models/user_agreement_request.rb +5 -2
- data/lib/docusign_click/models/user_agreement_response.rb +28 -3
- data/lib/docusign_click/version.rb +1 -1
- data/lib/docusign_click.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 263cc3244aeb4670280d9546da89e2b8a57f92f9468b6cee6ddc5b0ef90dd7f3
|
4
|
+
data.tar.gz: 46dcfb89ea4d5f6f7819ed840c1ef06255c1f7cf416bfdfc0068bfac87f57306
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49b353f73394253f63377b2345c50e6c4feadb46d95c4d7d960ecf54ceeedb8cfa882ccd4a8e56d44706270cc5aece670baa1f650d855379b15b9b0ec26f2a77
|
7
|
+
data.tar.gz: 7d215ecc40503b648284551a38d23479040c8d24a413903565992117ded638b210422d974c657f54c45d6c74e6a65138847e713cb8d5c108bf2bbd40ae71f7ba
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
# DocuSign Click Ruby Client Changelog
|
2
2
|
See [DocuSign Support Center](https://support.docusign.com/en/releasenotes/) for Product Release Notes.
|
3
3
|
|
4
|
+
## [v1.2.2] - Click API v1-22.3.01.00 - 2022-10-28
|
5
|
+
### Changed
|
6
|
+
- Added support for version v1-22.3.01.00 of the DocuSign Click API.
|
7
|
+
- Updated the SDK release version.
|
8
|
+
|
9
|
+
## [1.1.0] - Click API v1-21.4.01 - 2021-12-09
|
10
|
+
### Changed
|
11
|
+
- Added support for version v1-21.4.01 of the DocuSign Click API.
|
12
|
+
- Updated the SDK release version.
|
13
|
+
|
14
|
+
|
4
15
|
## [1.1.0.rc1] - Click API v1-21.4.00 - 2021-11-19
|
5
16
|
### Changed
|
6
17
|
- Added support for version v1-21.4.00 of the DocuSign Click API.
|
@@ -565,6 +565,67 @@ module DocuSign_Click
|
|
565
565
|
return data, status_code, headers
|
566
566
|
end
|
567
567
|
|
568
|
+
# Downloads a document at an order within the agreement.
|
569
|
+
#
|
570
|
+
# @param account_id
|
571
|
+
# @param clickwrap_id
|
572
|
+
# @param order_or_disclosure
|
573
|
+
# @param version_id
|
574
|
+
# @return [Document]
|
575
|
+
def get_agreement_document(account_id, clickwrap_id, order_or_disclosure, version_id)
|
576
|
+
data, _status_code, _headers = get_agreement_document_with_http_info(account_id, clickwrap_id, order_or_disclosure, version_id)
|
577
|
+
return data
|
578
|
+
end
|
579
|
+
|
580
|
+
# Downloads a document at an order within the agreement.
|
581
|
+
#
|
582
|
+
# @param account_id
|
583
|
+
# @param clickwrap_id
|
584
|
+
# @param order_or_disclosure
|
585
|
+
# @param version_id
|
586
|
+
# @return [Array<(Document, Fixnum, Hash)>] Document data, response status code and response headers
|
587
|
+
def get_agreement_document_with_http_info(account_id, clickwrap_id, order_or_disclosure, version_id)
|
588
|
+
if @api_client.config.debugging
|
589
|
+
@api_client.config.logger.debug "Calling API: AccountsApi.get_agreement_document ..."
|
590
|
+
end
|
591
|
+
# verify the required parameter 'account_id' is set
|
592
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_agreement_document" if account_id.nil?
|
593
|
+
# verify the required parameter 'clickwrap_id' is set
|
594
|
+
fail ArgumentError, "Missing the required parameter 'clickwrap_id' when calling AccountsApi.get_agreement_document" if clickwrap_id.nil?
|
595
|
+
# verify the required parameter 'order_or_disclosure' is set
|
596
|
+
fail ArgumentError, "Missing the required parameter 'order_or_disclosure' when calling AccountsApi.get_agreement_document" if order_or_disclosure.nil?
|
597
|
+
# verify the required parameter 'version_id' is set
|
598
|
+
fail ArgumentError, "Missing the required parameter 'version_id' when calling AccountsApi.get_agreement_document" if version_id.nil?
|
599
|
+
# resource path
|
600
|
+
local_var_path = "/v1/accounts/{accountId}/clickwraps/{clickwrapId}/versions/{versionId}/documents/{orderOrDisclosure}".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'clickwrapId' + '}', clickwrap_id.to_s).sub('{' + 'orderOrDisclosure' + '}', order_or_disclosure.to_s).sub('{' + 'versionId' + '}', version_id.to_s)
|
601
|
+
|
602
|
+
# query parameters
|
603
|
+
query_params = {}
|
604
|
+
|
605
|
+
# header parameters
|
606
|
+
header_params = {}
|
607
|
+
# HTTP header 'Accept' (if needed)
|
608
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
609
|
+
|
610
|
+
# form parameters
|
611
|
+
form_params = {}
|
612
|
+
|
613
|
+
# http body (model)
|
614
|
+
post_body = nil
|
615
|
+
auth_names = []
|
616
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
617
|
+
:header_params => header_params,
|
618
|
+
:query_params => query_params,
|
619
|
+
:form_params => form_params,
|
620
|
+
:body => post_body,
|
621
|
+
:auth_names => auth_names,
|
622
|
+
:return_type => 'Document')
|
623
|
+
if @api_client.config.debugging
|
624
|
+
@api_client.config.logger.debug "API called: AccountsApi#get_agreement_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
625
|
+
end
|
626
|
+
return data, status_code, headers
|
627
|
+
end
|
628
|
+
|
568
629
|
# Downloads the agreement PDF and optionally certificate of completion.
|
569
630
|
#
|
570
631
|
# @param account_id
|
@@ -0,0 +1,382 @@
|
|
1
|
+
=begin
|
2
|
+
#DocuSign Click API
|
3
|
+
|
4
|
+
#DocuSign Click lets you capture consent to standard agreement terms with a single click: terms and conditions, terms of service, terms of use, privacy policies, and more. The Click API lets you include this customizable clickwrap solution in your DocuSign integrations.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
Contact: devcenter@docusign.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'date'
|
13
|
+
require 'json'
|
14
|
+
require 'logger'
|
15
|
+
require 'tempfile'
|
16
|
+
require 'typhoeus'
|
17
|
+
require 'uri'
|
18
|
+
require 'jwt'
|
19
|
+
require 'addressable/uri'
|
20
|
+
|
21
|
+
module DocuSign_Click
|
22
|
+
class ApiClient
|
23
|
+
# The Configuration object holding settings to be used in the API client.
|
24
|
+
attr_accessor :config
|
25
|
+
|
26
|
+
# Defines the headers to be used in HTTP requests of all API calls by default.
|
27
|
+
#
|
28
|
+
# @return [Hash]
|
29
|
+
attr_accessor :default_headers
|
30
|
+
|
31
|
+
# Initializes the ApiClient
|
32
|
+
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
33
|
+
def initialize(config = Configuration.default)
|
34
|
+
@config = config
|
35
|
+
@user_agent = "Swagger-Codegen/1.1.0/ruby"
|
36
|
+
@default_headers = {
|
37
|
+
'Content-Type' => "application/json",
|
38
|
+
'User-Agent' => @user_agent
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.default
|
43
|
+
@@default ||= ApiClient.new
|
44
|
+
end
|
45
|
+
|
46
|
+
# Call an API with given options.
|
47
|
+
#
|
48
|
+
# @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements:
|
49
|
+
# the data deserialized from response body (could be nil), response status code and response headers.
|
50
|
+
def call_api(http_method, path, opts = {})
|
51
|
+
request = build_request(http_method, path, opts)
|
52
|
+
response = request.run
|
53
|
+
|
54
|
+
if @config.debugging
|
55
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
56
|
+
end
|
57
|
+
|
58
|
+
unless response.success?
|
59
|
+
if response.timed_out?
|
60
|
+
fail ApiError.new('Connection timed out')
|
61
|
+
elsif response.code == 0
|
62
|
+
# Errors from libcurl will be made visible here
|
63
|
+
fail ApiError.new(:code => 0,
|
64
|
+
:message => response.return_message)
|
65
|
+
else
|
66
|
+
fail ApiError.new(:code => response.code,
|
67
|
+
:response_headers => response.headers,
|
68
|
+
:response_body => response.body),
|
69
|
+
response.status_message
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
if opts[:return_type]
|
74
|
+
data = deserialize(response, opts[:return_type])
|
75
|
+
else
|
76
|
+
data = nil
|
77
|
+
end
|
78
|
+
return data, response.code, response.headers
|
79
|
+
end
|
80
|
+
|
81
|
+
# Builds the HTTP request
|
82
|
+
#
|
83
|
+
# @param [String] http_method HTTP method/verb (e.g. POST)
|
84
|
+
# @param [String] path URL path (e.g. /account/new)
|
85
|
+
# @option opts [Hash] :header_params Header parameters
|
86
|
+
# @option opts [Hash] :query_params Query parameters
|
87
|
+
# @option opts [Hash] :form_params Query parameters
|
88
|
+
# @option opts [Object] :body HTTP body (JSON/XML)
|
89
|
+
# @return [Typhoeus::Request] A Typhoeus Request
|
90
|
+
def build_request(http_method, path, opts = {})
|
91
|
+
url = build_request_url(path)
|
92
|
+
http_method = http_method.to_sym.downcase
|
93
|
+
|
94
|
+
header_params = @default_headers.merge(opts[:header_params] || {})
|
95
|
+
|
96
|
+
# Add SDK default header
|
97
|
+
header_params.store("X-DocuSign-SDK", "Ruby")
|
98
|
+
|
99
|
+
query_params = opts[:query_params] || {}
|
100
|
+
form_params = opts[:form_params] || {}
|
101
|
+
|
102
|
+
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
103
|
+
|
104
|
+
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
105
|
+
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
106
|
+
|
107
|
+
req_opts = {
|
108
|
+
:method => http_method,
|
109
|
+
:headers => header_params,
|
110
|
+
:params => query_params,
|
111
|
+
:params_encoding => @config.params_encoding,
|
112
|
+
:timeout => @config.timeout,
|
113
|
+
:ssl_verifypeer => @config.verify_ssl,
|
114
|
+
:ssl_verifyhost => _verify_ssl_host,
|
115
|
+
:sslcert => @config.cert_file,
|
116
|
+
:sslkey => @config.key_file,
|
117
|
+
:verbose => @config.debugging
|
118
|
+
}
|
119
|
+
|
120
|
+
# set custom cert, if provided
|
121
|
+
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
122
|
+
|
123
|
+
if [:post, :patch, :put, :delete].include?(http_method)
|
124
|
+
req_body = build_request_body(header_params, form_params, opts[:body])
|
125
|
+
req_opts.update :body => req_body
|
126
|
+
if @config.debugging
|
127
|
+
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
Typhoeus::Request.new(url, req_opts)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Check if the given MIME is a JSON MIME.
|
135
|
+
# JSON MIME examples:
|
136
|
+
# application/json
|
137
|
+
# application/json; charset=UTF8
|
138
|
+
# APPLICATION/JSON
|
139
|
+
# */*
|
140
|
+
# @param [String] mime MIME
|
141
|
+
# @return [Boolean] True if the MIME is application/json
|
142
|
+
def json_mime?(mime)
|
143
|
+
(mime == "*/*") || !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
|
144
|
+
end
|
145
|
+
|
146
|
+
# Deserialize the response to the given return type.
|
147
|
+
#
|
148
|
+
# @param [Response] response HTTP response
|
149
|
+
# @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
|
150
|
+
def deserialize(response, return_type)
|
151
|
+
body = response.body
|
152
|
+
return nil if body.nil? || body.empty?
|
153
|
+
|
154
|
+
# return response body directly for String return type
|
155
|
+
return body if return_type == 'String'
|
156
|
+
|
157
|
+
# handle file downloading - save response body into a tmp file and return the File instance
|
158
|
+
return download_file(response) if return_type == 'File'
|
159
|
+
|
160
|
+
# ensuring a default content type
|
161
|
+
content_type = response.headers['Content-Type'] || 'application/json'
|
162
|
+
|
163
|
+
fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
164
|
+
|
165
|
+
begin
|
166
|
+
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
167
|
+
rescue JSON::ParserError => e
|
168
|
+
if %w(String Date DateTime).include?(return_type)
|
169
|
+
data = body
|
170
|
+
else
|
171
|
+
raise e
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
convert_to_type data, return_type
|
176
|
+
end
|
177
|
+
|
178
|
+
# Convert data to the given return type.
|
179
|
+
# @param [Object] data Data to be converted
|
180
|
+
# @param [String] return_type Return type
|
181
|
+
# @return [Mixed] Data in a particular type
|
182
|
+
def convert_to_type(data, return_type)
|
183
|
+
return nil if data.nil?
|
184
|
+
case return_type
|
185
|
+
when 'String'
|
186
|
+
data.to_s
|
187
|
+
when 'Integer'
|
188
|
+
data.to_i
|
189
|
+
when 'Float'
|
190
|
+
data.to_f
|
191
|
+
when 'BOOLEAN'
|
192
|
+
data == true
|
193
|
+
when 'DateTime'
|
194
|
+
# parse date time (expecting ISO 8601 format)
|
195
|
+
DateTime.parse data
|
196
|
+
when 'Date'
|
197
|
+
# parse date time (expecting ISO 8601 format)
|
198
|
+
Date.parse data
|
199
|
+
when 'Object'
|
200
|
+
# generic object (usually a Hash), return directly
|
201
|
+
data
|
202
|
+
when /\AArray<(.+)>\z/
|
203
|
+
# e.g. Array<Pet>
|
204
|
+
sub_type = $1
|
205
|
+
data.map {|item| convert_to_type(item, sub_type) }
|
206
|
+
when /\AHash\<String, (.+)\>\z/
|
207
|
+
# e.g. Hash<String, Integer>
|
208
|
+
sub_type = $1
|
209
|
+
{}.tap do |hash|
|
210
|
+
data.each {|k, v| hash[k] = convert_to_type(v, sub_type) }
|
211
|
+
end
|
212
|
+
else
|
213
|
+
# models, e.g. Pet
|
214
|
+
DocuSign_Click.const_get(return_type).new.tap do |model|
|
215
|
+
model.build_from_hash data
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
221
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
222
|
+
#
|
223
|
+
# @see Configuration#temp_folder_path
|
224
|
+
# @return [Tempfile] the file downloaded
|
225
|
+
def download_file(response)
|
226
|
+
content_disposition = response.headers['Content-Disposition']
|
227
|
+
if content_disposition and content_disposition =~ /filename=/i
|
228
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
229
|
+
prefix = sanitize_filename(filename)
|
230
|
+
else
|
231
|
+
prefix = 'download-'
|
232
|
+
end
|
233
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
234
|
+
|
235
|
+
tempfile = nil
|
236
|
+
encoding = response.body.encoding
|
237
|
+
Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) do |file|
|
238
|
+
file.write(response.body)
|
239
|
+
tempfile = file
|
240
|
+
end
|
241
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
242
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
243
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
244
|
+
"explicitly with `tempfile.delete`"
|
245
|
+
tempfile
|
246
|
+
end
|
247
|
+
|
248
|
+
# Sanitize filename by removing path.
|
249
|
+
# e.g. ../../sun.gif becomes sun.gif
|
250
|
+
#
|
251
|
+
# @param [String] filename the filename to be sanitized
|
252
|
+
# @return [String] the sanitized filename
|
253
|
+
def sanitize_filename(filename)
|
254
|
+
filename.gsub(/.*[\/\\]/, '')
|
255
|
+
end
|
256
|
+
|
257
|
+
def build_request_url(path)
|
258
|
+
# Add leading and trailing slashes to path
|
259
|
+
path = "/#{path}".gsub(/\/+/, '/')
|
260
|
+
Addressable::URI.encode(@config.base_url + path)
|
261
|
+
end
|
262
|
+
|
263
|
+
# Builds the HTTP request body
|
264
|
+
#
|
265
|
+
# @param [Hash] header_params Header parameters
|
266
|
+
# @param [Hash] form_params Query parameters
|
267
|
+
# @param [Object] body HTTP body (JSON/XML)
|
268
|
+
# @return [String] HTTP body data in the form of string
|
269
|
+
def build_request_body(header_params, form_params, body)
|
270
|
+
# http form
|
271
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
272
|
+
header_params['Content-Type'] == 'multipart/form-data'
|
273
|
+
data = {}
|
274
|
+
form_params.each do |key, value|
|
275
|
+
case value
|
276
|
+
when File, Array, nil
|
277
|
+
# let typhoeus handle File, Array and nil parameters
|
278
|
+
data[key] = value
|
279
|
+
else
|
280
|
+
data[key] = value.to_s
|
281
|
+
end
|
282
|
+
end
|
283
|
+
elsif body
|
284
|
+
data = body.is_a?(String) ? body : body.to_json
|
285
|
+
else
|
286
|
+
data = nil
|
287
|
+
end
|
288
|
+
data
|
289
|
+
end
|
290
|
+
|
291
|
+
# Update hearder and query params based on authentication settings.
|
292
|
+
#
|
293
|
+
# @param [Hash] header_params Header parameters
|
294
|
+
# @param [Hash] query_params Query parameters
|
295
|
+
# @param [String] auth_names Authentication scheme name
|
296
|
+
def update_params_for_auth!(header_params, query_params, auth_names)
|
297
|
+
Array(auth_names).each do |auth_name|
|
298
|
+
auth_setting = @config.auth_settings[auth_name]
|
299
|
+
next unless auth_setting
|
300
|
+
case auth_setting[:in]
|
301
|
+
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
302
|
+
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
303
|
+
else fail ArgumentError, 'Authentication token must be in `query` of `header`'
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
# Sets user agent in HTTP header
|
309
|
+
#
|
310
|
+
# @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0)
|
311
|
+
def user_agent=(user_agent)
|
312
|
+
@user_agent = user_agent
|
313
|
+
@default_headers['User-Agent'] = @user_agent
|
314
|
+
end
|
315
|
+
|
316
|
+
# Return Accept header based on an array of accepts provided.
|
317
|
+
# @param [Array] accepts array for Accept
|
318
|
+
# @return [String] the Accept header (e.g. application/json)
|
319
|
+
def select_header_accept(accepts)
|
320
|
+
return nil if accepts.nil? || accepts.empty?
|
321
|
+
# use JSON when present, otherwise use all of the provided
|
322
|
+
json_accept = accepts.find { |s| json_mime?(s) }
|
323
|
+
return json_accept || accepts.join(',')
|
324
|
+
end
|
325
|
+
|
326
|
+
# Return Content-Type header based on an array of content types provided.
|
327
|
+
# @param [Array] content_types array for Content-Type
|
328
|
+
# @return [String] the Content-Type header (e.g. application/json)
|
329
|
+
def select_header_content_type(content_types)
|
330
|
+
# use application/json by default
|
331
|
+
return 'application/json' if content_types.nil? || content_types.empty?
|
332
|
+
# use JSON when present, otherwise use the first one
|
333
|
+
json_content_type = content_types.find { |s| json_mime?(s) }
|
334
|
+
return json_content_type || content_types.first
|
335
|
+
end
|
336
|
+
|
337
|
+
# Convert object (array, hash, object, etc) to JSON string.
|
338
|
+
# @param [Object] model object to be converted into JSON string
|
339
|
+
# @return [String] JSON string representation of the object
|
340
|
+
def object_to_http_body(model)
|
341
|
+
return model if model.nil? || model.is_a?(String)
|
342
|
+
local_body = nil
|
343
|
+
if model.is_a?(Array)
|
344
|
+
local_body = model.map{|m| object_to_hash(m) }
|
345
|
+
else
|
346
|
+
local_body = object_to_hash(model)
|
347
|
+
end
|
348
|
+
local_body.to_json
|
349
|
+
end
|
350
|
+
|
351
|
+
# Convert object(non-array) to hash.
|
352
|
+
# @param [Object] obj object to be converted into JSON string
|
353
|
+
# @return [String] JSON string representation of the object
|
354
|
+
def object_to_hash(obj)
|
355
|
+
if obj.respond_to?(:to_hash)
|
356
|
+
obj.to_hash
|
357
|
+
else
|
358
|
+
obj
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
# Build parameter value according to the given collection format.
|
363
|
+
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
|
364
|
+
def build_collection_param(param, collection_format)
|
365
|
+
case collection_format
|
366
|
+
when :csv
|
367
|
+
param.join(',')
|
368
|
+
when :ssv
|
369
|
+
param.join(' ')
|
370
|
+
when :tsv
|
371
|
+
param.join("\t")
|
372
|
+
when :pipes
|
373
|
+
param.join('|')
|
374
|
+
when :multi
|
375
|
+
# return the array directly as typhoeus will handle it as expected
|
376
|
+
param
|
377
|
+
else
|
378
|
+
fail "unknown collection format: #{collection_format.inspect}"
|
379
|
+
end
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
=begin
|
2
|
+
#DocuSign Click API
|
3
|
+
|
4
|
+
#DocuSign Click lets you capture consent to standard agreement terms with a single click: terms and conditions, terms of service, terms of use, privacy policies, and more. The Click API lets you include this customizable clickwrap solution in your DocuSign integrations.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
Contact: devcenter@docusign.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
module DocuSign_Click
|
13
|
+
class ApiError < StandardError
|
14
|
+
attr_reader :code, :response_headers, :response_body
|
15
|
+
|
16
|
+
# Usage examples:
|
17
|
+
# ApiError.new
|
18
|
+
# ApiError.new("message")
|
19
|
+
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
20
|
+
# ApiError.new(:code => 404, :message => "Not Found")
|
21
|
+
def initialize(arg = nil)
|
22
|
+
if arg.is_a? Hash
|
23
|
+
if arg.key?(:message) || arg.key?('message')
|
24
|
+
super(arg[:message] || arg['message'])
|
25
|
+
else
|
26
|
+
super arg
|
27
|
+
end
|
28
|
+
|
29
|
+
arg.each do |k, v|
|
30
|
+
instance_variable_set "@#{k}", v
|
31
|
+
end
|
32
|
+
else
|
33
|
+
super arg
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -35,7 +35,7 @@ module DocuSign_Click
|
|
35
35
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
36
36
|
def initialize(config = Configuration.default)
|
37
37
|
@config = config
|
38
|
-
@user_agent = "Swagger-Codegen/1.
|
38
|
+
@user_agent = "Swagger-Codegen/1.2.2/ruby"
|
39
39
|
@default_headers = {
|
40
40
|
'Content-Type' => "application/json",
|
41
41
|
'User-Agent' => @user_agent
|
@@ -16,6 +16,9 @@ module DocuSign_Click
|
|
16
16
|
#
|
17
17
|
attr_accessor :clickwrap_name
|
18
18
|
|
19
|
+
#
|
20
|
+
attr_accessor :data_fields
|
21
|
+
|
19
22
|
attr_accessor :display_settings
|
20
23
|
|
21
24
|
#
|
@@ -54,6 +57,7 @@ module DocuSign_Click
|
|
54
57
|
def self.attribute_map
|
55
58
|
{
|
56
59
|
:'clickwrap_name' => :'clickwrapName',
|
60
|
+
:'data_fields' => :'dataFields',
|
57
61
|
:'display_settings' => :'displaySettings',
|
58
62
|
:'documents' => :'documents',
|
59
63
|
:'fields_to_null' => :'fieldsToNull',
|
@@ -73,6 +77,7 @@ module DocuSign_Click
|
|
73
77
|
def self.swagger_types
|
74
78
|
{
|
75
79
|
:'clickwrap_name' => :'String',
|
80
|
+
:'data_fields' => :'Array<DataField>',
|
76
81
|
:'display_settings' => :'DisplaySettings',
|
77
82
|
:'documents' => :'Array<Document>',
|
78
83
|
:'fields_to_null' => :'String',
|
@@ -82,7 +87,7 @@ module DocuSign_Click
|
|
82
87
|
:'require_reacceptance' => :'BOOLEAN',
|
83
88
|
:'scheduled_date' => :'Object',
|
84
89
|
:'scheduled_reacceptance' => :'ClickwrapScheduledReacceptance',
|
85
|
-
:'status' => :'
|
90
|
+
:'status' => :'String',
|
86
91
|
:'transfer_from_user_id' => :'String',
|
87
92
|
:'transfer_to_user_id' => :'String'
|
88
93
|
}
|
@@ -100,6 +105,12 @@ module DocuSign_Click
|
|
100
105
|
self.clickwrap_name = attributes[:'clickwrapName']
|
101
106
|
end
|
102
107
|
|
108
|
+
if attributes.has_key?(:'dataFields')
|
109
|
+
if (value = attributes[:'dataFields']).is_a?(Array)
|
110
|
+
self.data_fields = value
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
103
114
|
if attributes.has_key?(:'displaySettings')
|
104
115
|
self.display_settings = attributes[:'displaySettings']
|
105
116
|
end
|
@@ -170,6 +181,7 @@ module DocuSign_Click
|
|
170
181
|
return true if self.equal?(o)
|
171
182
|
self.class == o.class &&
|
172
183
|
clickwrap_name == o.clickwrap_name &&
|
184
|
+
data_fields == o.data_fields &&
|
173
185
|
display_settings == o.display_settings &&
|
174
186
|
documents == o.documents &&
|
175
187
|
fields_to_null == o.fields_to_null &&
|
@@ -193,7 +205,7 @@ module DocuSign_Click
|
|
193
205
|
# Calculates hash code according to all attributes.
|
194
206
|
# @return [Fixnum] Hash code
|
195
207
|
def hash
|
196
|
-
[clickwrap_name, display_settings, documents, fields_to_null, is_major_version, is_shared, name, require_reacceptance, scheduled_date, scheduled_reacceptance, status, transfer_from_user_id, transfer_to_user_id].hash
|
208
|
+
[clickwrap_name, data_fields, display_settings, documents, fields_to_null, is_major_version, is_shared, name, require_reacceptance, scheduled_date, scheduled_reacceptance, status, transfer_from_user_id, transfer_to_user_id].hash
|
197
209
|
end
|
198
210
|
|
199
211
|
# Builds the object from hash
|
@@ -19,6 +19,9 @@ module DocuSign_Click
|
|
19
19
|
#
|
20
20
|
attr_accessor :created_time
|
21
21
|
|
22
|
+
#
|
23
|
+
attr_accessor :data_fields
|
24
|
+
|
22
25
|
#
|
23
26
|
attr_accessor :last_modified
|
24
27
|
|
@@ -50,6 +53,7 @@ module DocuSign_Click
|
|
50
53
|
{
|
51
54
|
:'clickwrap_version_id' => :'clickwrapVersionId',
|
52
55
|
:'created_time' => :'createdTime',
|
56
|
+
:'data_fields' => :'dataFields',
|
53
57
|
:'last_modified' => :'lastModified',
|
54
58
|
:'last_modified_by' => :'lastModifiedBy',
|
55
59
|
:'owner_user_id' => :'ownerUserId',
|
@@ -67,6 +71,7 @@ module DocuSign_Click
|
|
67
71
|
{
|
68
72
|
:'clickwrap_version_id' => :'String',
|
69
73
|
:'created_time' => :'Object',
|
74
|
+
:'data_fields' => :'Array<DataField>',
|
70
75
|
:'last_modified' => :'Object',
|
71
76
|
:'last_modified_by' => :'String',
|
72
77
|
:'owner_user_id' => :'String',
|
@@ -95,6 +100,12 @@ module DocuSign_Click
|
|
95
100
|
self.created_time = attributes[:'createdTime']
|
96
101
|
end
|
97
102
|
|
103
|
+
if attributes.has_key?(:'dataFields')
|
104
|
+
if (value = attributes[:'dataFields']).is_a?(Array)
|
105
|
+
self.data_fields = value
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
98
109
|
if attributes.has_key?(:'lastModified')
|
99
110
|
self.last_modified = attributes[:'lastModified']
|
100
111
|
end
|
@@ -152,6 +163,7 @@ module DocuSign_Click
|
|
152
163
|
self.class == o.class &&
|
153
164
|
clickwrap_version_id == o.clickwrap_version_id &&
|
154
165
|
created_time == o.created_time &&
|
166
|
+
data_fields == o.data_fields &&
|
155
167
|
last_modified == o.last_modified &&
|
156
168
|
last_modified_by == o.last_modified_by &&
|
157
169
|
owner_user_id == o.owner_user_id &&
|
@@ -172,7 +184,7 @@ module DocuSign_Click
|
|
172
184
|
# Calculates hash code according to all attributes.
|
173
185
|
# @return [Fixnum] Hash code
|
174
186
|
def hash
|
175
|
-
[clickwrap_version_id, created_time, last_modified, last_modified_by, owner_user_id, require_reacceptance, scheduled_date, scheduled_reacceptance, status, version_id, version_number].hash
|
187
|
+
[clickwrap_version_id, created_time, data_fields, last_modified, last_modified_by, owner_user_id, require_reacceptance, scheduled_date, scheduled_reacceptance, status, version_id, version_number].hash
|
176
188
|
end
|
177
189
|
|
178
190
|
# Builds the object from hash
|