docspring 1.3.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/Gemfile.lock +3 -8
  4. data/LICENSE +1 -1
  5. data/README.md +13 -5
  6. data/docs/CombinePdfsData.md +1 -0
  7. data/docs/CombinedSubmission.md +1 -0
  8. data/docs/CombinedSubmissionData.md +1 -0
  9. data/docs/CopyTemplateData.md +9 -0
  10. data/docs/ListSubmissionsResponse.md +10 -0
  11. data/docs/MoveTemplateData.md +1 -1
  12. data/docs/PDFApi.md +232 -4
  13. data/docs/SubmissionData.md +1 -0
  14. data/docs/SubmissionDataRequest.md +1 -0
  15. data/docs/Template1.md +46 -0
  16. data/docs/Template1Defaults.md +10 -0
  17. data/docspring.gemspec +1 -2
  18. data/lib/docspring/api/pdf_api.rb +244 -2
  19. data/lib/docspring/api_client.rb +1 -1
  20. data/lib/docspring/configuration.rb +1 -2
  21. data/lib/docspring/models/combine_pdfs_data.rb +10 -1
  22. data/lib/docspring/models/combined_submission.rb +10 -1
  23. data/lib/docspring/models/combined_submission_data.rb +10 -1
  24. data/lib/docspring/models/copy_template_data.rb +197 -0
  25. data/lib/docspring/models/list_submissions_response.rb +203 -0
  26. data/lib/docspring/models/move_template_data.rb +5 -0
  27. data/lib/docspring/models/submission_data.rb +10 -1
  28. data/lib/docspring/models/submission_data_request.rb +15 -1
  29. data/lib/docspring/models/template1.rb +565 -0
  30. data/lib/docspring/models/template1_defaults.rb +201 -0
  31. data/lib/docspring/version.rb +1 -1
  32. data/lib/docspring.rb +4 -0
  33. data/spec/api/client_integration_spec.rb +1 -1
  34. data/spec/api/pdf_api_spec_original.skipped.rb +78 -2
  35. data/spec/models/combine_pdfs_data_spec.rb +6 -0
  36. data/spec/models/combined_submission_data_spec.rb +6 -0
  37. data/spec/models/combined_submission_spec.rb +6 -0
  38. data/spec/models/copy_template_data_spec.rb +47 -0
  39. data/spec/models/list_submissions_response_spec.rb +53 -0
  40. data/spec/models/submission_data_request_spec.rb +6 -0
  41. data/spec/models/submission_data_spec.rb +6 -0
  42. data/spec/models/template1_defaults_spec.rb +53 -0
  43. data/spec/models/template1_spec.rb +273 -0
  44. metadata +23 -27
