transferzero-sdk 1.0.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +93 -0
  3. data/README.md +11 -4
  4. data/docs/AccountMeta.md +1 -1
  5. data/docs/Currency.md +1 -1
  6. data/docs/CurrencyExchange.md +1 -1
  7. data/docs/CurrencyExchangeAllOf.md +17 -0
  8. data/docs/CurrencyInfoApi.md +20 -6
  9. data/docs/CurrencyOpposite.md +4 -2
  10. data/docs/CurrencyOppositeAllOf.md +19 -0
  11. data/docs/Debit.md +2 -2
  12. data/docs/DocumentWebhookAllOf.md +17 -0
  13. data/docs/FieldSelectValidation.md +1 -1
  14. data/docs/FieldValidation.md +1 -1
  15. data/docs/PayinMethodDetails.md +1 -1
  16. data/docs/PayinMethodDetailsMobile.md +1 -1
  17. data/docs/PaymentMethod.md +2 -2
  18. data/docs/PaymentMethodOpposite.md +2 -2
  19. data/docs/PayoutMethod.md +1 -1
  20. data/docs/PayoutMethodWebhookAllOf.md +17 -0
  21. data/docs/Recipient.md +4 -2
  22. data/docs/RecipientWebhookAllOf.md +17 -0
  23. data/docs/Sender.md +4 -0
  24. data/docs/SenderWebhookAllOf.md +17 -0
  25. data/docs/TransactionWebhookAllOf.md +17 -0
  26. data/lib/transferzero-sdk.rb +7 -0
  27. data/lib/transferzero-sdk/api/currency_info_api.rb +6 -0
  28. data/lib/transferzero-sdk/api_client.rb +1 -3
  29. data/lib/transferzero-sdk/models/currency_exchange.rb +2 -1
  30. data/lib/transferzero-sdk/models/currency_exchange_all_of.rb +204 -0
  31. data/lib/transferzero-sdk/models/currency_opposite.rb +16 -5
  32. data/lib/transferzero-sdk/models/currency_opposite_all_of.rb +212 -0
  33. data/lib/transferzero-sdk/models/debit.rb +2 -7
  34. data/lib/transferzero-sdk/models/document_webhook.rb +1 -0
  35. data/lib/transferzero-sdk/models/document_webhook_all_of.rb +201 -0
  36. data/lib/transferzero-sdk/models/payout_method.rb +1 -1
  37. data/lib/transferzero-sdk/models/payout_method_details_mobile.rb +1 -1
  38. data/lib/transferzero-sdk/models/payout_method_webhook.rb +1 -0
  39. data/lib/transferzero-sdk/models/payout_method_webhook_all_of.rb +201 -0
  40. data/lib/transferzero-sdk/models/recipient.rb +11 -1
  41. data/lib/transferzero-sdk/models/recipient_webhook.rb +1 -0
  42. data/lib/transferzero-sdk/models/recipient_webhook_all_of.rb +201 -0
  43. data/lib/transferzero-sdk/models/sender.rb +34 -2
  44. data/lib/transferzero-sdk/models/sender_webhook.rb +1 -0
  45. data/lib/transferzero-sdk/models/sender_webhook_all_of.rb +201 -0
  46. data/lib/transferzero-sdk/models/transaction_webhook.rb +1 -0
  47. data/lib/transferzero-sdk/models/transaction_webhook_all_of.rb +201 -0
  48. data/lib/transferzero-sdk/version.rb +1 -1
  49. data/spec/models/currency_exchange_all_of_spec.rb +41 -0
  50. data/spec/models/currency_opposite_all_of_spec.rb +41 -0
  51. data/spec/models/document_webhook_all_of_spec.rb +41 -0
  52. data/spec/models/payout_method_webhook_all_of_spec.rb +41 -0
  53. data/spec/models/recipient_webhook_all_of_spec.rb +41 -0
  54. data/spec/models/sender_webhook_all_of_spec.rb +41 -0
  55. data/spec/models/transaction_webhook_all_of_spec.rb +41 -0
  56. metadata +44 -16
