docusign_click 1.0.0.beta → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -1
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/docusign_click.gemspec +9 -6
- data/lib/docusign_click/api/accounts_api.rb +35 -280
- 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 +19 -14
- data/lib/docusign_click/client/api_error.rb +3 -3
- data/lib/docusign_click/client/auth/oauth.rb +1 -1
- data/lib/docusign_click/configuration.rb +2 -1
- data/lib/docusign_click/models/clickwrap_request.rb +17 -7
- data/lib/docusign_click/models/display_settings.rb +1 -11
- data/lib/docusign_click/models/document_data.rb +225 -0
- data/lib/docusign_click/models/user_agreement_request.rb +1 -11
- data/lib/docusign_click/version.rb +1 -1
- data/runLinter.sh +1 -0
- data/tests/spec/unit_tests_using_jwt_spec.rb +2 -1
- metadata +83 -27
- data/Gemfile.lock +0 -69
- data/docusign_click-1.0.0.pre.alpha.gem +0 -0
- data/docusign_click-1.0.0.rc1.gem +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/docusign_click/.DS_Store +0 -0
- data/lib/docusign_click/api/.DS_Store +0 -0
- data/lib/docusign_click/client/.DS_Store +0 -0
- data/tests/Gemfile.lock +0 -42
- data/tests/docs/private.pem +0 -27
@@ -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
|
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#DocuSign Click
|
2
|
+
#DocuSign Click API
|
3
3
|
|
4
|
-
#
|
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
5
|
|
6
|
-
OpenAPI spec version:
|
6
|
+
OpenAPI spec version: v1
|
7
7
|
Contact: devcenter@docusign.com
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
|
@@ -16,6 +16,7 @@ require 'tempfile'
|
|
16
16
|
require 'typhoeus'
|
17
17
|
require 'uri'
|
18
18
|
require 'jwt'
|
19
|
+
require 'addressable/uri'
|
19
20
|
|
20
21
|
module DocuSign_Click
|
21
22
|
class ApiClient
|
@@ -34,7 +35,7 @@ module DocuSign_Click
|
|
34
35
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
35
36
|
def initialize(config = Configuration.default)
|
36
37
|
@config = config
|
37
|
-
@user_agent = "Swagger-Codegen
|
38
|
+
@user_agent = "Swagger-Codegen/1.1.0/ruby"
|
38
39
|
@default_headers = {
|
39
40
|
'Content-Type' => "application/json",
|
40
41
|
'User-Agent' => @user_agent
|
@@ -259,8 +260,8 @@ module DocuSign_Click
|
|
259
260
|
def build_request_url(path, opts)
|
260
261
|
# Add leading and trailing slashes to path
|
261
262
|
path = "/#{path}".gsub(/\/+/, '/')
|
262
|
-
return URI.encode("https://" + self.get_oauth_base_path + path) if opts[:oauth]
|
263
|
-
URI.encode(@config.base_url + path)
|
263
|
+
return Addressable::URI.encode("https://" + self.get_oauth_base_path + path) if opts[:oauth]
|
264
|
+
Addressable::URI.encode(@config.base_url + path)
|
264
265
|
end
|
265
266
|
|
266
267
|
# Builds the HTTP request body
|
@@ -391,8 +392,11 @@ module DocuSign_Click
|
|
391
392
|
# Helper method to set oauth base path
|
392
393
|
# @param [String] oauth_base_path if passed nil it will determined from base_path
|
393
394
|
def set_oauth_base_path(oauth_base_path=nil)
|
394
|
-
|
395
|
-
|
395
|
+
if oauth_base_path
|
396
|
+
raise ArgumentError.new('OAuth base path should only include domain name (without https://)') if oauth_base_path.include? "//"
|
397
|
+
self.oauth_base_path = oauth_base_path
|
398
|
+
return
|
399
|
+
end
|
396
400
|
|
397
401
|
# did we need this check as we can determine it from base path
|
398
402
|
#raise ArgumentError.new('oAuthBasePath cannot be empty') unless oauth_base_path
|
@@ -571,13 +575,14 @@ module DocuSign_Click
|
|
571
575
|
:return_type => 'OAuth::OAuthToken',
|
572
576
|
:oauth => true
|
573
577
|
}
|
574
|
-
|
575
|
-
|
578
|
+
|
579
|
+
token, status_code, headers = self.call_api("POST", '/oauth/token', params)
|
576
580
|
|
577
|
-
|
581
|
+
if status_code == 200
|
582
|
+
self.default_headers.store('Authorization', "#{token.token_type} #{token.access_token}")
|
578
583
|
|
579
|
-
|
580
|
-
|
584
|
+
token
|
585
|
+
end
|
581
586
|
end
|
582
587
|
|
583
588
|
# Helper method to add default header params
|
@@ -587,4 +592,4 @@ module DocuSign_Click
|
|
587
592
|
@default_headers[header_name] = header_value
|
588
593
|
end
|
589
594
|
end
|
590
|
-
end
|
595
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#DocuSign Click
|
2
|
+
#DocuSign Click API
|
3
3
|
|
4
|
-
#
|
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
5
|
|
6
|
-
OpenAPI spec version:
|
6
|
+
OpenAPI spec version: v1
|
7
7
|
Contact: devcenter@docusign.com
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
|
@@ -10,6 +10,7 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
10
10
|
=end
|
11
11
|
|
12
12
|
require 'uri'
|
13
|
+
require 'addressable/uri'
|
13
14
|
|
14
15
|
module DocuSign_Click
|
15
16
|
class Configuration
|
@@ -168,7 +169,7 @@ module DocuSign_Click
|
|
168
169
|
|
169
170
|
def base_url
|
170
171
|
url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
171
|
-
URI.encode(url)
|
172
|
+
Addressable::URI.encode(url)
|
172
173
|
end
|
173
174
|
|
174
175
|
# Gets API key (with prefix if set).
|
@@ -25,7 +25,10 @@ module DocuSign_Click
|
|
25
25
|
attr_accessor :fields_to_null
|
26
26
|
|
27
27
|
#
|
28
|
-
attr_accessor :
|
28
|
+
attr_accessor :is_major_version
|
29
|
+
|
30
|
+
#
|
31
|
+
attr_accessor :is_shared
|
29
32
|
|
30
33
|
#
|
31
34
|
attr_accessor :name
|
@@ -54,7 +57,8 @@ module DocuSign_Click
|
|
54
57
|
:'display_settings' => :'displaySettings',
|
55
58
|
:'documents' => :'documents',
|
56
59
|
:'fields_to_null' => :'fieldsToNull',
|
57
|
-
:'
|
60
|
+
:'is_major_version' => :'isMajorVersion',
|
61
|
+
:'is_shared' => :'isShared',
|
58
62
|
:'name' => :'name',
|
59
63
|
:'require_reacceptance' => :'requireReacceptance',
|
60
64
|
:'scheduled_date' => :'scheduledDate',
|
@@ -72,7 +76,8 @@ module DocuSign_Click
|
|
72
76
|
:'display_settings' => :'DisplaySettings',
|
73
77
|
:'documents' => :'Array<Document>',
|
74
78
|
:'fields_to_null' => :'String',
|
75
|
-
:'
|
79
|
+
:'is_major_version' => :'BOOLEAN',
|
80
|
+
:'is_shared' => :'BOOLEAN',
|
76
81
|
:'name' => :'String',
|
77
82
|
:'require_reacceptance' => :'BOOLEAN',
|
78
83
|
:'scheduled_date' => :'Object',
|
@@ -109,8 +114,12 @@ module DocuSign_Click
|
|
109
114
|
self.fields_to_null = attributes[:'fieldsToNull']
|
110
115
|
end
|
111
116
|
|
112
|
-
if attributes.has_key?(:'
|
113
|
-
self.
|
117
|
+
if attributes.has_key?(:'isMajorVersion')
|
118
|
+
self.is_major_version = attributes[:'isMajorVersion']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'isShared')
|
122
|
+
self.is_shared = attributes[:'isShared']
|
114
123
|
end
|
115
124
|
|
116
125
|
if attributes.has_key?(:'name')
|
@@ -164,7 +173,8 @@ module DocuSign_Click
|
|
164
173
|
display_settings == o.display_settings &&
|
165
174
|
documents == o.documents &&
|
166
175
|
fields_to_null == o.fields_to_null &&
|
167
|
-
|
176
|
+
is_major_version == o.is_major_version &&
|
177
|
+
is_shared == o.is_shared &&
|
168
178
|
name == o.name &&
|
169
179
|
require_reacceptance == o.require_reacceptance &&
|
170
180
|
scheduled_date == o.scheduled_date &&
|
@@ -183,7 +193,7 @@ module DocuSign_Click
|
|
183
193
|
# Calculates hash code according to all attributes.
|
184
194
|
# @return [Fixnum] Hash code
|
185
195
|
def hash
|
186
|
-
[clickwrap_name, display_settings, documents, fields_to_null,
|
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
|
187
197
|
end
|
188
198
|
|
189
199
|
# Builds the object from hash
|
@@ -49,9 +49,6 @@ module DocuSign_Click
|
|
49
49
|
#
|
50
50
|
attr_accessor :has_decline_button
|
51
51
|
|
52
|
-
#
|
53
|
-
attr_accessor :host_origin
|
54
|
-
|
55
52
|
#
|
56
53
|
attr_accessor :must_read
|
57
54
|
|
@@ -82,7 +79,6 @@ module DocuSign_Click
|
|
82
79
|
:'downloadable' => :'downloadable',
|
83
80
|
:'format' => :'format',
|
84
81
|
:'has_decline_button' => :'hasDeclineButton',
|
85
|
-
:'host_origin' => :'hostOrigin',
|
86
82
|
:'must_read' => :'mustRead',
|
87
83
|
:'must_view' => :'mustView',
|
88
84
|
:'record_decline_responses' => :'recordDeclineResponses',
|
@@ -106,7 +102,6 @@ module DocuSign_Click
|
|
106
102
|
:'downloadable' => :'BOOLEAN',
|
107
103
|
:'format' => :'String',
|
108
104
|
:'has_decline_button' => :'BOOLEAN',
|
109
|
-
:'host_origin' => :'String',
|
110
105
|
:'must_read' => :'BOOLEAN',
|
111
106
|
:'must_view' => :'BOOLEAN',
|
112
107
|
:'record_decline_responses' => :'BOOLEAN',
|
@@ -173,10 +168,6 @@ module DocuSign_Click
|
|
173
168
|
self.has_decline_button = attributes[:'hasDeclineButton']
|
174
169
|
end
|
175
170
|
|
176
|
-
if attributes.has_key?(:'hostOrigin')
|
177
|
-
self.host_origin = attributes[:'hostOrigin']
|
178
|
-
end
|
179
|
-
|
180
171
|
if attributes.has_key?(:'mustRead')
|
181
172
|
self.must_read = attributes[:'mustRead']
|
182
173
|
end
|
@@ -228,7 +219,6 @@ module DocuSign_Click
|
|
228
219
|
downloadable == o.downloadable &&
|
229
220
|
format == o.format &&
|
230
221
|
has_decline_button == o.has_decline_button &&
|
231
|
-
host_origin == o.host_origin &&
|
232
222
|
must_read == o.must_read &&
|
233
223
|
must_view == o.must_view &&
|
234
224
|
record_decline_responses == o.record_decline_responses &&
|
@@ -245,7 +235,7 @@ module DocuSign_Click
|
|
245
235
|
# Calculates hash code according to all attributes.
|
246
236
|
# @return [Fixnum] Hash code
|
247
237
|
def hash
|
248
|
-
[action_button_alignment, allow_client_only, allowed_hosts, brand_id, consent_button_text, consent_text, decline_button_text, display_name, document_display, downloadable, format, has_decline_button,
|
238
|
+
[action_button_alignment, allow_client_only, allowed_hosts, brand_id, consent_button_text, consent_text, decline_button_text, display_name, document_display, downloadable, format, has_decline_button, must_read, must_view, record_decline_responses, require_accept, send_to_email].hash
|
249
239
|
end
|
250
240
|
|
251
241
|
# Builds the object from hash
|