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.
- checksums.yaml +4 -4
- data/Gemfile.lock +93 -0
- data/README.md +11 -4
- data/docs/AccountMeta.md +1 -1
- data/docs/Currency.md +1 -1
- data/docs/CurrencyExchange.md +1 -1
- data/docs/CurrencyExchangeAllOf.md +17 -0
- data/docs/CurrencyInfoApi.md +20 -6
- data/docs/CurrencyOpposite.md +4 -2
- data/docs/CurrencyOppositeAllOf.md +19 -0
- data/docs/Debit.md +2 -2
- data/docs/DocumentWebhookAllOf.md +17 -0
- data/docs/FieldSelectValidation.md +1 -1
- data/docs/FieldValidation.md +1 -1
- data/docs/PayinMethodDetails.md +1 -1
- data/docs/PayinMethodDetailsMobile.md +1 -1
- data/docs/PaymentMethod.md +2 -2
- data/docs/PaymentMethodOpposite.md +2 -2
- data/docs/PayoutMethod.md +1 -1
- data/docs/PayoutMethodWebhookAllOf.md +17 -0
- data/docs/Recipient.md +4 -2
- data/docs/RecipientWebhookAllOf.md +17 -0
- data/docs/Sender.md +4 -0
- data/docs/SenderWebhookAllOf.md +17 -0
- data/docs/TransactionWebhookAllOf.md +17 -0
- data/lib/transferzero-sdk.rb +7 -0
- data/lib/transferzero-sdk/api/currency_info_api.rb +6 -0
- data/lib/transferzero-sdk/api_client.rb +1 -3
- data/lib/transferzero-sdk/models/currency_exchange.rb +2 -1
- data/lib/transferzero-sdk/models/currency_exchange_all_of.rb +204 -0
- data/lib/transferzero-sdk/models/currency_opposite.rb +16 -5
- data/lib/transferzero-sdk/models/currency_opposite_all_of.rb +212 -0
- data/lib/transferzero-sdk/models/debit.rb +2 -7
- data/lib/transferzero-sdk/models/document_webhook.rb +1 -0
- data/lib/transferzero-sdk/models/document_webhook_all_of.rb +201 -0
- data/lib/transferzero-sdk/models/payout_method.rb +1 -1
- data/lib/transferzero-sdk/models/payout_method_details_mobile.rb +1 -1
- data/lib/transferzero-sdk/models/payout_method_webhook.rb +1 -0
- data/lib/transferzero-sdk/models/payout_method_webhook_all_of.rb +201 -0
- data/lib/transferzero-sdk/models/recipient.rb +11 -1
- data/lib/transferzero-sdk/models/recipient_webhook.rb +1 -0
- data/lib/transferzero-sdk/models/recipient_webhook_all_of.rb +201 -0
- data/lib/transferzero-sdk/models/sender.rb +34 -2
- data/lib/transferzero-sdk/models/sender_webhook.rb +1 -0
- data/lib/transferzero-sdk/models/sender_webhook_all_of.rb +201 -0
- data/lib/transferzero-sdk/models/transaction_webhook.rb +1 -0
- data/lib/transferzero-sdk/models/transaction_webhook_all_of.rb +201 -0
- data/lib/transferzero-sdk/version.rb +1 -1
- data/spec/models/currency_exchange_all_of_spec.rb +41 -0
- data/spec/models/currency_opposite_all_of_spec.rb +41 -0
- data/spec/models/document_webhook_all_of_spec.rb +41 -0
- data/spec/models/payout_method_webhook_all_of_spec.rb +41 -0
- data/spec/models/recipient_webhook_all_of_spec.rb +41 -0
- data/spec/models/sender_webhook_all_of_spec.rb +41 -0
- data/spec/models/transaction_webhook_all_of_spec.rb +41 -0
- metadata +44 -16
@@ -0,0 +1,17 @@
|
|
1
|
+
# TransferZero::PayoutMethodWebhookAllOf
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**object** | [**PayoutMethod**](PayoutMethod.md) | | [optional]
|
8
|
+
|
9
|
+
## Code Sample
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'TransferZero'
|
13
|
+
|
14
|
+
instance = TransferZero::PayoutMethodWebhookAllOf.new(object: null)
|
15
|
+
```
|
16
|
+
|
17
|
+
|
data/docs/Recipient.md
CHANGED
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
|
|
10
10
|
**metadata** | [**Object**](.md) | Additional metadata that can be added to a recipient. These values will be returned on request | [optional]
|
11
11
|
**created_at** | **DateTime** | Date and time that the recipient was created. | [optional]
|
12
12
|
**editable** | **Boolean** | Shows whether the recipient can be edited using the PATCH /v1/recipients/{id} endpoint or not | [optional]
|
13
|
+
**retriable** | **Boolean** | Shows whether the transaction made to the recipient can be retried or not | [optional]
|
13
14
|
**input_usd_amount** | **Float** | Shows how much this payment is worth in USD | [optional]
|
14
15
|
**may_cancel** | **Boolean** | Shows whether the payment can be cancelled using the DELETE /v1/recipients/{id} endpoint or not. The payment can not be cancelled if the payout is pending. | [optional]
|
15
16
|
**state_reason** | **String** | In case the payment is unsuccessful it holds the error message associated with the last unsuccessful payout. | [optional]
|
@@ -35,9 +36,10 @@ instance = TransferZero::Recipient.new(requested_amount: 750.0,
|
|
35
36
|
payout_method: null,
|
36
37
|
metadata: {},
|
37
38
|
created_at: null,
|
38
|
-
editable:
|
39
|
+
editable: true,
|
40
|
+
retriable: true,
|
39
41
|
input_usd_amount: 10,
|
40
|
-
may_cancel:
|
42
|
+
may_cancel: true,
|
41
43
|
state_reason: null,
|
42
44
|
state: null,
|
43
45
|
transaction_id: 97e79719-06e4-4794-aeeb-d2d9415d983a,
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# TransferZero::RecipientWebhookAllOf
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**object** | [**Recipient**](Recipient.md) | | [optional]
|
8
|
+
|
9
|
+
## Code Sample
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'TransferZero'
|
13
|
+
|
14
|
+
instance = TransferZero::RecipientWebhookAllOf.new(object: null)
|
15
|
+
```
|
16
|
+
|
17
|
+
|
data/docs/Sender.md
CHANGED
@@ -24,6 +24,8 @@ Name | Type | Description | Notes
|
|
24
24
|
**postal_code** | **String** | Zip code of sender |
|
25
25
|
**birth_date** | **Date** | Date of birth of sender | [optional]
|
26
26
|
**ip** | **String** | IP of sender |
|
27
|
+
**identification_number** | **String** | Identification number of document used | [optional]
|
28
|
+
**identification_type** | **String** | Document to be identified. The identification type can be one of the following: - `DL`: Driving License - `PP`: International Passport - `ID`: National ID - `OT`: Other | [optional]
|
27
29
|
**documents** | [**Array<Document>**](Document.md) | Needed for KYC checks. Required to approve the sender unless KYC is waived for your account. Please send us an empty list of documents: `\"documents\": [ ]` in the request if KYC has been waived. If the documents already exist, please send the Document ID eg. ```JSON \"documents\": [ { \"id\": \"b6648ba3-1c7b-4f59-8580-684899c84a07\" } ] ``` |
|
28
30
|
**metadata** | [**Object**](.md) | Metadata of sender. You can store any detail specific to your integration here (for example the local ID of the sender on your end). When requesting sender details you will receive the sent metadata back. Also when sending sender related webhooks you will receive the details stored here as well. | [optional]
|
29
31
|
**state** | [**SenderState**](SenderState.md) | | [optional]
|
@@ -56,6 +58,8 @@ instance = TransferZero::Sender.new(type: person,
|
|
56
58
|
postal_code: 798983,
|
57
59
|
birth_date: null,
|
58
60
|
ip: 127.0.0.1,
|
61
|
+
identification_number: AB123456,
|
62
|
+
identification_type: ID,
|
59
63
|
documents: [{"id":"b6648ba3-1c7b-4f59-8580-684899c84a07"}],
|
60
64
|
metadata: {},
|
61
65
|
state: null,
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# TransferZero::SenderWebhookAllOf
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**object** | [**Sender**](Sender.md) | | [optional]
|
8
|
+
|
9
|
+
## Code Sample
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'TransferZero'
|
13
|
+
|
14
|
+
instance = TransferZero::SenderWebhookAllOf.new(object: null)
|
15
|
+
```
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# TransferZero::TransactionWebhookAllOf
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**object** | [**Transaction**](Transaction.md) | | [optional]
|
8
|
+
|
9
|
+
## Code Sample
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'TransferZero'
|
13
|
+
|
14
|
+
instance = TransferZero::TransactionWebhookAllOf.new(object: null)
|
15
|
+
```
|
16
|
+
|
17
|
+
|
data/lib/transferzero-sdk.rb
CHANGED
@@ -30,9 +30,11 @@ require 'transferzero-sdk/models/api_log_list_response'
|
|
30
30
|
require 'transferzero-sdk/models/api_log_response'
|
31
31
|
require 'transferzero-sdk/models/currency'
|
32
32
|
require 'transferzero-sdk/models/currency_exchange'
|
33
|
+
require 'transferzero-sdk/models/currency_exchange_all_of'
|
33
34
|
require 'transferzero-sdk/models/currency_exchange_list_response'
|
34
35
|
require 'transferzero-sdk/models/currency_list_response'
|
35
36
|
require 'transferzero-sdk/models/currency_opposite'
|
37
|
+
require 'transferzero-sdk/models/currency_opposite_all_of'
|
36
38
|
require 'transferzero-sdk/models/debit'
|
37
39
|
require 'transferzero-sdk/models/debit_list_request'
|
38
40
|
require 'transferzero-sdk/models/debit_list_response'
|
@@ -44,6 +46,7 @@ require 'transferzero-sdk/models/document_list_response'
|
|
44
46
|
require 'transferzero-sdk/models/document_request'
|
45
47
|
require 'transferzero-sdk/models/document_response'
|
46
48
|
require 'transferzero-sdk/models/document_webhook'
|
49
|
+
require 'transferzero-sdk/models/document_webhook_all_of'
|
47
50
|
require 'transferzero-sdk/models/error_status'
|
48
51
|
require 'transferzero-sdk/models/field_description'
|
49
52
|
require 'transferzero-sdk/models/field_select_validation'
|
@@ -75,12 +78,14 @@ require 'transferzero-sdk/models/payout_method_mobile_provider_enum'
|
|
75
78
|
require 'transferzero-sdk/models/payout_method_request'
|
76
79
|
require 'transferzero-sdk/models/payout_method_response'
|
77
80
|
require 'transferzero-sdk/models/payout_method_webhook'
|
81
|
+
require 'transferzero-sdk/models/payout_method_webhook_all_of'
|
78
82
|
require 'transferzero-sdk/models/recipient'
|
79
83
|
require 'transferzero-sdk/models/recipient_list_response'
|
80
84
|
require 'transferzero-sdk/models/recipient_request'
|
81
85
|
require 'transferzero-sdk/models/recipient_response'
|
82
86
|
require 'transferzero-sdk/models/recipient_state'
|
83
87
|
require 'transferzero-sdk/models/recipient_webhook'
|
88
|
+
require 'transferzero-sdk/models/recipient_webhook_all_of'
|
84
89
|
require 'transferzero-sdk/models/sender'
|
85
90
|
require 'transferzero-sdk/models/sender_list_response'
|
86
91
|
require 'transferzero-sdk/models/sender_request'
|
@@ -89,6 +94,7 @@ require 'transferzero-sdk/models/sender_response_existing'
|
|
89
94
|
require 'transferzero-sdk/models/sender_response_meta'
|
90
95
|
require 'transferzero-sdk/models/sender_state'
|
91
96
|
require 'transferzero-sdk/models/sender_webhook'
|
97
|
+
require 'transferzero-sdk/models/sender_webhook_all_of'
|
92
98
|
require 'transferzero-sdk/models/transaction'
|
93
99
|
require 'transferzero-sdk/models/transaction_list_response'
|
94
100
|
require 'transferzero-sdk/models/transaction_request'
|
@@ -98,6 +104,7 @@ require 'transferzero-sdk/models/transaction_response_meta'
|
|
98
104
|
require 'transferzero-sdk/models/transaction_state'
|
99
105
|
require 'transferzero-sdk/models/transaction_traits'
|
100
106
|
require 'transferzero-sdk/models/transaction_webhook'
|
107
|
+
require 'transferzero-sdk/models/transaction_webhook_all_of'
|
101
108
|
require 'transferzero-sdk/models/validation_error_description'
|
102
109
|
require 'transferzero-sdk/models/webhook'
|
103
110
|
require 'transferzero-sdk/models/webhook_definition'
|
@@ -72,6 +72,7 @@ module TransferZero
|
|
72
72
|
# Getting a list of possible input currencies
|
73
73
|
# Fetches a list of currencies available to use as the input currency in other API requests. Usually the 3-character alpha ISO 4217 currency code (eg. USD) is used as the identifier. Use this endpoint to determine the current exchange rate from a specific input currency to any output currency that's available.
|
74
74
|
# @param [Hash] opts the optional parameters
|
75
|
+
# @option opts [String] :sender_id Allows the scoping of the results by `sender_id` (optional). Example: `/v1/info/currencies/in?sender_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
|
75
76
|
# @return [CurrencyExchangeListResponse]
|
76
77
|
def info_currencies_in(opts = {})
|
77
78
|
data, _status_code, _headers = info_currencies_in_with_http_info(opts)
|
@@ -81,6 +82,7 @@ module TransferZero
|
|
81
82
|
# Getting a list of possible input currencies
|
82
83
|
# Fetches a list of currencies available to use as the input currency in other API requests. Usually the 3-character alpha ISO 4217 currency code (eg. USD) is used as the identifier. Use this endpoint to determine the current exchange rate from a specific input currency to any output currency that's available.
|
83
84
|
# @param [Hash] opts the optional parameters
|
85
|
+
# @option opts [String] :sender_id Allows the scoping of the results by `sender_id` (optional). Example: `/v1/info/currencies/in?sender_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
|
84
86
|
# @return [Array<(CurrencyExchangeListResponse, Fixnum, Hash)>] CurrencyExchangeListResponse data, response status code and response headers
|
85
87
|
def info_currencies_in_with_http_info(opts = {})
|
86
88
|
if @api_client.config.debugging
|
@@ -91,6 +93,7 @@ module TransferZero
|
|
91
93
|
|
92
94
|
# query parameters
|
93
95
|
query_params = {}
|
96
|
+
query_params[:'sender_id'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?
|
94
97
|
|
95
98
|
# header parameters
|
96
99
|
header_params = {}
|
@@ -120,6 +123,7 @@ module TransferZero
|
|
120
123
|
# Getting a list of possible output currencies
|
121
124
|
# Fetches a list of currencies available to use as the output currency and their exchange rates against the available input currencies. Usually the 3-character alpha ISO 4217 currency code (eg. USD) is used as the identifier.
|
122
125
|
# @param [Hash] opts the optional parameters
|
126
|
+
# @option opts [String] :sender_id Allows the scoping of the results by `sender_id` (optional). Example: `/v1/info/currencies/out?sender_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
|
123
127
|
# @return [CurrencyExchangeListResponse]
|
124
128
|
def info_currencies_out(opts = {})
|
125
129
|
data, _status_code, _headers = info_currencies_out_with_http_info(opts)
|
@@ -129,6 +133,7 @@ module TransferZero
|
|
129
133
|
# Getting a list of possible output currencies
|
130
134
|
# Fetches a list of currencies available to use as the output currency and their exchange rates against the available input currencies. Usually the 3-character alpha ISO 4217 currency code (eg. USD) is used as the identifier.
|
131
135
|
# @param [Hash] opts the optional parameters
|
136
|
+
# @option opts [String] :sender_id Allows the scoping of the results by `sender_id` (optional). Example: `/v1/info/currencies/out?sender_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
|
132
137
|
# @return [Array<(CurrencyExchangeListResponse, Fixnum, Hash)>] CurrencyExchangeListResponse data, response status code and response headers
|
133
138
|
def info_currencies_out_with_http_info(opts = {})
|
134
139
|
if @api_client.config.debugging
|
@@ -139,6 +144,7 @@ module TransferZero
|
|
139
144
|
|
140
145
|
# query parameters
|
141
146
|
query_params = {}
|
147
|
+
query_params[:'sender_id'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?
|
142
148
|
|
143
149
|
# header parameters
|
144
150
|
header_params = {}
|
@@ -35,7 +35,7 @@ module TransferZero
|
|
35
35
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
36
36
|
def initialize(config = Configuration.default)
|
37
37
|
@config = config
|
38
|
-
@user_agent = "TransferZero-SDK/Ruby/1.
|
38
|
+
@user_agent = "TransferZero-SDK/Ruby/1.3.0"
|
39
39
|
@default_headers = {
|
40
40
|
'Content-Type' => 'application/json',
|
41
41
|
'User-Agent' => @user_agent
|
@@ -186,8 +186,6 @@ module TransferZero
|
|
186
186
|
# @param headers The request header
|
187
187
|
#
|
188
188
|
# @return boolean
|
189
|
-
#
|
190
|
-
|
191
189
|
def validate_webhook_request(url, body, headers)
|
192
190
|
nonce = headers[:'Authorization-Nonce'] || headers['Authorization-Nonce']
|
193
191
|
signature = headers[:'Authorization-Signature'] || headers['Authorization-Signature']
|
@@ -0,0 +1,204 @@
|
|
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 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
|
+
end
|
@@ -47,6 +47,9 @@ module TransferZero
|
|
47
47
|
# The rate of this particular currency with the base one
|
48
48
|
attr_accessor :rate
|
49
49
|
|
50
|
+
# Mark to market rate of this particular currency against the base one with the margin factored in
|
51
|
+
attr_accessor :mtm_rate
|
52
|
+
|
50
53
|
# Attribute mapping from ruby-style variable name to JSON key.
|
51
54
|
def self.attribute_map
|
52
55
|
{
|
@@ -60,7 +63,8 @@ module TransferZero
|
|
60
63
|
:'max' => :'max',
|
61
64
|
:'margin' => :'margin',
|
62
65
|
:'usd_equivalent' => :'usd_equivalent',
|
63
|
-
:'rate' => :'rate'
|
66
|
+
:'rate' => :'rate',
|
67
|
+
:'mtm_rate' => :'mtm_rate'
|
64
68
|
}
|
65
69
|
end
|
66
70
|
|
@@ -77,14 +81,16 @@ module TransferZero
|
|
77
81
|
:'max' => :'String',
|
78
82
|
:'margin' => :'String',
|
79
83
|
:'usd_equivalent' => :'String',
|
80
|
-
:'rate' => :'Float'
|
84
|
+
:'rate' => :'Float',
|
85
|
+
:'mtm_rate' => :'Float'
|
81
86
|
}
|
82
87
|
end
|
83
88
|
|
84
89
|
# List of class defined in allOf (OpenAPI v3)
|
85
90
|
def self.openapi_all_of
|
86
91
|
[
|
87
|
-
:'Currency'
|
92
|
+
:'Currency',
|
93
|
+
:'CurrencyOppositeAllOf'
|
88
94
|
]
|
89
95
|
end
|
90
96
|
|
@@ -146,6 +152,10 @@ module TransferZero
|
|
146
152
|
if attributes.key?(:'rate')
|
147
153
|
self.rate = attributes[:'rate']
|
148
154
|
end
|
155
|
+
|
156
|
+
if attributes.key?(:'mtm_rate')
|
157
|
+
self.mtm_rate = attributes[:'mtm_rate']
|
158
|
+
end
|
149
159
|
end
|
150
160
|
|
151
161
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -176,7 +186,8 @@ module TransferZero
|
|
176
186
|
max == o.max &&
|
177
187
|
margin == o.margin &&
|
178
188
|
usd_equivalent == o.usd_equivalent &&
|
179
|
-
rate == o.rate
|
189
|
+
rate == o.rate &&
|
190
|
+
mtm_rate == o.mtm_rate
|
180
191
|
end
|
181
192
|
|
182
193
|
# @see the `==` method
|
@@ -188,7 +199,7 @@ module TransferZero
|
|
188
199
|
# Calculates hash code according to all attributes.
|
189
200
|
# @return [Integer] Hash code
|
190
201
|
def hash
|
191
|
-
[code, name, symbol, decimals, subunit_to_unit, primary, min, max, margin, usd_equivalent, rate].hash
|
202
|
+
[code, name, symbol, decimals, subunit_to_unit, primary, min, max, margin, usd_equivalent, rate, mtm_rate].hash
|
192
203
|
end
|
193
204
|
|
194
205
|
require 'active_support/core_ext/hash'
|