pnap_payments_api 1.0.4 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4627c2c9b1be515aec153122553ed57a4f19017789350ebec59cdfa95a4b95f
4
- data.tar.gz: 53498262c7ca6a9d1d76ffbea6bd184d0b8d9f649191ef204b959827cbadc310
3
+ metadata.gz: 5e1e8b5ce0410b1616a020ba99ae73bc48e9c44c7ece2096a760978a87892267
4
+ data.tar.gz: 7bc466903456f7b4cbe9559a77b58ca4a05ef56020d4389b12922f499a5139f4
5
5
  SHA512:
6
- metadata.gz: 71af5f9d9fcdd76213b01b39829df9b9a1233374e77a4ef872c98d98fee7743ed65b32b94f0a4ae696cc205ef779316dba433f81629cb99579641668c2fff38a
7
- data.tar.gz: f594a627c9e60637f1ff156ae636361152575b67b918750b103e858e9f5d6d02061f6c1a56a4a7a0d70396178778f532b55c37b7cfc5ca550d2ce68d5160d20a
6
+ metadata.gz: d2b1087a1d91de61bb034489ce2402430106ff757fe69af0641feaf0975cab5ee3eb50f2903504ad4e7cd72dfe3ae8b69e6cb2365a18e6476e18499fb1fa1db6
7
+ data.tar.gz: '0813464bc0fdd51a3f89052ce8d27682f6a9a4eccc77219ce9b363e3c70ae567cbf1cd8ff3aaa7ab25ad1c0ba4da9df30adf3e5495cb2314b362e0f989920b61'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.4
1
+ 1.0.5
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -51,7 +51,7 @@ module PaymentsApi
51
51
  # header parameters
52
52
  header_params = opts[:header_params] || {}
53
53
  # HTTP header 'Accept' (if needed)
54
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
55
 
56
56
  # form parameters
57
57
  form_params = opts[:form_params] || {}
@@ -146,7 +146,7 @@ module PaymentsApi
146
146
  # header parameters
147
147
  header_params = opts[:header_params] || {}
148
148
  # HTTP header 'Accept' (if needed)
149
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
149
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
150
150
 
151
151
  # form parameters
152
152
  form_params = opts[:form_params] || {}
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -52,7 +52,8 @@ module PaymentsApi
52
52
  # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
53
53
  def call_api(http_method, path, opts = {})
54
54
  request = build_request(http_method, path, opts)
