form_api 0.1.4 → 0.1.5
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 +8 -0
- data/README.md +12 -1
- data/examples/generate_and_download_pdf.rb +0 -1
- data/form_api.gemspec +8 -1
- data/lib/form_api.rb +1 -0
- data/lib/form_api/api/pdf_api.rb +47 -0
- data/lib/form_api/models/inline_response_200.rb +226 -0
- data/lib/form_api/version.rb +1 -1
- data/scripts/release +1 -2
- data/spec/api/client_spec.rb +28 -0
- data/spec/api/pdf_api_spec.rb +52 -4
- data/spec/configuration_spec.rb +3 -3
- data/spec/models/data_spec.rb +19 -1
- data/spec/models/{inline_response_302_spec.rb → inline_response_200_spec.rb} +11 -7
- data/spec/models/inline_response_201_spec.rb +1 -1
- data/spec/models/inline_response_401_spec.rb +0 -10
- data/spec/spec_helper.rb +11 -0
- data/spec/vcr_cassettes/FormAPI_Client/should_generate_a_PDF_and_wait_for_the_submission_to_be_processed.yml +127 -0
- data/swagger-config.json +1 -1
- metadata +28 -16
- data/spec/models/inline_response_201_submission_spec.rb +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '00169a4fbb7ab1b2beb13f813f396f46dcc2b085'
|
4
|
+
data.tar.gz: a13b337783a72f2e63485661d340d18ead404619
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b59bb93e0c541f0149d58f3fb5d9b6184337a8cbffecfb5ed993aaab97d94fff4228859cd1db49af3adb3592193ed45798d720d90d47c23a2d83c94469cea393
|
7
|
+
data.tar.gz: 60076f7208a1398837a4a417c9abe6764b3c2a2d41c473647f9c213d4de6efd87c0b8b7e1789d08bf4ab08ad71ea45c158410afe6b23c506cd814cd72bab65b4
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,7 +1,18 @@
|
|
1
1
|
# FormAPI Ruby Client
|
2
2
|
|
3
|
-
|
3
|
+
[](https://travis-ci.org/FormAPI/formapi-ruby)
|
4
4
|
|
5
|
+
The `form_api` gem is an API client library for [FormAPI](https://formapi.io).
|
6
|
+
You can use FormAPI to generate PDFs. Configure your PDF template in our online editor,
|
7
|
+
then post data to fill out the PDF.
|
8
|
+
|
9
|
+
## Supported Ruby Versions
|
10
|
+
|
11
|
+
The `form_api` gem supports Ruby >= `1.9.3`. We run our tests with the following Ruby versions:
|
12
|
+
|
13
|
+
* `1.9.3`
|
14
|
+
* `2.1.10`
|
15
|
+
* `2.4.2`
|
5
16
|
|
6
17
|
## Installation
|
7
18
|
|
data/form_api.gemspec
CHANGED
@@ -33,6 +33,8 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
|
34
34
|
s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
|
35
35
|
s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
|
36
|
+
# This version of addressable is required for Ruby 1.9.3 support
|
37
|
+
s.add_development_dependency 'addressable', '~> 2.4.0'
|
36
38
|
s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
|
37
39
|
s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
|
38
40
|
s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
|
@@ -40,7 +42,12 @@ Gem::Specification.new do |s|
|
|
40
42
|
|
41
43
|
# added by script/fix_gemspec.rb.
|
42
44
|
s.add_development_dependency 'rake', '~>11.2', '>= 11.2.2'
|
43
|
-
|
45
|
+
if RUBY_VERSION >= '2.2.0'
|
46
|
+
s.add_development_dependency 'pry-byebug'
|
47
|
+
else
|
48
|
+
s.add_development_dependency 'pry', '~>0.10', '>= 0.10.4'
|
49
|
+
end
|
50
|
+
|
44
51
|
# </added> : if the above lines are missing in the gemspec, then
|
45
52
|
# the matcher for autotest is probably broken
|
46
53
|
|
data/lib/form_api.rb
CHANGED
@@ -19,6 +19,7 @@ require 'form_api/configuration'
|
|
19
19
|
# Models
|
20
20
|
require 'form_api/models/data'
|
21
21
|
require 'form_api/models/data_1'
|
22
|
+
require 'form_api/models/inline_response_200'
|
22
23
|
require 'form_api/models/inline_response_201'
|
23
24
|
require 'form_api/models/inline_response_201_1'
|
24
25
|
require 'form_api/models/inline_response_201_1_submission'
|
data/lib/form_api/api/pdf_api.rb
CHANGED
@@ -339,5 +339,52 @@ module FormAPI
|
|
339
339
|
end
|
340
340
|
return data, status_code, headers
|
341
341
|
end
|
342
|
+
|
343
|
+
# Test Authentication
|
344
|
+
#
|
345
|
+
# @param [Hash] opts the optional parameters
|
346
|
+
# @return [InlineResponse200]
|
347
|
+
def test_authentication(opts = {})
|
348
|
+
data, _status_code, _headers = test_authentication_with_http_info(opts)
|
349
|
+
return data
|
350
|
+
end
|
351
|
+
|
352
|
+
# Test Authentication
|
353
|
+
#
|
354
|
+
# @param [Hash] opts the optional parameters
|
355
|
+
# @return [Array<(InlineResponse200, Fixnum, Hash)>] InlineResponse200 data, response status code and response headers
|
356
|
+
def test_authentication_with_http_info(opts = {})
|
357
|
+
if @api_client.config.debugging
|
358
|
+
@api_client.config.logger.debug "Calling API: PDFApi.test_authentication ..."
|
359
|
+
end
|
360
|
+
# resource path
|
361
|
+
local_var_path = "/authentication"
|
362
|
+
|
363
|
+
# query parameters
|
364
|
+
query_params = {}
|
365
|
+
|
366
|
+
# header parameters
|
367
|
+
header_params = {}
|
368
|
+
# HTTP header 'Accept' (if needed)
|
369
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
370
|
+
|
371
|
+
# form parameters
|
372
|
+
form_params = {}
|
373
|
+
|
374
|
+
# http body (model)
|
375
|
+
post_body = nil
|
376
|
+
auth_names = ['basic']
|
377
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
378
|
+
:header_params => header_params,
|
379
|
+
:query_params => query_params,
|
380
|
+
:form_params => form_params,
|
381
|
+
:body => post_body,
|
382
|
+
:auth_names => auth_names,
|
383
|
+
:return_type => 'InlineResponse200')
|
384
|
+
if @api_client.config.debugging
|
385
|
+
@api_client.config.logger.debug "API called: PDFApi#test_authentication\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
386
|
+
end
|
387
|
+
return data, status_code, headers
|
388
|
+
end
|
342
389
|
end
|
343
390
|
end
|
@@ -0,0 +1,226 @@
|
|
1
|
+
=begin
|
2
|
+
#API V1
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module FormAPI
|
16
|
+
|
17
|
+
class InlineResponse200
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
class EnumAttributeValidator
|
21
|
+
attr_reader :datatype
|
22
|
+
attr_reader :allowable_values
|
23
|
+
|
24
|
+
def initialize(datatype, allowable_values)
|
25
|
+
@allowable_values = allowable_values.map do |value|
|
26
|
+
case datatype.to_s
|
27
|
+
when /Integer/i
|
28
|
+
value.to_i
|
29
|
+
when /Float/i
|
30
|
+
value.to_f
|
31
|
+
else
|
32
|
+
value
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def valid?(value)
|
38
|
+
!value || allowable_values.include?(value)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
43
|
+
def self.attribute_map
|
44
|
+
{
|
45
|
+
:'status' => :'status'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.swagger_types
|
51
|
+
{
|
52
|
+
:'status' => :'String'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Initializes the object
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
58
|
+
def initialize(attributes = {})
|
59
|
+
return unless attributes.is_a?(Hash)
|
60
|
+
|
61
|
+
# convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
63
|
+
|
64
|
+
if attributes.has_key?(:'status')
|
65
|
+
self.status = attributes[:'status']
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properies with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
invalid_properties = Array.new
|
74
|
+
if @status.nil?
|
75
|
+
invalid_properties.push("invalid value for 'status', status cannot be nil.")
|
76
|
+
end
|
77
|
+
|
78
|
+
return invalid_properties
|
79
|
+
end
|
80
|
+
|
81
|
+
# Check to see if the all the properties in the model are valid
|
82
|
+
# @return true if the model is valid
|
83
|
+
def valid?
|
84
|
+
return false if @status.nil?
|
85
|
+
status_validator = EnumAttributeValidator.new('String', ["success"])
|
86
|
+
return false unless status_validator.valid?(@status)
|
87
|
+
return true
|
88
|
+
end
|
89
|
+
|
90
|
+
# Custom attribute writer method checking allowed values (enum).
|
91
|
+
# @param [Object] status Object to be assigned
|
92
|
+
def status=(status)
|
93
|
+
validator = EnumAttributeValidator.new('String', ["success"])
|
94
|
+
unless validator.valid?(status)
|
95
|
+
fail ArgumentError, "invalid value for 'status', must be one of #{validator.allowable_values}."
|
96
|
+
end
|
97
|
+
@status = status
|
98
|
+
end
|
99
|
+
|
100
|
+
# Checks equality by comparing each attribute.
|
101
|
+
# @param [Object] Object to be compared
|
102
|
+
def ==(o)
|
103
|
+
return true if self.equal?(o)
|
104
|
+
self.class == o.class &&
|
105
|
+
status == o.status
|
106
|
+
end
|
107
|
+
|
108
|
+
# @see the `==` method
|
109
|
+
# @param [Object] Object to be compared
|
110
|
+
def eql?(o)
|
111
|
+
self == o
|
112
|
+
end
|
113
|
+
|
114
|
+
# Calculates hash code according to all attributes.
|
115
|
+
# @return [Fixnum] Hash code
|
116
|
+
def hash
|
117
|
+
[status].hash
|
118
|
+
end
|
119
|
+
|
120
|
+
# Builds the object from hash
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
122
|
+
# @return [Object] Returns the model itself
|
123
|
+
def build_from_hash(attributes)
|
124
|
+
return nil unless attributes.is_a?(Hash)
|
125
|
+
self.class.swagger_types.each_pair do |key, type|
|
126
|
+
if type =~ /\AArray<(.*)>/i
|
127
|
+
# check to ensure the input is an array given that the the attribute
|
128
|
+
# is documented as an array but the input is not
|
129
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
130
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
131
|
+
end
|
132
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
133
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
134
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
135
|
+
end
|
136
|
+
|
137
|
+
self
|
138
|
+
end
|
139
|
+
|
140
|
+
# Deserializes the data based on type
|
141
|
+
# @param string type Data type
|
142
|
+
# @param string value Value to be deserialized
|
143
|
+
# @return [Object] Deserialized data
|
144
|
+
def _deserialize(type, value)
|
145
|
+
case type.to_sym
|
146
|
+
when :DateTime
|
147
|
+
DateTime.parse(value)
|
148
|
+
when :Date
|
149
|
+
Date.parse(value)
|
150
|
+
when :String
|
151
|
+
value.to_s
|
152
|
+
when :Integer
|
153
|
+
value.to_i
|
154
|
+
when :Float
|
155
|
+
value.to_f
|
156
|
+
when :BOOLEAN
|
157
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
158
|
+
true
|
159
|
+
else
|
160
|
+
false
|
161
|
+
end
|
162
|
+
when :Object
|
163
|
+
# generic object (usually a Hash), return directly
|
164
|
+
value
|
165
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
166
|
+
inner_type = Regexp.last_match[:inner_type]
|
167
|
+
value.map { |v| _deserialize(inner_type, v) }
|
168
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
169
|
+
k_type = Regexp.last_match[:k_type]
|
170
|
+
v_type = Regexp.last_match[:v_type]
|
171
|
+
{}.tap do |hash|
|
172
|
+
value.each do |k, v|
|
173
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
else # model
|
177
|
+
temp_model = FormAPI.const_get(type).new
|
178
|
+
temp_model.build_from_hash(value)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the string representation of the object
|
183
|
+
# @return [String] String presentation of the object
|
184
|
+
def to_s
|
185
|
+
to_hash.to_s
|
186
|
+
end
|
187
|
+
|
188
|
+
# to_body is an alias to to_hash (backward compatibility)
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_body
|
191
|
+
to_hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Returns the object in the form of hash
|
195
|
+
# @return [Hash] Returns the object in the form of hash
|
196
|
+
def to_hash
|
197
|
+
hash = {}
|
198
|
+
self.class.attribute_map.each_pair do |attr, param|
|
199
|
+
value = self.send(attr)
|
200
|
+
next if value.nil?
|
201
|
+
hash[param] = _to_hash(value)
|
202
|
+
end
|
203
|
+
hash
|
204
|
+
end
|
205
|
+
|
206
|
+
# Outputs non-array value in the form of hash
|
207
|
+
# For object, use to_hash. Otherwise, just return the value
|
208
|
+
# @param [Object] value Any valid value
|
209
|
+
# @return [Hash] Returns the value in the form of hash
|
210
|
+
def _to_hash(value)
|
211
|
+
if value.is_a?(Array)
|
212
|
+
value.compact.map{ |v| _to_hash(v) }
|
213
|
+
elsif value.is_a?(Hash)
|
214
|
+
{}.tap do |hash|
|
215
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
216
|
+
end
|
217
|
+
elsif value.respond_to? :to_hash
|
218
|
+
value.to_hash
|
219
|
+
else
|
220
|
+
value
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|
data/lib/form_api/version.rb
CHANGED
data/scripts/release
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
describe FormAPI::Client, vcr: { record: :none } do
|
5
|
+
it 'should generate a PDF and wait for the submission to be processed' do
|
6
|
+
client = FormAPI::Client.new
|
7
|
+
client.api_client.config.username = 'yRaaR9JmTPtGX7EN'
|
8
|
+
client.api_client.config.password = 'IB3TRkSdm4f2BdtU_D3YgxjdMB7l-r2fOgvxD1Yzwec'
|
9
|
+
template_id = '6zz3dYRYM67fxMXA'
|
10
|
+
|
11
|
+
expect(client).to receive(:sleep).with(1).once
|
12
|
+
|
13
|
+
response = client.generate_pdf(
|
14
|
+
template_id: template_id,
|
15
|
+
data: {
|
16
|
+
first_name: 'John',
|
17
|
+
last_name: 'Smith',
|
18
|
+
favorite_color: 'Blue'
|
19
|
+
}
|
20
|
+
)
|
21
|
+
|
22
|
+
expect(response.status).to eq 'success'
|
23
|
+
submission = response.submission
|
24
|
+
# expect(submission.id).to eq 'jpZnjXmRtZYxsFx4'
|
25
|
+
expect(submission.state).to eq 'processed'
|
26
|
+
expect(submission.download_url).to include 'https://formapi-docs.s3.amazonaws.com/store/submissions'
|
27
|
+
end
|
28
|
+
end
|
data/spec/api/pdf_api_spec.rb
CHANGED
@@ -32,25 +32,73 @@ describe 'PDFApi' do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
# unit tests for combine_submissions
|
36
|
+
# Merge generated PDFs together
|
37
|
+
#
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @option opts [Data] :data
|
40
|
+
# @return [InlineResponse201]
|
41
|
+
describe 'combine_submissions test' 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
|
+
# unit tests for expire_combined_submission
|
48
|
+
# Expire a combined submission
|
49
|
+
#
|
50
|
+
# @param combined_submission_id
|
51
|
+
# @param [Hash] opts the optional parameters
|
52
|
+
# @return [InlineResponse201CombinedSubmission]
|
53
|
+
describe 'expire_combined_submission test' 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
|
+
|
59
|
+
# unit tests for expire_submission
|
60
|
+
# Expire a PDF submission
|
61
|
+
#
|
62
|
+
# @param submission_id
|
63
|
+
# @param [Hash] opts the optional parameters
|
64
|
+
# @return [InlineResponse2011Submission]
|
65
|
+
describe 'expire_submission test' do
|
66
|
+
it "should work" do
|
67
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
35
71
|
# unit tests for generate_pdf
|
36
72
|
# Generates a new PDF
|
37
73
|
#
|
38
74
|
# @param template_id
|
39
75
|
# @param [Hash] opts the optional parameters
|
40
|
-
# @option opts [
|
41
|
-
# @return [
|
76
|
+
# @option opts [Data1] :data
|
77
|
+
# @return [InlineResponse2011]
|
42
78
|
describe 'generate_pdf test' do
|
43
79
|
it "should work" do
|
44
80
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
45
81
|
end
|
46
82
|
end
|
47
83
|
|
84
|
+
# unit tests for get_combined_submission
|
85
|
+
# Check the status of a combined submission (merged PDFs)
|
86
|
+
#
|
87
|
+
# @param combined_submission_id
|
88
|
+
# @param [Hash] opts the optional parameters
|
89
|
+
# @return [InlineResponse201CombinedSubmission]
|
90
|
+
describe 'get_combined_submission test' do
|
91
|
+
it "should work" do
|
92
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
48
96
|
# unit tests for get_submission
|
49
|
-
# Check the status of a PDF
|
97
|
+
# Check the status of a PDF
|
50
98
|
#
|
51
99
|
# @param submission_id
|
52
100
|
# @param [Hash] opts the optional parameters
|
53
|
-
# @return [
|
101
|
+
# @return [InlineResponse2011Submission]
|
54
102
|
describe 'get_submission test' do
|
55
103
|
it "should work" do
|
56
104
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
data/spec/configuration_spec.rb
CHANGED
@@ -18,7 +18,7 @@ describe FormAPI::Configuration do
|
|
18
18
|
before(:each) do
|
19
19
|
# uncomment below to setup host and base_path
|
20
20
|
#require 'URI'
|
21
|
-
#uri = URI.parse("https://
|
21
|
+
#uri = URI.parse("https://app.formapi.io/api/v1")
|
22
22
|
#FormAPI.configure do |c|
|
23
23
|
# c.host = uri.host
|
24
24
|
# c.base_path = uri.path
|
@@ -28,14 +28,14 @@ describe FormAPI::Configuration do
|
|
28
28
|
describe '#base_url' do
|
29
29
|
it 'should have the default value' do
|
30
30
|
# uncomment below to test default value of the base path
|
31
|
-
#expect(config.base_url).to eq("https://
|
31
|
+
#expect(config.base_url).to eq("https://app.formapi.io/api/v1")
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should remove trailing slashes' do
|
35
35
|
[nil, '', '/', '//'].each do |base_path|
|
36
36
|
config.base_path = base_path
|
37
37
|
# uncomment below to test trailing slashes
|
38
|
-
#expect(config.base_url).to eq("https://
|
38
|
+
#expect(config.base_url).to eq("https://app.formapi.io/api/v1")
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
data/spec/models/data_spec.rb
CHANGED
@@ -32,7 +32,25 @@ describe 'Data' do
|
|
32
32
|
expect(@instance).to be_instance_of(FormAPI::Data)
|
33
33
|
end
|
34
34
|
end
|
35
|
-
describe 'test attribute "
|
35
|
+
describe 'test attribute "test"' 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 "submission_ids"' 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 "metadata"' 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
|
+
describe 'test attribute "expires_in"' do
|
36
54
|
it 'should work' do
|
37
55
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
56
|
end
|
@@ -14,27 +14,31 @@ require 'spec_helper'
|
|
14
14
|
require 'json'
|
15
15
|
require 'date'
|
16
16
|
|
17
|
-
# Unit tests for FormAPI::
|
17
|
+
# Unit tests for FormAPI::InlineResponse200
|
18
18
|
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
19
|
# Please update as you see appropriate
|
20
|
-
describe '
|
20
|
+
describe 'InlineResponse200' do
|
21
21
|
before do
|
22
22
|
# run before each test
|
23
|
-
@instance = FormAPI::
|
23
|
+
@instance = FormAPI::InlineResponse200.new
|
24
24
|
end
|
25
25
|
|
26
26
|
after do
|
27
27
|
# run after each test
|
28
28
|
end
|
29
29
|
|
30
|
-
describe 'test an instance of
|
31
|
-
it 'should create an instance of
|
32
|
-
expect(@instance).to be_instance_of(FormAPI::
|
30
|
+
describe 'test an instance of InlineResponse200' do
|
31
|
+
it 'should create an instance of InlineResponse200' do
|
32
|
+
expect(@instance).to be_instance_of(FormAPI::InlineResponse200)
|
33
33
|
end
|
34
34
|
end
|
35
|
-
describe 'test attribute "
|
35
|
+
describe 'test attribute "status"' do
|
36
36
|
it 'should work' do
|
37
37
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["success"])
|
39
|
+
#validator.allowable_values.each do |value|
|
40
|
+
# expect { @instance.status = value }.not_to raise_error
|
41
|
+
#end
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
@@ -42,7 +42,7 @@ describe 'InlineResponse201' do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
describe 'test attribute "
|
45
|
+
describe 'test attribute "combined_submission"' do
|
46
46
|
it 'should work' do
|
47
47
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
48
48
|
end
|
@@ -32,16 +32,6 @@ describe 'InlineResponse401' do
|
|
32
32
|
expect(@instance).to be_instance_of(FormAPI::InlineResponse401)
|
33
33
|
end
|
34
34
|
end
|
35
|
-
describe 'test attribute "status"' do
|
36
|
-
it 'should work' do
|
37
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
-
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["error"])
|
39
|
-
#validator.allowable_values.each do |value|
|
40
|
-
# expect { @instance.status = value }.not_to raise_error
|
41
|
-
#end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
35
|
describe 'test attribute "error"' do
|
46
36
|
it 'should work' do
|
47
37
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
data/spec/spec_helper.rb
CHANGED
@@ -12,6 +12,17 @@ Swagger Codegen version: 2.3.0-SNAPSHOT
|
|
12
12
|
|
13
13
|
# load the gem
|
14
14
|
require 'form_api'
|
15
|
+
require 'pry'
|
16
|
+
require 'vcr'
|
17
|
+
require 'webmock/rspec'
|
18
|
+
|
19
|
+
VCR.configure do |config|
|
20
|
+
config.cassette_library_dir = 'spec/vcr_cassettes'
|
21
|
+
config.hook_into :webmock
|
22
|
+
config.configure_rspec_metadata!
|
23
|
+
config.default_cassette_options = { record: :none, erb: true }
|
24
|
+
end
|
25
|
+
|
15
26
|
|
16
27
|
# The following was generated by the `rspec --init` command. Conventionally, all
|
17
28
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
@@ -0,0 +1,127 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://app.formapi.io/api/v1/templates/6zz3dYRYM67fxMXA/submissions
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"data":{"first_name":"John","last_name":"Smith","favorite_color":"Blue"}}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- ruby-swagger-0.1.4
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Accept:
|
15
|
+
- application/json
|
16
|
+
Authorization:
|
17
|
+
- Basic eVJhYVI5Sm1UUHRHWDdFTjpJQjNUUmtTZG00ZjJCZHRVX0QzWWd4amRNQjdsLXIyZk9ndnhEMVl6d2Vj
|
18
|
+
Expect:
|
19
|
+
- ''
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 201
|
23
|
+
message: Created
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Mon, 23 Oct 2017 08:53:50 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Set-Cookie:
|
34
|
+
- __cfduid=d4d53a9027be371a677906f589a30f7c41508748829; expires=Tue, 23-Oct-18
|
35
|
+
08:53:49 GMT; path=/; domain=.formapi.io; HttpOnly; Secure
|
36
|
+
X-Frame-Options:
|
37
|
+
- SAMEORIGIN
|
38
|
+
X-Xss-Protection:
|
39
|
+
- 1; mode=block
|
40
|
+
X-Content-Type-Options:
|
41
|
+
- nosniff
|
42
|
+
Etag:
|
43
|
+
- W/"eb69a8124689ebf40ff6462a48cb9abd"
|
44
|
+
Cache-Control:
|
45
|
+
- max-age=0, private, must-revalidate
|
46
|
+
X-Request-Id:
|
47
|
+
- c9a812dd-2625-48f1-94f1-906a0f654da4
|
48
|
+
X-Runtime:
|
49
|
+
- '0.172181'
|
50
|
+
Vary:
|
51
|
+
- Origin
|
52
|
+
Via:
|
53
|
+
- 1.1 vegur
|
54
|
+
Strict-Transport-Security:
|
55
|
+
- max-age=15552000; includeSubDomains; preload
|
56
|
+
Server:
|
57
|
+
- cloudflare-nginx
|
58
|
+
Cf-Ray:
|
59
|
+
- 3b2377d6ddec3108-SIN
|
60
|
+
body:
|
61
|
+
encoding: UTF-8
|
62
|
+
string: '{"status":"success","submission":{"state":"pending","test":true,"expired":false,"expires_at":null,"metadata":{},"id":"eyR4KFkaYKHztMdR","download_url":null}}'
|
63
|
+
http_version:
|
64
|
+
recorded_at: Mon, 23 Oct 2017 08:53:51 GMT
|
65
|
+
- request:
|
66
|
+
method: get
|
67
|
+
uri: https://app.formapi.io/api/v1/submissions/eyR4KFkaYKHztMdR
|
68
|
+
body:
|
69
|
+
encoding: US-ASCII
|
70
|
+
string: ''
|
71
|
+
headers:
|
72
|
+
User-Agent:
|
73
|
+
- ruby-swagger-0.1.4
|
74
|
+
Content-Type:
|
75
|
+
- application/json
|
76
|
+
Accept:
|
77
|
+
- application/json
|
78
|
+
Authorization:
|
79
|
+
- Basic eVJhYVI5Sm1UUHRHWDdFTjpJQjNUUmtTZG00ZjJCZHRVX0QzWWd4amRNQjdsLXIyZk9ndnhEMVl6d2Vj
|
80
|
+
Expect:
|
81
|
+
- ''
|
82
|
+
response:
|
83
|
+
status:
|
84
|
+
code: 200
|
85
|
+
message: OK
|
86
|
+
headers:
|
87
|
+
Date:
|
88
|
+
- Mon, 23 Oct 2017 08:53:51 GMT
|
89
|
+
Content-Type:
|
90
|
+
- application/json; charset=utf-8
|
91
|
+
Transfer-Encoding:
|
92
|
+
- chunked
|
93
|
+
Connection:
|
94
|
+
- keep-alive
|
95
|
+
Set-Cookie:
|
96
|
+
- __cfduid=d7142a5733640fb24ab3761cc7bee67a81508748831; expires=Tue, 23-Oct-18
|
97
|
+
08:53:51 GMT; path=/; domain=.formapi.io; HttpOnly; Secure
|
98
|
+
X-Frame-Options:
|
99
|
+
- SAMEORIGIN
|
100
|
+
X-Xss-Protection:
|
101
|
+
- 1; mode=block
|
102
|
+
X-Content-Type-Options:
|
103
|
+
- nosniff
|
104
|
+
Etag:
|
105
|
+
- W/"5cfdc9e8399ed11cb2d8031cbf3f6c8d"
|
106
|
+
Cache-Control:
|
107
|
+
- max-age=0, private, must-revalidate
|
108
|
+
X-Request-Id:
|
109
|
+
- 16162658-cda2-4855-8e86-51e449227d54
|
110
|
+
X-Runtime:
|
111
|
+
- '0.086900'
|
112
|
+
Vary:
|
113
|
+
- Origin
|
114
|
+
Via:
|
115
|
+
- 1.1 vegur
|
116
|
+
Strict-Transport-Security:
|
117
|
+
- max-age=15552000; includeSubDomains; preload
|
118
|
+
Server:
|
119
|
+
- cloudflare-nginx
|
120
|
+
Cf-Ray:
|
121
|
+
- 3b2377e26c733108-SIN
|
122
|
+
body:
|
123
|
+
encoding: UTF-8
|
124
|
+
string: '{"state":"processed","test":true,"expired":false,"expires_at":"2017-10-30T08:53:50.350Z","metadata":{},"id":"eyR4KFkaYKHztMdR","download_url":"https://formapi-docs.s3.amazonaws.com/store/submissions/eyR4KFkaYKHztMdR/20171023085350-eyR4KFka.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJMQF3V7PUSLOCZYA%2F20171023%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20171023T085351Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=e3798e78fdcc1a0293d1b200dd7836eebae74e0c048a1e58e00d64aaf4c9f184"}'
|
125
|
+
http_version:
|
126
|
+
recorded_at: Mon, 23 Oct 2017 08:53:52 GMT
|
127
|
+
recorded_with: VCR 3.0.3
|
data/swagger-config.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: form_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Form Applications Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -110,6 +110,20 @@ dependencies:
|
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: 1.24.3
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: addressable
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 2.4.0
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - "~>"
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 2.4.0
|
113
127
|
- !ruby/object:Gem::Dependency
|
114
128
|
name: autotest
|
115
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,25 +225,19 @@ dependencies:
|
|
211
225
|
- !ruby/object:Gem::Version
|
212
226
|
version: 11.2.2
|
213
227
|
- !ruby/object:Gem::Dependency
|
214
|
-
name: pry
|
228
|
+
name: pry-byebug
|
215
229
|
requirement: !ruby/object:Gem::Requirement
|
216
230
|
requirements:
|
217
|
-
- - "~>"
|
218
|
-
- !ruby/object:Gem::Version
|
219
|
-
version: '0.10'
|
220
231
|
- - ">="
|
221
232
|
- !ruby/object:Gem::Version
|
222
|
-
version: 0
|
233
|
+
version: '0'
|
223
234
|
type: :development
|
224
235
|
prerelease: false
|
225
236
|
version_requirements: !ruby/object:Gem::Requirement
|
226
237
|
requirements:
|
227
|
-
- - "~>"
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: '0.10'
|
230
238
|
- - ">="
|
231
239
|
- !ruby/object:Gem::Version
|
232
|
-
version: 0
|
240
|
+
version: '0'
|
233
241
|
description: A client library for the FormAPI PDF generation service
|
234
242
|
email:
|
235
243
|
- support@formapi.io
|
@@ -242,6 +250,7 @@ files:
|
|
242
250
|
- ".swagger-codegen-ignore"
|
243
251
|
- ".swagger-codegen/VERSION"
|
244
252
|
- ".swagger-revision"
|
253
|
+
- ".travis.yml"
|
245
254
|
- CHANGELOG.md
|
246
255
|
- Gemfile
|
247
256
|
- LICENSE
|
@@ -259,6 +268,7 @@ files:
|
|
259
268
|
- lib/form_api/configuration.rb
|
260
269
|
- lib/form_api/models/data.rb
|
261
270
|
- lib/form_api/models/data_1.rb
|
271
|
+
- lib/form_api/models/inline_response_200.rb
|
262
272
|
- lib/form_api/models/inline_response_201.rb
|
263
273
|
- lib/form_api/models/inline_response_201_1.rb
|
264
274
|
- lib/form_api/models/inline_response_201_1_submission.rb
|
@@ -274,21 +284,22 @@ files:
|
|
274
284
|
- scripts/release
|
275
285
|
- scripts/swagger
|
276
286
|
- scripts/test
|
287
|
+
- spec/api/client_spec.rb
|
277
288
|
- spec/api/pdf_api_spec.rb
|
278
289
|
- spec/api_client_spec.rb
|
279
290
|
- spec/configuration_spec.rb
|
280
291
|
- spec/models/data_1_spec.rb
|
281
292
|
- spec/models/data_spec.rb
|
293
|
+
- spec/models/inline_response_200_spec.rb
|
282
294
|
- spec/models/inline_response_201_1_spec.rb
|
283
295
|
- spec/models/inline_response_201_1_submission_spec.rb
|
284
296
|
- spec/models/inline_response_201_combined_submission_spec.rb
|
285
297
|
- spec/models/inline_response_201_spec.rb
|
286
|
-
- spec/models/inline_response_201_submission_spec.rb
|
287
|
-
- spec/models/inline_response_302_spec.rb
|
288
298
|
- spec/models/inline_response_400_spec.rb
|
289
299
|
- spec/models/inline_response_401_spec.rb
|
290
300
|
- spec/models/inline_response_422_spec.rb
|
291
301
|
- spec/spec_helper.rb
|
302
|
+
- spec/vcr_cassettes/FormAPI_Client/should_generate_a_PDF_and_wait_for_the_submission_to_be_processed.yml
|
292
303
|
- swagger-config.json
|
293
304
|
homepage: https://github.com/FormAPI/formapi-ruby
|
294
305
|
licenses:
|
@@ -310,23 +321,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
321
|
version: '0'
|
311
322
|
requirements: []
|
312
323
|
rubyforge_project:
|
313
|
-
rubygems_version: 2.6.
|
324
|
+
rubygems_version: 2.6.13
|
314
325
|
signing_key:
|
315
326
|
specification_version: 4
|
316
327
|
summary: A client library for the FormAPI PDF generation service
|
317
328
|
test_files:
|
329
|
+
- spec/api/client_spec.rb
|
318
330
|
- spec/api/pdf_api_spec.rb
|
319
331
|
- spec/api_client_spec.rb
|
320
332
|
- spec/configuration_spec.rb
|
321
333
|
- spec/models/data_1_spec.rb
|
322
334
|
- spec/models/data_spec.rb
|
335
|
+
- spec/models/inline_response_200_spec.rb
|
323
336
|
- spec/models/inline_response_201_1_spec.rb
|
324
337
|
- spec/models/inline_response_201_1_submission_spec.rb
|
325
338
|
- spec/models/inline_response_201_combined_submission_spec.rb
|
326
339
|
- spec/models/inline_response_201_spec.rb
|
327
|
-
- spec/models/inline_response_201_submission_spec.rb
|
328
|
-
- spec/models/inline_response_302_spec.rb
|
329
340
|
- spec/models/inline_response_400_spec.rb
|
330
341
|
- spec/models/inline_response_401_spec.rb
|
331
342
|
- spec/models/inline_response_422_spec.rb
|
332
343
|
- spec/spec_helper.rb
|
344
|
+
- spec/vcr_cassettes/FormAPI_Client/should_generate_a_PDF_and_wait_for_the_submission_to_be_processed.yml
|
@@ -1,58 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#API V1
|
3
|
-
|
4
|
-
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
-
|
6
|
-
OpenAPI spec version: v1
|
7
|
-
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'spec_helper'
|
14
|
-
require 'json'
|
15
|
-
require 'date'
|
16
|
-
|
17
|
-
# Unit tests for FormAPI::InlineResponse201Submission
|
18
|
-
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
-
# Please update as you see appropriate
|
20
|
-
describe 'InlineResponse201Submission' do
|
21
|
-
before do
|
22
|
-
# run before each test
|
23
|
-
@instance = FormAPI::InlineResponse201Submission.new
|
24
|
-
end
|
25
|
-
|
26
|
-
after do
|
27
|
-
# run after each test
|
28
|
-
end
|
29
|
-
|
30
|
-
describe 'test an instance of InlineResponse201Submission' do
|
31
|
-
it 'should create an instance of InlineResponse201Submission' do
|
32
|
-
expect(@instance).to be_instance_of(FormAPI::InlineResponse201Submission)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
describe 'test attribute "id"' 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 "state"' do
|
42
|
-
it 'should work' do
|
43
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
-
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["pending", "processed", "invalid_data", "error", "image_download_failed", "image_processing_failed"])
|
45
|
-
#validator.allowable_values.each do |value|
|
46
|
-
# expect { @instance.state = value }.not_to raise_error
|
47
|
-
#end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe 'test attribute "download_url"' do
|
52
|
-
it 'should work' do
|
53
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
|