@@ -0,0 +1,201 @@
1
+ =begin
2
+ #API v1
3
+
4
+ #DocSpring is a service that helps you fill out and sign PDF templates.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DocSpring
16
+ class Template1Defaults
17
+ attr_accessor :color
18
+
19
+ attr_accessor :font_size
20
+
21
+ attr_accessor :typeface
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'color' => :'color',
27
+ :'font_size' => :'fontSize',
28
+ :'typeface' => :'typeface'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'color' => :'String',
36
+ :'font_size' => :'Float',
37
+ :'typeface' => :'String'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
48
+
49
+ if attributes.has_key?(:'color')
50
+ self.color = attributes[:'color']
51
+ end
52
+
53
+ if attributes.has_key?(:'fontSize')
54
+ self.font_size = attributes[:'fontSize']
55
+ end
56
+
57
+ if attributes.has_key?(:'typeface')
58
+ self.typeface = attributes[:'typeface']
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ invalid_properties
67
+ end
68
+
69
+ # Check to see if the all the properties in the model are valid
70
+ # @return true if the model is valid
71
+ def valid?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ color == o.color &&
81
+ font_size == o.font_size &&
82
+ typeface == o.typeface
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Fixnum] Hash code
93
+ def hash
94
+ [color, font_size, typeface].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def build_from_hash(attributes)
101
+ return nil unless attributes.is_a?(Hash)
102
+ self.class.openapi_types.each_pair do |key, type|
103
+ if type =~ /\AArray<(.*)>/i
104
+ # check to ensure the input is an array given that the the attribute
105
+ # is documented as an array but the input is not
106
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
107
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
108
+ end
109
+ elsif !attributes[self.class.attribute_map[key]].nil?
110
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
111
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
112
+ end
113
+
114
+ self
115
+ end
116
+
117
+ # Deserializes the data based on type
118
+ # @param string type Data type
119
+ # @param string value Value to be deserialized
120
+ # @return [Object] Deserialized data
121
+ def _deserialize(type, value)
122
+ case type.to_sym
123
+ when :DateTime
124
+ DateTime.parse(value)
125
+ when :Date
126
+ Date.parse(value)
127
+ when :String
128
+ value.to_s
129
+ when :Integer
130
+ value.to_i
131
+ when :Float
132
+ value.to_f
133
+ when :BOOLEAN
134
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
135
+ true
136
+ else
137
+ false
138
+ end
139
+ when :Object
140
+ # generic object (usually a Hash), return directly
141
+ value
142
+ when /\AArray<(?<inner_type>.+)>\z/
143
+ inner_type = Regexp.last_match[:inner_type]
144
+ value.map { |v| _deserialize(inner_type, v) }
145
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
146
+ k_type = Regexp.last_match[:k_type]
147
+ v_type = Regexp.last_match[:v_type]
148
+ {}.tap do |hash|
149
+ value.each do |k, v|
150
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
151
+ end
152
+ end
153
+ else # model
154
+ temp_model = DocSpring.const_get(type).new
155
+ temp_model.build_from_hash(value)
156
+ end
157
+ end
158
+
159
+ # Returns the string representation of the object
160
+ # @return [String] String presentation of the object
161
+ def to_s
162
+ to_hash.to_s
163
+ end
164
+
165
+ # to_body is an alias to to_hash (backward compatibility)
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_body
168
+ to_hash
169
+ end
170
+
171
+ # Returns the object in the form of hash
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_hash
174
+ hash = {}
175
+ self.class.attribute_map.each_pair do |attr, param|
176
+ value = self.send(attr)
177
+ next if value.nil?
178
+ hash[param] = _to_hash(value)
179
+ end
180
+ hash
181
+ end
182
+
183
+ # Outputs non-array value in the form of hash
184
+ # For object, use to_hash. Otherwise, just return the value
185
+ # @param [Object] value Any valid value
186
+ # @return [Hash] Returns the value in the form of hash
187
+ def _to_hash(value)
188
+ if value.is_a?(Array)
189
+ value.compact.map { |v| _to_hash(v) }
190
+ elsif value.is_a?(Hash)
191
+ {}.tap do |hash|
192
+ value.each { |k, v| hash[k] = _to_hash(v) }
193
+ end
194
+ elsif value.respond_to? :to_hash
195
+ value.to_hash
196
+ else
197
+ value
198
+ end
199
+ end
200
+ end
201
+ end
@@ -11,5 +11,5 @@ OpenAPI Generator version: 3.3.0
11
11
  =end
12
12
 
13
13
  module DocSpring
14
- VERSION = '1.3.0'
14
+ VERSION = '1.4.1'
15
15
  end
data/lib/docspring.rb CHANGED
@@ -25,6 +25,7 @@ require 'docspring/models/combine_pdfs_data'
25
25
  require 'docspring/models/combined_submission'
26
26
  require 'docspring/models/combined_submission_action'
27
27
  require 'docspring/models/combined_submission_data'
28
+ require 'docspring/models/copy_template_data'
28
29
  require 'docspring/models/create_combined_submission_response'
29
30
  require 'docspring/models/create_custom_file_data'
30
31
  require 'docspring/models/create_custom_file_response'
@@ -43,6 +44,7 @@ require 'docspring/models/folder'
43
44
  require 'docspring/models/folders_folder'
44
45
  require 'docspring/models/html_template_data'
45
46
  require 'docspring/models/invalid_request'
47
+ require 'docspring/models/list_submissions_response'
46
48
  require 'docspring/models/move_folder_data'
47
49
  require 'docspring/models/move_template_data'
48
50
  require 'docspring/models/pending_template'
@@ -55,6 +57,8 @@ require 'docspring/models/submission_data'
55
57
  require 'docspring/models/submission_data_batch_request'
56
58
  require 'docspring/models/submission_data_request'
57
59
  require 'docspring/models/template'
60
+ require 'docspring/models/template1'
61
+ require 'docspring/models/template1_defaults'
58
62
  require 'docspring/models/template_data'