55
- tempfile = download_file(request) if opts[:return_type] == 'File'
55
+ tempfile = nil
56
+ (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File'
56
57
  response = request.run
57
58
 
58
59
  if @config.debugging
@@ -191,19 +192,17 @@ module PaymentsApi
191
192
  chunk.force_encoding(encoding)
192
193
  tempfile.write(chunk)
193
194
  end
194
- # run the request to ensure the tempfile is created successfully before returning it
195
- request.run
196
- if tempfile
195
+ request.on_complete do
196
+ if !tempfile
197
+ fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
198
+ end
197
199
  tempfile.close
198
200
  @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
199
201
  "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
200
202
  "will be deleted automatically with GC. It's also recommended to delete the temp file "\
201
203
  "explicitly with `tempfile.delete`"
202
- else
203
- fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
204
+ yield tempfile if block_given?
204
205
  end
205
-
206
- tempfile
207
206
  end
208
207
 
209
208
  # Check if the given MIME is a JSON MIME.
@@ -215,7 +214,7 @@ module PaymentsApi
215
214
  # @param [String] mime MIME
216
215
  # @return [Boolean] True if the MIME is application/json
217
216
  def json_mime?(mime)
218
- (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
217
+ (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
219
218
  end
220
219
 
221
220
  # Deserialize the response to the given return type.
@@ -282,9 +281,13 @@ module PaymentsApi
282
281
  data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
283
282
  end
284
283
  else
285
- # models (e.g. Pet) or oneOf
284
+ # models (e.g. Pet) or oneOf/anyOf
286
285
  klass = PaymentsApi.const_get(return_type)
287
- klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
286
+ if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of)
287
+ klass.build(data)
288
+ else
289
+ klass.build_from_hash(data)
290
+ end
288
291
  end
289
292
  end
290
293
 
@@ -294,7 +297,7 @@ module PaymentsApi
294
297
  # @param [String] filename the filename to be sanitized
295
298
  # @return [String] the sanitized filename
296
299
  def sanitize_filename(filename)
297
- filename.gsub(/.*[\/\\]/, '')
300
+ filename.split(/[\/\\]/).last
298
301
  end
299
302
 
300
303
  def build_request_url(path, opts = {})
@@ -394,4 +397,4 @@ module PaymentsApi
394
397
  end
395
398
  end
396
399
  end
397
- end
400
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,88 @@
1
+ =begin
2
+ #Payments API
3
+
4
+ #Payments API are currently designed to fetch Transactions only.
5
+
6
+ The version of the OpenAPI document: 0.1
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.20.0
10
+
11
+ =end
12
+
13
+ module PaymentsApi
14
+ class ApiModelBase
15
+ # Deserializes the data based on type
16
+ # @param string type Data type
17
+ # @param string value Value to be deserialized
18
+ # @return [Object] Deserialized data
19
+ def self._deserialize(type, value)
20
+ case type.to_sym
21
+ when :Time
22
+ Time.parse(value)
23
+ when :Date
24
+ Date.parse(value)
25
+ when :String
26
+ value.to_s
27
+ when :Integer
28
+ value.to_i
29
+ when :Float
30
+ value.to_f
31
+ when :Boolean
32
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
33
+ true
34
+ else
35
+ false
36
+ end
37
+ when :Object
38
+ # generic object (usually a Hash), return directly
39
+ value
40
+ when /\AArray<(?<inner_type>.+)>\z/
41
+ inner_type = Regexp.last_match[:inner_type]
42
+ value.map { |v| _deserialize(inner_type, v) }
43
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
44
+ k_type = Regexp.last_match[:k_type]
45
+ v_type = Regexp.last_match[:v_type]
46
+ {}.tap do |hash|
47
+ value.each do |k, v|
48
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
49
+ end
50
+ end
51
+ else # model
52
+ # models (e.g. Pet) or oneOf
53
+ klass = PaymentsApi.const_get(type)
54
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
55
+ end
56
+ end
57
+
58
+ # Returns the string representation of the object
59
+ # @return [String] String presentation of the object
60
+ def to_s
61
+ to_hash.to_s
62
+ end
63
+
64
+ # to_body is an alias to to_hash (backward compatibility)
65
+ # @return [Hash] Returns the object in the form of hash
66
+ def to_body
67
+ to_hash
68
+ end
69
+
70
+ # Outputs non-array value in the form of hash
71
+ # For object, use to_hash. Otherwise, just return the value
72
+ # @param [Object] value Any valid value
73
+ # @return [Hash] Returns the value in the form of hash
74
+ def _to_hash(value)
75
+ if value.is_a?(Array)
76
+ value.compact.map { |v| _to_hash(v) }
77
+ elsif value.is_a?(Hash)
78
+ {}.tap do |hash|
79
+ value.each { |k, v| hash[k] = _to_hash(v) }
80
+ end
81
+ elsif value.respond_to? :to_hash
82
+ value.to_hash
83
+ else
84
+ value
85
+ end
86
+ end
87
+ end
88
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -79,6 +79,14 @@ module PaymentsApi
79
79
  # @return [true, false]
80
80
  attr_accessor :debugging
81
81
 
82
+ # Set this to ignore operation servers for the API client. This is useful when you need to
83
+ # send requests to a different server than the one specified in the OpenAPI document.
84
+ # Will default to the base url defined in the spec but can be overridden by setting
85
+ # `scheme`, `host`, `base_path` directly.
86
+ # Default to false.
87
+ # @return [true, false]
88
+ attr_accessor :ignore_operation_servers
89
+
82
90
  # Defines the logger used for debugging.
83
91
  # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
84
92
  #
@@ -166,6 +174,7 @@ module PaymentsApi
166
174
  @timeout = 0
167
175
  @params_encoding = nil
168
176
  @debugging = false
177
+ @ignore_operation_servers = false
169
178
  @inject_format = false
170
179
  @force_ending_format = false
171
180
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
@@ -200,6 +209,7 @@ module PaymentsApi
200
209
 
201
210
  # Returns base URL for specified operation based on server settings
202
211
  def base_url(operation = nil)
212
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
203
213
  if operation_server_settings.key?(operation) then
204
214
  index = server_operation_index.fetch(operation, server_index)
205
215
  server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module PaymentsApi
17
17
  # Card payment details of a transaction.
18
- class CardPaymentMethodDetails
18
+ class CardPaymentMethodDetails < ApiModelBase
19
19
  # The Card Type. Supported Card Types include: VISA, MASTERCARD, DISCOVER, JCB & AMEX.
20
20
  attr_accessor :card_type
21
21
 
@@ -30,9 +30,14 @@ module PaymentsApi
30
30
  }
31
31
  end
32
32
 
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
33
38
  # Returns all the JSON keys this model knows about
34
39
  def self.acceptable_attributes
35
- attribute_map.values
40
+ acceptable_attribute_map.values
36
41
  end
37
42
 
38
43
  # Attribute type mapping.
@@ -57,9 +62,10 @@ module PaymentsApi
57
62
  end
58
63
 
59
64
  # check to see if the attribute exists and convert string to symbol for hash key
65
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
66
  attributes = attributes.each_with_object({}) { |(k, v), h|
61
- if (!self.class.attribute_map.key?(k.to_sym))
62
- fail ArgumentError, "`#{k}` is not a valid attribute in `PaymentsApi::CardPaymentMethodDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ if (!acceptable_attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PaymentsApi::CardPaymentMethodDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
69
  end
64
70
  h[k.to_sym] = v
65
71
  }
@@ -108,6 +114,16 @@ module PaymentsApi
108
114
  true
109
115
  end
110
116
 
117
+ # Custom attribute writer method with validation
118
+ # @param [Object] card_type Value to be assigned
119
+ def card_type=(card_type)
120
+ if card_type.nil?
121
+ fail ArgumentError, 'card_type cannot be nil'
122
+ end
123
+
124
+ @card_type = card_type
125
+ end
126
+
111
127
  # Custom attribute writer method with validation
112
128
  # @param [Object] last_four_digits Value to be assigned
113
129
  def last_four_digits=(last_four_digits)
@@ -167,61 +183,6 @@ module PaymentsApi
167
183
  new(transformed_hash)
168
184
  end
169
185
 
170
- # Deserializes the data based on type
171
- # @param string type Data type
172
- # @param string value Value to be deserialized
173
- # @return [Object] Deserialized data
174
- def self._deserialize(type, value)
175
- case type.to_sym
176
- when :Time
177
- Time.parse(value)
178
- when :Date
179
- Date.parse(value)
180
- when :String
181
- value.to_s
182
- when :Integer
183
- value.to_i
184
- when :Float
185
- value.to_f
186
- when :Boolean
187
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
- true
189
- else
190
- false
191
- end
192
- when :Object
193
- # generic object (usually a Hash), return directly
194
- value
195
- when /\AArray<(?<inner_type>.+)>\z/
196
- inner_type = Regexp.last_match[:inner_type]
197
- value.map { |v| _deserialize(inner_type, v) }
198
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
- k_type = Regexp.last_match[:k_type]
200
- v_type = Regexp.last_match[:v_type]
201
- {}.tap do |hash|
202
- value.each do |k, v|
203
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
- end
205
- end
206
- else # model
207
- # models (e.g. Pet) or oneOf
208
- klass = PaymentsApi.const_get(type)
209
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
210
- end
211
- end
212
-
213
- # Returns the string representation of the object
214
- # @return [String] String presentation of the object
215
- def to_s
216
- to_hash.to_s
217
- end
218
-
219
- # to_body is an alias to to_hash (backward compatibility)
220
- # @return [Hash] Returns the object in the form of hash
221
- def to_body
222
- to_hash
223
- end
224
-
225
186
  # Returns the object in the form of hash
226
187
  # @return [Hash] Returns the object in the form of hash
227
188
  def to_hash
@@ -238,24 +199,6 @@ module PaymentsApi
238
199
  hash
239
200
  end
240
201
 
241
- # Outputs non-array value in the form of hash
242
- # For object, use to_hash. Otherwise, just return the value
243
- # @param [Object] value Any valid value
244
- # @return [Hash] Returns the value in the form of hash
245
- def _to_hash(value)
246
- if value.is_a?(Array)
247
- value.compact.map { |v| _to_hash(v) }
248
- elsif value.is_a?(Hash)
249
- {}.tap do |hash|
250
- value.each { |k, v| hash[k] = _to_hash(v) }
251
- end
252
- elsif value.respond_to? :to_hash
253
- value.to_hash
254
- else
255
- value
256
- end
257
- end
258
-
259
202
  end
260
203
 
261
204
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.1
7
7
  Contact: support@phoenixnap.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.20.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module PaymentsApi
17
- class Error
17
+ class Error < ApiModelBase
18
18
  # The description detailing the cause of the error code.
19
19
  attr_accessor :message
20
20
 
@@ -29,9 +29,14 @@ module PaymentsApi
29
29
  }
