transferzero-sdk 1.19.2 → 1.19.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -4
  3. data/docs/CurrencyExchangeAllOf.md +17 -0
  4. data/docs/CurrencyOppositeAllOf.md +21 -0
  5. data/docs/DocumentWebhookAllOf.md +17 -0
  6. data/docs/PayinMethod.md +1 -1
  7. data/docs/PayinMethodsApi.md +1 -1
  8. data/docs/PayoutMethodWebhookAllOf.md +17 -0
  9. data/docs/PayoutMethodsApi.md +1 -1
  10. data/docs/RecipientWebhookAllOf.md +17 -0
  11. data/docs/SenderWebhookAllOf.md +17 -0
  12. data/docs/SendersApi.md +1 -1
  13. data/docs/TransactionWebhookAllOf.md +17 -0
  14. data/lib/transferzero-sdk/api/payin_methods_api.rb +2 -2
  15. data/lib/transferzero-sdk/api/payout_methods_api.rb +2 -2
  16. data/lib/transferzero-sdk/api/senders_api.rb +2 -2
  17. data/lib/transferzero-sdk/api_client.rb +124 -89
  18. data/lib/transferzero-sdk/configuration.rb +95 -19
  19. data/lib/transferzero-sdk/models/currency_exchange_all_of.rb +205 -0
  20. data/lib/transferzero-sdk/models/currency_opposite_all_of.rb +223 -0
  21. data/lib/transferzero-sdk/models/document_webhook_all_of.rb +202 -0
  22. data/lib/transferzero-sdk/models/payin_method.rb +1 -1
  23. data/lib/transferzero-sdk/models/payin_method_ux_flow.rb +1 -0
  24. data/lib/transferzero-sdk/models/payout_method_country_enum.rb +1 -1
  25. data/lib/transferzero-sdk/models/payout_method_webhook_all_of.rb +202 -0
  26. data/lib/transferzero-sdk/models/recipient_webhook_all_of.rb +202 -0
  27. data/lib/transferzero-sdk/models/sender_webhook_all_of.rb +202 -0
  28. data/lib/transferzero-sdk/models/transaction_webhook_all_of.rb +202 -0
  29. data/lib/transferzero-sdk/version.rb +1 -1
  30. data/spec/models/currency_exchange_all_of_spec.rb +41 -0
  31. data/spec/models/currency_opposite_all_of_spec.rb +53 -0
  32. data/spec/models/document_webhook_all_of_spec.rb +41 -0
  33. data/spec/models/payout_method_webhook_all_of_spec.rb +41 -0
  34. data/spec/models/recipient_webhook_all_of_spec.rb +41 -0
  35. data/spec/models/sender_webhook_all_of_spec.rb +41 -0
  36. data/spec/models/transaction_webhook_all_of_spec.rb +41 -0
  37. data/transferzero-sdk-1.19.2.gem +0 -0
  38. data/transferzero-sdk-1.19.3.gem +0 -0
  39. data/transferzero-sdk-1.19.4.gem +0 -0
  40. data/transferzero-sdk.gemspec +2 -8
  41. metadata +40 -123
@@ -23,6 +23,18 @@ module TransferZero
23
23
  # Defines url base path
24
24
  attr_accessor :base_path
25
25
 
26
+ # Define server configuration index
27
+ attr_accessor :server_index
28
+
29
+ # Define server operation configuration index
30
+ attr_accessor :server_operation_index
31
+
32
+ # Default server variables
33
+ attr_accessor :server_variables
34
+
35
+ # Default server operation variables
36
+ attr_accessor :server_operation_variables
37
+
26
38
  # Defines API key used with API Key authentications.
27
39
  #
28
40
  # @return [String]
@@ -73,33 +85,28 @@ module TransferZero
73
85
  # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
74
86
  #
75
87
  # @return [true, false]
76
- attr_accessor :verify_ssl
88
+ attr_accessor :ssl_verify
77
89
 
78
90
  ### TLS/SSL setting
79
- # Set this to false to skip verifying SSL host name
80
- # Default to true.
91
+ # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
81
92
  #
82
93
  # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
83
94
  #
84
- # @return [true, false]
85
- attr_accessor :verify_ssl_host
95
+ attr_accessor :ssl_verify_mode
86
96
 
87
97
  ### TLS/SSL setting
88
98
  # Set this to customize the certificate file to verify the peer.
89
99
  #
90
100
  # @return [String] the path to the certificate file
91
- #
92
- # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
93
- # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
94
- attr_accessor :ssl_ca_cert
101
+ attr_accessor :ssl_ca_file
95
102
 
96
103
  ### TLS/SSL setting
97
104
  # Client certificate file (for client certificate)
98
- attr_accessor :cert_file
105
+ attr_accessor :ssl_client_cert
99
106
 
100
107
  ### TLS/SSL setting
101
108
  # Client private key file (for client certificate)