@@ -0,0 +1,212 @@
1
+ =begin
2
+ #TransferZero API
3
+
4
+ #Reference documentation for the TransferZero API V1
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-beta3
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
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'rate' => :'rate',
27
+ :'mtm_rate' => :'mtm_rate'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'rate' => :'Float',
35
+ :'mtm_rate' => :'Float'
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::CurrencyOppositeAllOf` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ 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
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'rate')
55
+ self.rate = attributes[:'rate']
56
+ end
57
+
58
+ if attributes.key?(:'mtm_rate')
59
+ self.mtm_rate = attributes[:'mtm_rate']
60
+ end
61
+ end
62
+
63
+ # Show invalid properties with the reasons. Usually used together with valid?
64
+ # @return Array for valid properties with the reasons
65
+ def list_invalid_properties
66
+ invalid_properties = Array.new
67
+ invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ true
74
+ end
75
+
76
+ # Checks equality by comparing each attribute.
77
+ # @param [Object] Object to be compared
78
+ def ==(o)
79
+ return true if self.equal?(o)
80
+ self.class == o.class &&
81
+ rate == o.rate &&
82
+ mtm_rate == o.mtm_rate
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Integer] Hash code
93
+ def hash
94
+ [rate, mtm_rate].hash
95
+ end
96
+
97
+ require 'active_support/core_ext/hash'
98
+ require 'active_support/hash_with_indifferent_access.rb'
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def build_from_hash(attributes)
103
+ return nil unless attributes.is_a?(Hash)
104
+ self.class.openapi_types.each_pair do |key, type|
105
+ if type =~ /\AArray<(.*)>/i
106
+ # check to ensure the input is an array given that the the attribute
107
+ # is documented as an array but the input is not
108
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
109
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
110
+ end
111
+ elsif !attributes[self.class.attribute_map[key]].nil?
112
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
113
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
114
+ end
115
+
116
+ self
117
+ end
118
+
119
+ # Deserializes the data based on type
120
+ # @param string type Data type
121
+ # @param string value Value to be deserialized
122
+ # @return [Object] Deserialized data
123
+ def _deserialize(type, value)
124
+ case type.to_sym
125
+ when :DateTime
126
+ DateTime.parse(value)
127
+ when :Date
128
+ Date.parse(value)
129
+ when :String
130
+ value.to_s
131
+ when :Integer
132
+ value.to_i
133
+ when :Float
134
+ value.to_f
135
+ when :Boolean
136
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
137
+ true
138
+ else
139
+ false
140
+ end
141
+ when :Object
142
+ # generic object (usually a Hash), return directly
143
+ value
144
+ when /\AArray<(?<inner_type>.+)>\z/
145
+ inner_type = Regexp.last_match[:inner_type]
146
+ value.map { |v| _deserialize(inner_type, v) }
147
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
148
+ k_type = Regexp.last_match[:k_type]
149
+ v_type = Regexp.last_match[:v_type]
150
+ {}.tap do |hash|
151
+ value.each do |k, v|
152
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
153
+ end
154
+ end
155
+ else # model
156
+ temp_model = TransferZero.const_get(type).new
157
+ temp_model.build_from_hash(value)
158
+ end
159
+ end
160
+
161
+ # Returns the string representation of the object
162
+ # @return [String] String presentation of the object
163
+ def to_s
164
+ to_hash.to_s
165
+ end
166
+
167
+ # to_body is an alias to to_hash (backward compatibility)
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_body
170
+ to_hash
171
+ end
172
+
173
+ # Returns the object in the form of hash
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_hash
176
+ hash = {}
177
+ self.class.attribute_map.each_pair do |attr, param|
178
+ value = self.send(attr)
179
+ next if value.nil?
180
+ hash[param] = _to_hash(value)
181
+ end
182
+ ::ActiveSupport::HashWithIndifferentAccess.new(hash)
183
+ end
184
+
185
+ def [](key)
186
+ to_hash[key]
187
+ end
188
+
189
+ def dig(*args)
190
+ to_hash.dig(*args)
191
+ end
192
+
193
+ # Outputs non-array value in the form of hash
194
+ # For object, use to_hash. Otherwise, just return the value
195
+ # @param [Object] value Any valid value
196
+ # @return [Hash] Returns the value in the form of hash
197
+ def _to_hash(value)
198
+ if value.is_a?(Array)
199
+ value.compact.map { |v| _to_hash(v) }
200
+ elsif value.is_a?(Hash)
201
+ {}.tap do |hash|
202
+ value.each { |k, v| hash[k] = _to_hash(v) }
203
+ end
204
+ elsif value.respond_to? :to_hash
205
+ value.to_hash
206
+ else
207
+ value
208
+ end
209
+ end
210
+
211
+ end
212
+ end
@@ -15,10 +15,10 @@ require 'date'
15
15
  module TransferZero
16
16
  # Debits are used to fund transactions from your internal TransferZero balance.
17
17
  class Debit
18
- # The amount to be debited from your account. The amount parameter is optional - - if included, it must equal the amount required to fund the transaction. - if omitted, it will default to the amount required to fund the transaction.
18
+ # The amount to be debited from your account. The \"amount\" parameter is optional - - if included, it must equal the amount required to fund the transaction. - if omitted, it will default to the amount required to fund the transaction.
19
19
  attr_accessor :amount
20
20
 
21
- # The currency of the amount in 3-character alpha ISO 4217 currency format
21
+ # The currency of the amount in 3-character alpha ISO 4217 currency format. The \"currency\" parameter is optional - if omitted, it will default to the payin currency of the transaction. - it can be added in as an additional check to ensure that the expected currency is used. (an error will be given back if it does not match up with the payin currency of the transaction)
22
22
  attr_accessor :currency
23
23
 
24
24
  # Describes what the debit is funding
@@ -138,10 +138,6 @@ module TransferZero
138
138
  # @return Array for valid properties with the reasons
139
139
  def list_invalid_properties
140
140
  invalid_properties = Array.new
141
- if @currency.nil?
142
- invalid_properties.push('invalid value for "currency", currency cannot be nil.')
143
- end
144
-
145
141
  if @to_type.nil?
146
142
  invalid_properties.push('invalid value for "to_type", to_type cannot be nil.')
147
143
  end
@@ -156,7 +152,6 @@ module TransferZero
156
152
  # Check to see if the all the properties in the model are valid
157
153
  # @return true if the model is valid
158
154
  def valid?
159
- return false if @currency.nil?
160
155
  return false if @to_type.nil?
161
156
  return false if @to_id.nil?
162
157
  true
@@ -43,6 +43,7 @@ module TransferZero
43
43
  # List of class defined in allOf (OpenAPI v3)
44
44
  def self.openapi_all_of
45
45
  [
46
+ :'DocumentWebhookAllOf',
46
47
  :'Webhook'
47
48
  ]
48
49
  end
@@ -0,0 +1,201 @@
1
+ =begin
2
+ #TransferZero API
3
+
4
+ #Reference documentation for the TransferZero API V1
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-beta3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TransferZero
16
+ class DocumentWebhookAllOf
17
+ attr_accessor :object
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'object' => :'object'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'object' => :'Document'
30
+ }
31
+ end
32
+
33
+ # Initializes the object
34
+ # @param [Hash] attributes Model attributes in the form of hash
35
+ def initialize(attributes = {})
36
+ if (!attributes.is_a?(Hash))
37
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::DocumentWebhookAllOf` initialize method"
38
+ end
39
+
40
+ # check to see if the attribute exists and convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}) { |(k, v), h|
42
+ if (!self.class.attribute_map.key?(k.to_sym))
43
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::DocumentWebhookAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
44
+ end
45
+ h[k.to_sym] = v
46
+ }
47
+
48
+ if attributes.key?(:'object')
49
+ self.object = attributes[:'object']
50
+ end
51
+ end
52
+
53
+ # Show invalid properties with the reasons. Usually used together with valid?
54
+ # @return Array for valid properties with the reasons
55
+ def list_invalid_properties
56
+ invalid_properties = Array.new
57
+ invalid_properties
58
+ end
59
+
60
+ # Check to see if the all the properties in the model are valid
61
+ # @return true if the model is valid
62
+ def valid?
63
+ true
64
+ end
65
+
66
+ # Checks equality by comparing each attribute.
67
+ # @param [Object] Object to be compared
68
+ def ==(o)
69
+ return true if self.equal?(o)
70
+ self.class == o.class &&
71
+ object == o.object
72
+ end
73
+
74
+ # @see the `==` method
75
+ # @param [Object] Object to be compared
76
+ def eql?(o)
77
+ self == o
78
+ end
79
+
80
+ # Calculates hash code according to all attributes.
81
+ # @return [Integer] Hash code
82
+ def hash
83
+ [object].hash
84
+ end
85
+
86
+ require 'active_support/core_ext/hash'
87
+ require 'active_support/hash_with_indifferent_access.rb'
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.openapi_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :Boolean
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ temp_model = TransferZero.const_get(type).new
146
+ temp_model.build_from_hash(value)
147
+ end
148
+ end
149
+
150
+ # Returns the string representation of the object
151
+ # @return [String] String presentation of the object
152
+ def to_s
153
+ to_hash.to_s
154
+ end
155
+
156
+ # to_body is an alias to to_hash (backward compatibility)
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_body
159
+ to_hash
160
+ end
161
+
162
+ # Returns the object in the form of hash
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = self.send(attr)
168
+ next if value.nil?
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ ::ActiveSupport::HashWithIndifferentAccess.new(hash)
172
+ end
173
+
174
+ def [](key)
175
+ to_hash[key]
176
+ end
177
+
178
+ def dig(*args)
179
+ to_hash.dig(*args)
180
+ end
181
+
182
+ # Outputs non-array value in the form of hash
183
+ # For object, use to_hash. Otherwise, just return the value
184
+ # @param [Object] value Any valid value
185
+ # @return [Hash] Returns the value in the form of hash
186
+ def _to_hash(value)
187
+ if value.is_a?(Array)
188
+ value.compact.map { |v| _to_hash(v) }
189
+ elsif value.is_a?(Hash)
190
+ {}.tap do |hash|
191
+ value.each { |k, v| hash[k] = _to_hash(v) }
192
+ end
193
+ elsif value.respond_to? :to_hash
194
+ value.to_hash
195
+ else
196
+ value
197
+ end
198
+ end
199
+
200
+ end
201
+ end