templatefox 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +21 -0
  4. data/README.md +206 -0
  5. data/Rakefile +10 -0
  6. data/docs/AccountApi.md +152 -0
  7. data/docs/AccountInfoResponse.md +20 -0
  8. data/docs/CreatePdfRequest.md +32 -0
  9. data/docs/CreatePdfResponse.md +24 -0
  10. data/docs/ExportType.md +15 -0
  11. data/docs/HTTPValidationError.md +18 -0
  12. data/docs/IntegrationsApi.md +286 -0
  13. data/docs/LocationInner.md +15 -0
  14. data/docs/PDFApi.md +79 -0
  15. data/docs/S3ConfigRequest.md +26 -0
  16. data/docs/S3ConfigResponse.md +28 -0
  17. data/docs/S3SuccessResponse.md +18 -0
  18. data/docs/S3TestResponse.md +20 -0
  19. data/docs/TemplateField.md +26 -0
  20. data/docs/TemplateListItem.md +24 -0
  21. data/docs/TemplatesApi.md +148 -0
  22. data/docs/TemplatesListResponse.md +18 -0
  23. data/docs/Transaction.md +28 -0
  24. data/docs/TransactionsResponse.md +24 -0
  25. data/docs/ValidationError.md +22 -0
  26. data/git_push.sh +57 -0
  27. data/lib/templatefox/api/account_api.rb +154 -0
  28. data/lib/templatefox/api/integrations_api.rb +261 -0
  29. data/lib/templatefox/api/pdf_api.rb +90 -0
  30. data/lib/templatefox/api/templates_api.rb +142 -0
  31. data/lib/templatefox/api_client.rb +397 -0
  32. data/lib/templatefox/api_error.rb +58 -0
  33. data/lib/templatefox/api_model_base.rb +88 -0
  34. data/lib/templatefox/configuration.rb +308 -0
  35. data/lib/templatefox/models/account_info_response.rb +176 -0
  36. data/lib/templatefox/models/create_pdf_request.rb +414 -0
  37. data/lib/templatefox/models/create_pdf_response.rb +247 -0
  38. data/lib/templatefox/models/export_type.rb +40 -0
  39. data/lib/templatefox/models/http_validation_error.rb +149 -0
  40. data/lib/templatefox/models/location_inner.rb +103 -0
  41. data/lib/templatefox/models/s3_config_request.rb +372 -0
  42. data/lib/templatefox/models/s3_config_response.rb +301 -0
  43. data/lib/templatefox/models/s3_success_response.rb +166 -0
  44. data/lib/templatefox/models/s3_test_response.rb +193 -0
  45. data/lib/templatefox/models/template_field.rb +227 -0
  46. data/lib/templatefox/models/template_list_item.rb +247 -0
  47. data/lib/templatefox/models/templates_list_response.rb +167 -0
  48. data/lib/templatefox/models/transaction.rb +267 -0
  49. data/lib/templatefox/models/transactions_response.rb +248 -0
  50. data/lib/templatefox/models/validation_error.rb +218 -0
  51. data/lib/templatefox/version.rb +15 -0
  52. data/lib/templatefox.rb +60 -0
  53. data/spec/api/account_api_spec.rb +59 -0
  54. data/spec/api/integrations_api_spec.rb +80 -0
  55. data/spec/api/pdf_api_spec.rb +47 -0
  56. data/spec/api/templates_api_spec.rb +58 -0
  57. data/spec/models/account_info_response_spec.rb +42 -0
  58. data/spec/models/create_pdf_request_spec.rb +78 -0
  59. data/spec/models/create_pdf_response_spec.rb +54 -0
  60. data/spec/models/export_type_spec.rb +30 -0
  61. data/spec/models/http_validation_error_spec.rb +36 -0
  62. data/spec/models/location_inner_spec.rb +21 -0
  63. data/spec/models/s3_config_request_spec.rb +60 -0
  64. data/spec/models/s3_config_response_spec.rb +66 -0
  65. data/spec/models/s3_success_response_spec.rb +36 -0
  66. data/spec/models/s3_test_response_spec.rb +42 -0
  67. data/spec/models/template_field_spec.rb +60 -0
  68. data/spec/models/template_list_item_spec.rb +54 -0
  69. data/spec/models/templates_list_response_spec.rb +36 -0
  70. data/spec/models/transaction_spec.rb +66 -0
  71. data/spec/models/transactions_response_spec.rb +54 -0
  72. data/spec/models/validation_error_spec.rb +48 -0
  73. data/spec/spec_helper.rb +111 -0
  74. data/templatefox.gemspec +39 -0
  75. metadata +177 -0