102
- attr_accessor :key_file
109
+ attr_accessor :ssl_client_key
103
110
 
104
111
  # Set this to customize parameters encoding of array parameter with multi collectionFormat.
105
112
  # Default to nil.
@@ -116,15 +123,19 @@ module TransferZero
116
123
  @scheme = 'https'
117
124
  @host = 'api-sandbox.transferzero.com'
118
125
  @base_path = '/v1'
126
+ @server_index = nil
127
+ @server_operation_index = {}
128
+ @server_variables = {}
129
+ @server_operation_variables = {}
119
130
  @api_key = ''
120
131
  @api_secret = ''
121
132
  @timeout = 0
122
133
  @client_side_validation = true
123
- @verify_ssl = true
124
- @verify_ssl_host = true
125
- @params_encoding = nil
126
- @cert_file = nil
127
- @key_file = nil
134
+ @ssl_verify = true
135
+ @ssl_verify_mode = nil
136
+ @ssl_ca_file = nil
137
+ @ssl_client_cert = nil
138
+ @ssl_client_key = nil
128
139
  @debugging = false
129
140
  @inject_format = false
130
141
  @force_ending_format = false
@@ -158,9 +169,74 @@ module TransferZero
158
169
  @base_path = '' if @base_path == '/'
159
170
  end
160
171
 
161
- def base_url
162
- url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
163
- URI.encode(url)
172
+ def base_url(operation = nil)
173
+ index = server_operation_index.fetch(operation, server_index)
174
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
175
+
176
+ server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
177
+ end
178
+ # Gets Basic Auth token string
179
+ def basic_auth_token
180
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
181
+ end
182
+
183
+ # Returns Auth Settings hash for api client.
184
+ def auth_settings
185
+ {
186
+ }
187
+ end
188
+
189
+ # Returns an array of Server setting
190
+ def server_settings
191
+ [
192
+ {
193
+ url: "https://api-sandbox.transferzero.com/v1",
194
+ description: "No description provided",
195
+ },
196
+ {
197
+ url: "https://api.transferzero.com/v1",
198
+ description: "No description provided",
199
+ }
200
+ ]
201
+ end
202
+
203
+ def operation_server_settings
204
+ {
205
+ }
206
+ end
207
+
208
+ # Returns URL based on server settings
209
+ #
210
+ # @param index array index of the server settings
211
+ # @param variables hash of variable and the corresponding value
212
+ def server_url(index, variables = {}, servers = nil)
213
+ servers = server_settings if servers == nil
214
+
215
+ # check array index out of bound
216
+ if (index < 0 || index >= servers.size)
217
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
218
+ end
219
+
220
+ server = servers[index]
221
+ url = server[:url]
222
+
223
+ return url unless server.key? :variables
224
+
225
+ # go through variable and assign a value
226
+ server[:variables].each do |name, variable|
227
+ if variables.key?(name)
228
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
229
+ url.gsub! "{" + name.to_s + "}", variables[name]
230
+ else
231
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
232
+ end
233
+ else
234
+ # use default value
235
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
236
+ end
237
+ end
238
+
239
+ url
164
240
  end
165
241
  end
166
242
  end