59
63
  require 'docspring/models/templatestemplate_idadd_fields_fields'
60
64
  require 'docspring/models/update_data_request_response'
@@ -55,7 +55,7 @@ describe DocSpring::Client do
55
55
  )
56
56
  }.to raise_error(
57
57
  DocSpring::ApiError,
58
- 'Unprocessable Entity: The root object did not contain a ' \
58
+ 'Unprocessable Entity: Your submission data did not contain a ' \
59
59
  "required property of 'description'"
60
60
  )
61
61
  end
@@ -102,6 +102,20 @@ describe 'PDFApi' do
102
102
  expect(result).to_not be_nil
103
103
  end
104
104
  end
105
+ # integration tests for copy_template
106
+ # Copy a Template
107
+ # @param template_id
108
+ # @param copy_template_data
109
+ # @param [Hash] opts the optional parameters
110
+ # @return [Template]
111
+ describe 'copy_template test' do
112
+ it 'should work' do
113
+ template_id = 'tpl_000000000000000001' # String |
114
+ copy_template_data = DocSpring::CopyTemplateData.new # CopyTemplateData |
115
+ result = api_instance.copy_template(template_id, copy_template_data)
116
+ expect(result).to_not be_nil
117
+ end
118
+ end
105
119
  # integration tests for create_custom_file_from_upload
106
120
  # Create a new custom file from a cached presign upload
107
121
  # @param create_custom_file_data
@@ -254,6 +268,18 @@ describe 'PDFApi' do
254
268
  expect(result).to_not be_nil
255
269
  end
256
270
  end
271
+ # integration tests for get_full_template
272
+ # Fetch the full template attributes
273
+ # @param template_id
274
+ # @param [Hash] opts the optional parameters
275
+ # @return [Template1]
276
+ describe 'get_full_template test' do
277
+ it 'should work' do
278
+ template_id = 'tpl_000000000000000001' # String |
279
+ result = api_instance.get_full_template(template_id)
280
+ expect(result).to_not be_nil
281
+ end
282
+ end
257
283
  # integration tests for get_presign_url
258
284
  # Get a presigned URL so that you can upload a file to our AWS S3 bucket
259
285
  # @param [Hash] opts the optional parameters
@@ -297,13 +323,13 @@ describe 'PDFApi' do
297
323
  end
298
324
  end
299
325
  # integration tests for get_template
300
- # Get a single template
326
+ # Check the status of an uploaded template
301
327
  # @param template_id
302
328
  # @param [Hash] opts the optional parameters
303
329
  # @return [Template]
304
330
  describe 'get_template test' do
305
331
  it 'should work' do
306
- template_id = 'tpl_000000000000000011' # String |
332
+ template_id = 'tpl_000000000000000001' # String |
307
333
  result = api_instance.get_template(template_id)
308
334
  expect(result).to_not be_nil
309
335
  end
@@ -334,6 +360,56 @@ describe 'PDFApi' do
334
360
  expect(result).to_not be_nil
335
361
  end
336
362
  end
363
+ # integration tests for list_submissions
364
+ # List all submissions
365
+ # @param [Hash] opts the optional parameters
366
+ # @option opts [String] :cursor
367
+ # @option opts [Float] :limit
368
+ # @option opts [String] :created_after
369
+ # @option opts [String] :created_before
370
+ # @option opts [String] :type
371
+ # @option opts [BOOLEAN] :include_data
372
+ # @return [ListSubmissionsResponse]
373
+ describe 'list_submissions test' do
374
+ it 'should work' do
375
+ opts = {
376
+ cursor: 'sub_list_000012', # String |
377
+ limit: 3, # Float |
378
+ created_after: '2019-01-01T09:00:00-05:00', # String |
379
+ created_before: '2020-01-01T09:00:00-05:00', # String |
380
+ type: 'test', # String |
381
+ include_data: true # BOOLEAN |
382
+ }
383
+ result = api_instance.list_submissions(opts)
384
+ expect(result).to_not be_nil
385
+ end
386
+ end
387
+ # integration tests for list_submissions_0
388
+ # List all submissions for a given template
389
+ # @param template_id
390
+ # @param [Hash] opts the optional parameters
391
+ # @option opts [String] :cursor
392
+ # @option opts [Float] :limit
393
+ # @option opts [String] :created_after
394
+ # @option opts [String] :created_before
395
+ # @option opts [String] :type
396
+ # @option opts [BOOLEAN] :include_data
397
+ # @return [ListSubmissionsResponse]
398
+ describe 'list_submissions_0 test' do
399
+ it 'should work' do
400
+ template_id = 'tpl_000000000000000002' # String |
401
+ opts = {
402
+ cursor: 'cursor_example', # String |
403
+ limit: 3.4, # Float |
404
+ created_after: 'created_after_example', # String |
405
+ created_before: 'created_before_example', # String |
406
+ type: 'type_example', # String |
407
+ include_data: true # BOOLEAN |
408
+ }
409
+ result = api_instance.list_submissions_0(template_id, opts)
410
+ expect(result).to_not be_nil
411
+ end
412
+ end
337
413
  # integration tests for list_templates