30
30
  end
31
31
 
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
32
37
  # Returns all the JSON keys this model knows about
33
38
  def self.acceptable_attributes
34
- attribute_map.values
39
+ acceptable_attribute_map.values
35
40
  end
36
41
 
37
42
  # Attribute type mapping.
@@ -56,9 +61,10 @@ module PaymentsApi
56
61
  end
57
62
 
58
63
  # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
65
  attributes = attributes.each_with_object({}) { |(k, v), h|
60
- if (!self.class.attribute_map.key?(k.to_sym))
61
- fail ArgumentError, "`#{k}` is not a valid attribute in `PaymentsApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PaymentsApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
68
  end
63
69
  h[k.to_sym] = v
64
70
  }
@@ -96,6 +102,16 @@ module PaymentsApi
96
102
  true
97
103
  end
98
104
 
105
+ # Custom attribute writer method with validation
106
+ # @param [Object] message Value to be assigned
107
+ def message=(message)
108
+ if message.nil?
109
+ fail ArgumentError, 'message cannot be nil'
110
+ end
111
+
112
+ @message = message
113
+ end
114
+
99
115
  # Checks equality by comparing each attribute.
100
116
  # @param [Object] Object to be compared
101
117
  def ==(o)
@@ -140,61 +156,6 @@ module PaymentsApi
140
156
  new(transformed_hash)
141
157
  end
142
158
 
143
- # Deserializes the data based on type
144
- # @param string type Data type
145
- # @param string value Value to be deserialized
146
- # @return [Object] Deserialized data
147
- def self._deserialize(type, value)
148
- case type.to_sym
149
- when :Time
150
- Time.parse(value)
151
- when :Date
152
- Date.parse(value)
153
- when :String
154
- value.to_s
155
- when :Integer
156
- value.to_i
157
- when :Float
158
- value.to_f
159
- when :Boolean
160
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
- true
162
- else
163
- false
164
- end
165
- when :Object
166
- # generic object (usually a Hash), return directly
167
- value
168
- when /\AArray<(?<inner_type>.+)>\z/
169
- inner_type = Regexp.last_match[:inner_type]
170
- value.map { |v| _deserialize(inner_type, v) }
171
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
- k_type = Regexp.last_match[:k_type]
173
- v_type = Regexp.last_match[:v_type]
174
- {}.tap do |hash|
175
- value.each do |k, v|
176
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
- end
178
- end
179
- else # model
180
- # models (e.g. Pet) or oneOf
181
- klass = PaymentsApi.const_get(type)
182
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
- end
184
- end
185
-
186
- # Returns the string representation of the object
187
- # @return [String] String presentation of the object
188
- def to_s
189
- to_hash.to_s
190
- end
191
-
192
- # to_body is an alias to to_hash (backward compatibility)
193
- # @return [Hash] Returns the object in the form of hash
194
- def to_body
195
- to_hash
196
- end
197
-
198
159
  # Returns the object in the form of hash
199
160
  # @return [Hash] Returns the object in the form of hash
200
161
  def to_hash
@@ -211,24 +172,6 @@ module PaymentsApi
211
172
  hash
212
173
  end
213
174
 
214
- # Outputs non-array value in the form of hash
215
- # For object, use to_hash. Otherwise, just return the value
216
- # @param [Object] value Any valid value
217
- # @return [Hash] Returns the value in the form of hash
218
- def _to_hash(value)
219
- if value.is_a?(Array)
220
- value.compact.map { |v| _to_hash(v) }
221
- elsif value.is_a?(Hash)
222
- {}.tap do |hash|
223
- value.each { |k, v| hash[k] = _to_hash(v) }
224
- end
225
- elsif value.respond_to? :to_hash
226
- value.to_hash
227
- else
228
- value
229
- end
230
- end
231
-
232
175
  end
233
176
 
234
177
  end