@@ -0,0 +1,149 @@
1
+ =begin
2
+ #TemplateFox API
3
+
4
+ #Generate PDFs from HTML templates via API. Design once, generate thousands.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TemplateFox
17
+ class HTTPValidationError < ApiModelBase
18
+ attr_accessor :detail
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'detail' => :'detail'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'detail' => :'Array<ValidationError>'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TemplateFox::HTTPValidationError` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TemplateFox::HTTPValidationError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'detail')
67
+ if (value = attributes[:'detail']).is_a?(Array)
68
+ self.detail = value
69
+ end
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ 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
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ detail == o.detail
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Integer] Hash code
104
+ def hash
105
+ [detail].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def self.build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ attributes = attributes.transform_keys(&:to_sym)
114
+ transformed_hash = {}
115
+ openapi_types.each_pair do |key, type|
116
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
117
+ transformed_hash["#{key}"] = nil
118
+ elsif type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[attribute_map[key]].is_a?(Array)
122
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
123
+ end
124
+ elsif !attributes[attribute_map[key]].nil?
125
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
126
+ end
127
+ end
128
+ new(transformed_hash)
129
+ end
130
+
131
+ # Returns the object in the form of hash
132
+ # @return [Hash] Returns the object in the form of hash
133
+ def to_hash
134
+ hash = {}
135
+ self.class.attribute_map.each_pair do |attr, param|
136
+ value = self.send(attr)
137
+ if value.nil?
138
+ is_nullable = self.class.openapi_nullable.include?(attr)
139
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
140
+ end
141
+
142
+ hash[param] = _to_hash(value)
143
+ end
144
+ hash
145
+ end
146
+
147
+ end
148
+
149
+ end
@@ -0,0 +1,103 @@
1
+ =begin
2
+ #TemplateFox API
3
+
4
+ #Generate PDFs from HTML templates via API. Design once, generate thousands.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TemplateFox
17
+ module LocationInner
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'Integer',
23
+ :'String'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of anyOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_any_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ return find_and_cast_into_type(klass, data)
41
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
42
+ end
43
+ end
44
+
45
+ openapi_any_of.include?(:AnyType) ? data : nil
46
+ end
47
+
48
+ private
49
+
50
+ SchemaMismatchError = Class.new(StandardError)
51
+
52
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
53
+ def find_and_cast_into_type(klass, data)
54
+ return if data.nil?
55
+
56
+ case klass.to_s
57
+ when 'Boolean'
58
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
59
+ when 'Float'
60
+ return data if data.instance_of?(Float)
61
+ when 'Integer'
62
+ return data if data.instance_of?(Integer)
63
+ when 'Time'
64
+ return Time.parse(data)
65
+ when 'Date'
66
+ return Date.iso8601(data)
67
+ when 'String'
68
+ return data if data.instance_of?(String)
69
+ when 'Object' # "type: object"
70
+ return data if data.instance_of?(Hash)
71
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
72
+ if data.instance_of?(Array)
73
+ sub_type = Regexp.last_match[:sub_type]
74
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
75
+ end
76
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ else # model
82
+ const = TemplateFox.const_get(klass)
83
+ if const
84
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
85
+ model = const.build(data)
86
+ return model if model
87
+ else
88
+ # raise if data contains keys that are not known to the model
89
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
90
+ model = const.build_from_hash(data)
91
+ return model if model
92
+ end
93
+ end
94
+ end
95
+
96
+ raise # if no match by now, raise
97
+ rescue
98
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
99
+ end
100
+ end
101
+ end
102
+
103
+ end
@@ -0,0 +1,372 @@
1
+ =begin
2
+ #TemplateFox API
3
+
4
+ #Generate PDFs from HTML templates via API. Design once, generate thousands.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TemplateFox
17
+ # Request model for S3 configuration
18
+ class S3ConfigRequest < ApiModelBase
19
+ # S3-compatible endpoint URL. Must start with https://
20
+ attr_accessor :endpoint_url
21
+
22
+ # Access key ID for S3 authentication
23
+ attr_accessor :access_key_id
24
+
25
+ attr_accessor :secret_access_key
26
+
27
+ # S3 bucket name. Must follow S3 naming conventions (lowercase, no underscores)
28
+ attr_accessor :bucket_name
29
+
30
+ # Default path prefix for uploaded files. Can include slashes for folder structure
31
+ attr_accessor :default_prefix
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'endpoint_url' => :'endpoint_url',
37
+ :'access_key_id' => :'access_key_id',
38
+ :'secret_access_key' => :'secret_access_key',
39
+ :'bucket_name' => :'bucket_name',
40
+ :'default_prefix' => :'default_prefix'
41
+ }
42
+ end
43
+
44
+ # Returns attribute mapping this model knows about
45
+ def self.acceptable_attribute_map
46
+ attribute_map
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ acceptable_attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'endpoint_url' => :'String',
58
+ :'access_key_id' => :'String',
59
+ :'secret_access_key' => :'String',
60
+ :'bucket_name' => :'String',
61
+ :'default_prefix' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ :'secret_access_key',
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TemplateFox::S3ConfigRequest` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ acceptable_attribute_map = self.class.acceptable_attribute_map
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!acceptable_attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TemplateFox::S3ConfigRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'endpoint_url')
89
+ self.endpoint_url = attributes[:'endpoint_url']
90
+ else
91
+ self.endpoint_url = nil
92
+ end
93
+
94
+ if attributes.key?(:'access_key_id')
95
+ self.access_key_id = attributes[:'access_key_id']
96
+ else
97
+ self.access_key_id = nil
98
+ end
99
+
100
+ if attributes.key?(:'secret_access_key')
101
+ self.secret_access_key = attributes[:'secret_access_key']
102
+ end
103
+
104
+ if attributes.key?(:'bucket_name')
105
+ self.bucket_name = attributes[:'bucket_name']
106
+ else
107
+ self.bucket_name = nil
108
+ end
109
+
110
+ if attributes.key?(:'default_prefix')
111
+ self.default_prefix = attributes[:'default_prefix']
112
+ else
113
+ self.default_prefix = ''
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
121
+ invalid_properties = Array.new
122
+ if @endpoint_url.nil?
123
+ invalid_properties.push('invalid value for "endpoint_url", endpoint_url cannot be nil.')
124
+ end
125
+
126
+ if @endpoint_url.to_s.length > 200
127
+ invalid_properties.push('invalid value for "endpoint_url", the character length must be smaller than or equal to 200.')
128
+ end
129
+
130
+ if @endpoint_url.to_s.length < 10
131
+ invalid_properties.push('invalid value for "endpoint_url", the character length must be greater than or equal to 10.')
132
+ end
133
+
134
+ pattern = Regexp.new(/^https:\/\//)
135
+ if @endpoint_url !~ pattern
136
+ invalid_properties.push("invalid value for \"endpoint_url\", must conform to the pattern #{pattern}.")
137
+ end
138
+
139
+ if @access_key_id.nil?
140
+ invalid_properties.push('invalid value for "access_key_id", access_key_id cannot be nil.')
141
+ end
142
+
143
+ if @access_key_id.to_s.length > 128
144
+ invalid_properties.push('invalid value for "access_key_id", the character length must be smaller than or equal to 128.')
145
+ end
146
+
147
+ if @access_key_id.to_s.length < 16
148
+ invalid_properties.push('invalid value for "access_key_id", the character length must be greater than or equal to 16.')
149
+ end
150
+
151
+ if !@secret_access_key.nil? && @secret_access_key.to_s.length > 128
152
+ invalid_properties.push('invalid value for "secret_access_key", the character length must be smaller than or equal to 128.')
153
+ end
154
+
155
+ if !@secret_access_key.nil? && @secret_access_key.to_s.length < 16
156
+ invalid_properties.push('invalid value for "secret_access_key", the character length must be greater than or equal to 16.')
157
+ end
158
+
159
+ if @bucket_name.nil?
160
+ invalid_properties.push('invalid value for "bucket_name", bucket_name cannot be nil.')
161
+ end
162
+
163
+ if @bucket_name.to_s.length > 63
164
+ invalid_properties.push('invalid value for "bucket_name", the character length must be smaller than or equal to 63.')
165
+ end
166
+
167
+ if @bucket_name.to_s.length < 3
168
+ invalid_properties.push('invalid value for "bucket_name", the character length must be greater than or equal to 3.')
169
+ end
170
+
171
+ pattern = Regexp.new(/^[a-z0-9][a-z0-9.\-]*[a-z0-9]$/)
172
+ if @bucket_name !~ pattern
173
+ invalid_properties.push("invalid value for \"bucket_name\", must conform to the pattern #{pattern}.")
174
+ end
175
+
176
+ if !@default_prefix.nil? && @default_prefix.to_s.length > 500
177
+ invalid_properties.push('invalid value for "default_prefix", the character length must be smaller than or equal to 500.')
178
+ end
179
+
180
+ pattern = Regexp.new(/^[a-zA-Z0-9_\-\.\/]*$/)
181
+ if !@default_prefix.nil? && @default_prefix !~ pattern
182
+ invalid_properties.push("invalid value for \"default_prefix\", must conform to the pattern #{pattern}.")
183
+ end
184
+
185
+ invalid_properties
186
+ end
187
+
188
+ # Check to see if the all the properties in the model are valid
189
+ # @return true if the model is valid
190
+ def valid?
191
+ warn '[DEPRECATED] the `valid?` method is obsolete'
192
+ return false if @endpoint_url.nil?
193
+ return false if @endpoint_url.to_s.length > 200
194
+ return false if @endpoint_url.to_s.length < 10
195
+ return false if @endpoint_url !~ Regexp.new(/^https:\/\//)
196
+ return false if @access_key_id.nil?
197
+ return false if @access_key_id.to_s.length > 128
198
+ return false if @access_key_id.to_s.length < 16
199
+ return false if !@secret_access_key.nil? && @secret_access_key.to_s.length > 128
200
+ return false if !@secret_access_key.nil? && @secret_access_key.to_s.length < 16
201
+ return false if @bucket_name.nil?
202
+ return false if @bucket_name.to_s.length > 63
203
+ return false if @bucket_name.to_s.length < 3
204
+ return false if @bucket_name !~ Regexp.new(/^[a-z0-9][a-z0-9.\-]*[a-z0-9]$/)
205
+ return false if !@default_prefix.nil? && @default_prefix.to_s.length > 500
206
+ return false if !@default_prefix.nil? && @default_prefix !~ Regexp.new(/^[a-zA-Z0-9_\-\.\/]*$/)
207
+ true
208
+ end
209
+
210
+ # Custom attribute writer method with validation
211
+ # @param [Object] endpoint_url Value to be assigned
212
+ def endpoint_url=(endpoint_url)
213
+ if endpoint_url.nil?
214
+ fail ArgumentError, 'endpoint_url cannot be nil'
215
+ end
216
+
217
+ if endpoint_url.to_s.length > 200
218
+ fail ArgumentError, 'invalid value for "endpoint_url", the character length must be smaller than or equal to 200.'
219
+ end
220
+
221
+ if endpoint_url.to_s.length < 10
222
+ fail ArgumentError, 'invalid value for "endpoint_url", the character length must be greater than or equal to 10.'
223
+ end
224
+
225
+ pattern = Regexp.new(/^https:\/\//)
226
+ if endpoint_url !~ pattern
227
+ fail ArgumentError, "invalid value for \"endpoint_url\", must conform to the pattern #{pattern}."
228
+ end
229
+
230
+ @endpoint_url = endpoint_url
231
+ end
232
+
233
+ # Custom attribute writer method with validation
234
+ # @param [Object] access_key_id Value to be assigned
235
+ def access_key_id=(access_key_id)
236
+ if access_key_id.nil?
237
+ fail ArgumentError, 'access_key_id cannot be nil'
238
+ end
239
+
240
+ if access_key_id.to_s.length > 128
241
+ fail ArgumentError, 'invalid value for "access_key_id", the character length must be smaller than or equal to 128.'
242
+ end
243
+
244
+ if access_key_id.to_s.length < 16
245
+ fail ArgumentError, 'invalid value for "access_key_id", the character length must be greater than or equal to 16.'
246
+ end
247
+
248
+ @access_key_id = access_key_id
249
+ end
250
+
251
+ # Custom attribute writer method with validation
252
+ # @param [Object] secret_access_key Value to be assigned
253
+ def secret_access_key=(secret_access_key)
254
+ if !secret_access_key.nil? && secret_access_key.to_s.length > 128
255
+ fail ArgumentError, 'invalid value for "secret_access_key", the character length must be smaller than or equal to 128.'
256
+ end
257
+
258
+ if !secret_access_key.nil? && secret_access_key.to_s.length < 16
259
+ fail ArgumentError, 'invalid value for "secret_access_key", the character length must be greater than or equal to 16.'
260
+ end
261
+
262
+ @secret_access_key = secret_access_key
263
+ end
264
+
265
+ # Custom attribute writer method with validation
266
+ # @param [Object] bucket_name Value to be assigned
267
+ def bucket_name=(bucket_name)
268
+ if bucket_name.nil?
269
+ fail ArgumentError, 'bucket_name cannot be nil'
270
+ end
271
+
272
+ if bucket_name.to_s.length > 63
273
+ fail ArgumentError, 'invalid value for "bucket_name", the character length must be smaller than or equal to 63.'
274
+ end
275
+
276
+ if bucket_name.to_s.length < 3
277
+ fail ArgumentError, 'invalid value for "bucket_name", the character length must be greater than or equal to 3.'
278
+ end
279
+
280
+ pattern = Regexp.new(/^[a-z0-9][a-z0-9.\-]*[a-z0-9]$/)
281
+ if bucket_name !~ pattern
282
+ fail ArgumentError, "invalid value for \"bucket_name\", must conform to the pattern #{pattern}."
283
+ end
284
+
285
+ @bucket_name = bucket_name
286
+ end
287
+
288
+ # Custom attribute writer method with validation
289
+ # @param [Object] default_prefix Value to be assigned
290
+ def default_prefix=(default_prefix)
291
+ if default_prefix.nil?
292
+ fail ArgumentError, 'default_prefix cannot be nil'
293
+ end
294
+
295
+ if default_prefix.to_s.length > 500
296
+ fail ArgumentError, 'invalid value for "default_prefix", the character length must be smaller than or equal to 500.'
297
+ end
298
+
299
+ pattern = Regexp.new(/^[a-zA-Z0-9_\-\.\/]*$/)
300
+ if default_prefix !~ pattern
301
+ fail ArgumentError, "invalid value for \"default_prefix\", must conform to the pattern #{pattern}."
302
+ end
303
+
304
+ @default_prefix = default_prefix
305
+ end
306
+
307
+ # Checks equality by comparing each attribute.
308
+ # @param [Object] Object to be compared
309
+ def ==(o)
310
+ return true if self.equal?(o)
311
+ self.class == o.class &&
312
+ endpoint_url == o.endpoint_url &&
313
+ access_key_id == o.access_key_id &&
314
+ secret_access_key == o.secret_access_key &&
315
+ bucket_name == o.bucket_name &&
316
+ default_prefix == o.default_prefix
317
+ end
318
+
319
+ # @see the `==` method
320
+ # @param [Object] Object to be compared
321
+ def eql?(o)
322
+ self == o
323
+ end
324
+
325
+ # Calculates hash code according to all attributes.
326
+ # @return [Integer] Hash code
327
+ def hash
328
+ [endpoint_url, access_key_id, secret_access_key, bucket_name, default_prefix].hash
329
+ end
330
+
331
+ # Builds the object from hash
332
+ # @param [Hash] attributes Model attributes in the form of hash
333
+ # @return [Object] Returns the model itself
334
+ def self.build_from_hash(attributes)
335
+ return nil unless attributes.is_a?(Hash)
336
+ attributes = attributes.transform_keys(&:to_sym)
337
+ transformed_hash = {}
338
+ openapi_types.each_pair do |key, type|
339
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
340
+ transformed_hash["#{key}"] = nil
341
+ elsif type =~ /\AArray<(.*)>/i
342
+ # check to ensure the input is an array given that the attribute
343
+ # is documented as an array but the input is not
344
+ if attributes[attribute_map[key]].is_a?(Array)
345
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
346
+ end
347
+ elsif !attributes[attribute_map[key]].nil?
348
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
349
+ end
350
+ end
351
+ new(transformed_hash)
352
+ end
353
+
354
+ # Returns the object in the form of hash
355
+ # @return [Hash] Returns the object in the form of hash
356
+ def to_hash
357
+ hash = {}
358
+ self.class.attribute_map.each_pair do |attr, param|
359
+ value = self.send(attr)
360
+ if value.nil?
361
+ is_nullable = self.class.openapi_nullable.include?(attr)
362
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
363
+ end
364
+
365
+ hash[param] = _to_hash(value)
366
+ end
367
+ hash
368
+ end
369
+
370
+ end
371
+
372
+ end