@@ -0,0 +1,205 @@
1
+ =begin
2
+ #TransferZero API
3
+
4
+ #Reference documentation for the TransferZero API V1
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TransferZero
16
+ class CurrencyExchangeAllOf
17
+ # Lists the currencies where you can exchange from this one
18
+ attr_accessor :opposites
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'opposites' => :'opposites'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'opposites' => :'Array<CurrencyOpposite>'
31
+ }
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ if (!attributes.is_a?(Hash))
38
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::CurrencyExchangeAllOf` initialize method"
39
+ end
40
+
41
+ # check to see if the attribute exists and convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}) { |(k, v), h|
43
+ if (!self.class.attribute_map.key?(k.to_sym))
44
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::CurrencyExchangeAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
45
+ end
46
+ h[k.to_sym] = v
47
+ }
48
+
49
+ if attributes.key?(:'opposites')
50
+ if (value = attributes[:'opposites']).is_a?(Array)
51
+ self.opposites = value
52
+ end
53
+ end
54
+ end
55
+
56
+ # Show invalid properties with the reasons. Usually used together with valid?
57
+ # @return Array for valid properties with the reasons
58
+ def list_invalid_properties
59
+ invalid_properties = Array.new
60
+ invalid_properties
61
+ end
62
+
63
+ # Check to see if the all the properties in the model are valid
64
+ # @return true if the model is valid
65
+ def valid?
66
+ true
67
+ end
68
+
69
+ # Checks equality by comparing each attribute.
70
+ # @param [Object] Object to be compared
71
+ def ==(o)
72
+ return true if self.equal?(o)
73
+ self.class == o.class &&
74
+ opposites == o.opposites
75
+ end
76
+
77
+ # @see the `==` method
78
+ # @param [Object] Object to be compared
79
+ def eql?(o)
80
+ self == o
81
+ end
82
+
83
+ # Calculates hash code according to all attributes.
84
+ # @return [Integer] Hash code
85
+ def hash
86
+ [opposites].hash
87
+ end
88
+
89
+ require 'active_support/core_ext/hash'
90
+ require 'active_support/hash_with_indifferent_access.rb'
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def build_from_hash(attributes)
95
+ return nil unless attributes.is_a?(Hash)
96
+ self.class.openapi_types.each_pair do |key, type|
97
+ if type =~ /\AArray<(.*)>/i
98
+ # check to ensure the input is an array given that the the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
101
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ # Deserializes the data based on type
112
+ # @param string type Data type
113
+ # @param string value Value to be deserialized
114
+ # @return [Object] Deserialized data
115
+ def _deserialize(type, value)
116
+ case type.to_sym
117
+ when :DateTime
118
+ DateTime.parse(value)
119
+ when :Date
120
+ Date.parse(value)
121
+ when :String
122
+ value.to_s
123
+ when :Integer
124
+ value.to_i
125
+ when :Float
126
+ value.to_f
127
+ when :Boolean
128
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
+ true
130
+ else
131
+ false
132
+ end
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ else # model
148
+ temp_model = TransferZero.const_get(type).new
149
+ temp_model.build_from_hash(value)
150
+ end
151
+ end
152
+
153
+ # Returns the string representation of the object
154
+ # @return [String] String presentation of the object
155
+ def to_s
156
+ to_hash.to_s
157
+ end
158
+
159
+ # to_body is an alias to to_hash (backward compatibility)
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_body
162
+ to_hash
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ ::ActiveSupport::HashWithIndifferentAccess.new(hash)
175
+ end
176
+
177
+ def [](key)
178
+ to_hash[key]
179
+ end
180
+
181
+ def dig(*args)
182
+ to_hash.dig(*args)
183
+ end
184
+
185
+ # Outputs non-array value in the form of hash
186
+ # For object, use to_hash. Otherwise, just return the value
187
+ # @param [Object] value Any valid value
188
+ # @return [Hash] Returns the value in the form of hash
189
+ def _to_hash(value)
190
+ if value.is_a?(Array)
191
+ value.compact.map { |v| _to_hash(v) }
192
+ elsif value.is_a?(Hash)
193
+ {}.tap do |hash|
194
+ value.each { |k, v| hash[k] = _to_hash(v) }
195
+ end
196
+ elsif value.respond_to? :to_hash
197
+ value.to_hash
198
+ else
199
+ value
200
+ end
201
+ end
202
+
203
+ end
204
+
205
+ end
@@ -0,0 +1,223 @@
1
+ =begin
2
+ #TransferZero API
3
+
4
+ #Reference documentation for the TransferZero API V1
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TransferZero
16
+ class CurrencyOppositeAllOf
17
+ # The rate of this particular currency with the base one
18
+ attr_accessor :rate
19
+
20
+ # Mark to market rate of this particular currency against the base one with the margin factored in
21
+ attr_accessor :mtm_rate
22
+
23
+ # The margin set for transactions of this particular currency with the base one
24
+ attr_accessor :margin
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'rate' => :'rate',
30
+ :'mtm_rate' => :'mtm_rate',
31
+ :'margin' => :'margin'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'rate' => :'Float',
39
+ :'mtm_rate' => :'Float',
40
+ :'margin' => :'String'
41
+ }
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::CurrencyOppositeAllOf` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::CurrencyOppositeAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'rate')
60
+ self.rate = attributes[:'rate']
61
+ end
62
+
63
+ if attributes.key?(:'mtm_rate')
64
+ self.mtm_rate = attributes[:'mtm_rate']
65
+ end
66
+
67
+ if attributes.key?(:'margin')
68
+ self.margin = attributes[:'margin']
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ rate == o.rate &&
91
+ mtm_rate == o.mtm_rate &&
92
+ margin == o.margin
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [rate, mtm_rate, margin].hash
105
+ end
106
+
107
+ require 'active_support/core_ext/hash'
108
+ require 'active_support/hash_with_indifferent_access.rb'
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ self.class.openapi_types.each_pair do |key, type|
115
+ if type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that the the attribute
117
+ # is documented as an array but the input is not
118
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
119
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
120
+ end
121
+ elsif !attributes[self.class.attribute_map[key]].nil?
122
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def _deserialize(type, value)
134
+ case type.to_sym
135
+ when :DateTime
136
+ DateTime.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :Boolean
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ temp_model = TransferZero.const_get(type).new
167
+ temp_model.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ next if value.nil?
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ ::ActiveSupport::HashWithIndifferentAccess.new(hash)
193
+ end
194
+
195
+ def [](key)
196
+ to_hash[key]
197
+ end
198
+
199
+ def dig(*args)
200
+ to_hash.dig(*args)
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end