338
414
  # Get a list of all templates
339
415
  # @param [Hash] opts the optional parameters
@@ -50,6 +50,12 @@ describe 'CombinePdfsData' do
50
50
  end
51
51
  end
52
52
 
53
+ describe 'test attribute "password"' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
53
59
  describe 'test attribute "source_pdfs"' do
54
60
  it 'should work' do
55
61
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
@@ -44,6 +44,12 @@ describe 'CombinedSubmissionData' do
44
44
  end
45
45
  end
46
46
 
47
+ describe 'test attribute "password"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
47
53
  describe 'test attribute "submission_ids"' do
48
54
  it 'should work' do
49
55
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
@@ -38,6 +38,12 @@ describe 'CombinedSubmission' do
38
38
  end
39
39
  end
40
40
 
41
+ describe 'test attribute "password"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
41
47
  describe 'test attribute "expired"' do
42
48
  it 'should work' do
43
49
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
@@ -0,0 +1,47 @@
1
+ =begin
2
+ #API v1
3
+
4
+ #DocSpring is a service that helps you fill out and sign PDF templates.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for DocSpring::CopyTemplateData
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe 'CopyTemplateData' do
21
+ before do
22
+ # run before each test
23
+ @instance = DocSpring::CopyTemplateData.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of CopyTemplateData' do
31
+ it 'should create an instance of CopyTemplateData' do
32
+ expect(@instance).to be_instance_of(DocSpring::CopyTemplateData)
33
+ end
34
+ end
35
+ describe 'test attribute "name"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "parent_folder_id"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ end
@@ -0,0 +1,53 @@
1
+ =begin
2
+ #API v1
3
+
4
+ #DocSpring is a service that helps you fill out and sign PDF templates.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for DocSpring::ListSubmissionsResponse
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe 'ListSubmissionsResponse' do
21
+ before do
22
+ # run before each test
23
+ @instance = DocSpring::ListSubmissionsResponse.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of ListSubmissionsResponse' do
31
+ it 'should create an instance of ListSubmissionsResponse' do
32
+ expect(@instance).to be_instance_of(DocSpring::ListSubmissionsResponse)
33
+ end
34
+ end
35
+ describe 'test attribute "next_cursor"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "submissions"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "limit"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ end
@@ -56,6 +56,12 @@ describe 'SubmissionDataRequest' do
56
56
  end
57
57
  end
58
58
 
59
+ describe 'test attribute "sort_order"' do
60
+ it 'should work' do
61
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
+ end
63
+ end
64
+
59
65
  describe 'test attribute "fields"' do
60
66
  it 'should work' do
61
67
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
@@ -68,6 +68,12 @@ describe 'SubmissionData' do
68
68
  end
69
69
  end
70
70
 
71
+ describe 'test attribute "password"' do
72
+ it 'should work' do
73
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
74
+ end
75
+ end
76
+
71
77
  describe 'test attribute "test"' do
72
78
  it 'should work' do
73
79
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
@@ -0,0 +1,53 @@
1
+ =begin
2
+ #API v1
3
+
4
+ #DocSpring is a service that helps you fill out and sign PDF templates.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for DocSpring::Template1Defaults
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe 'Template1Defaults' do
21
+ before do
22
+ # run before each test
23
+ @instance = DocSpring::Template1Defaults.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of Template1Defaults' do
31
+ it 'should create an instance of Template1Defaults' do
32
+ expect(@instance).to be_instance_of(DocSpring::Template1Defaults)
33
+ end
34
+ end
35
+ describe 'test attribute "color"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "font_size"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "typeface"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ end