fuse_client 1.0.38 → 1.0.40

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/docs/CreateConsumerRiskReportRequest.md +2 -0
  4. data/docs/CreateLinkTokenRequest.md +3 -1
  5. data/docs/CreateLinkTokenRequestSnaptrade.md +18 -0
  6. data/docs/CreateLinkTokenRequestSnaptradeConfig.md +18 -0
  7. data/docs/EnrichedTransaction.md +4 -26
  8. data/docs/ExternalTransactionEvent.md +6 -0
  9. data/docs/FinancialConnectionsAccount.md +2 -0
  10. data/docs/FinancialConnectionsAccountLiability.md +2 -0
  11. data/docs/FuseApi.md +1 -1
  12. data/docs/TransactionToEnrich.md +13 -5
  13. data/lib/fuse_client/configuration.rb +5 -1
  14. data/lib/fuse_client/models/create_consumer_risk_report_request.rb +11 -1
  15. data/lib/fuse_client/models/create_link_token_request.rb +13 -4
  16. data/lib/fuse_client/models/create_link_token_request_snaptrade.rb +220 -0
  17. data/lib/fuse_client/models/create_link_token_request_snaptrade_config.rb +256 -0
  18. data/lib/fuse_client/models/enriched_transaction.rb +17 -158
  19. data/lib/fuse_client/models/external_transaction_event.rb +44 -1
  20. data/lib/fuse_client/models/financial_connections_account.rb +16 -1
  21. data/lib/fuse_client/models/financial_connections_account_balance.rb +2 -0
  22. data/lib/fuse_client/models/financial_connections_account_cached_balance.rb +2 -0
  23. data/lib/fuse_client/models/financial_connections_account_liability.rb +16 -1
  24. data/lib/fuse_client/models/transaction_to_enrich.rb +130 -27
  25. data/lib/fuse_client/version.rb +1 -1
  26. data/lib/fuse_client.rb +2 -0
  27. data/spec/models/asset_report_transaction_spec.rb +1 -1
  28. data/spec/models/create_consumer_risk_report_request_spec.rb +6 -0
  29. data/spec/models/create_link_token_request_snaptrade_config_spec.rb +38 -0
  30. data/spec/models/create_link_token_request_snaptrade_spec.rb +34 -0
  31. data/spec/models/create_link_token_request_spec.rb +6 -0
  32. data/spec/models/enriched_transaction_spec.rb +2 -72
  33. data/spec/models/external_transaction_event_spec.rb +22 -0
  34. data/spec/models/financial_connections_account_liability_spec.rb +6 -0
  35. data/spec/models/financial_connections_account_spec.rb +6 -0
  36. data/spec/models/transaction_spec.rb +1 -1
  37. data/spec/models/transaction_to_enrich_spec.rb +32 -4
  38. metadata +20 -13
  39. data/fuse_client-1.0.37.gem +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 351d5ff5a46eaedee35749af460dc341d897dc6a9bc42e00b66316d57df26a8a
4
- data.tar.gz: 2e1b7c5b760b4adf13f5458a5c4ea04be6c90108be98f0d4501946ea29574c03
3
+ metadata.gz: 405c7dda28ecef0c84f7d5139e118bd251b7642653664706b522660e27cbd4c6
4
+ data.tar.gz: 804299b0297286305bd7f256061195cfc16c213dafdfc3fd90c76e9a46291d9f
5
5
  SHA512:
6
- metadata.gz: 4dcae290bc05b205832431c53b1375c8be1cfea1e2a18eff5dd59bb5b5b7c8b2854076d87fababc6a97583d75739a4b44fec6033858f6b65917a0c103d10873a
7
- data.tar.gz: d8926148e2f571491c9e8f4e79e1df937dabe48c56aea0a94803250e4c6bde81d2203c7abcef2317897ded6fec3cd0fb924b71f9c51737ffef5e2222de513afb
6
+ metadata.gz: 66c922e7fd3dd49b6ee4eeac05401839f9b0853ec1c375163be10273ecb915d3d4901c0cca7fe321190e9066fc2e531f27ee9716f88a07345f9dad877678d1e6
7
+ data.tar.gz: f5b4045c9b26bbbb761548fc9dc6a0c17bd89a4a14fac0088a8fde8ddce48db6d1af86635cad4719a20baa251dd7eed183a7fb6b53478da67ac941397601c57d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fuse_client (1.0.38)
4
+ fuse_client (1.0.40)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -40,7 +40,7 @@ GEM
40
40
  rspec-expectations (3.12.3)
41
41
  diff-lcs (>= 1.2.0, < 2.0)
42
42
  rspec-support (~> 3.12.0)
43
- rspec-mocks (3.12.5)
43
+ rspec-mocks (3.12.6)
44
44
  diff-lcs (>= 1.2.0, < 2.0)
45
45
  rspec-support (~> 3.12.0)
46
46
  rspec-support (3.12.1)
@@ -6,6 +6,7 @@
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **account_id** | **String** | A unique ID representing the bank account that this risk report is calculated for. Typically this will be a bank connection account ID from your application. It is currently used as a means of connecting events to the consumer risk report. | |
8
8
  | **iso_currency_code** | **String** | The ISO-4217 currency code of the transaction | |
9
+ | **end_user_name** | **String** | The name of the end user associated with this consumer risk report. | [optional] |
9
10
  | **customization_id** | **String** | This is used to determine the timeframe and other metadata for the consumer risk report. | |
10
11
 
11
12
  ## Example
@@ -16,6 +17,7 @@ require 'fuse_client'
16
17
  instance = FuseClient::CreateConsumerRiskReportRequest.new(
17
18
  account_id: null,
18
19
  iso_currency_code: null,
20
+ end_user_name: null,
19
21
  customization_id: null
20
22
  )
21
23
  ```
@@ -12,6 +12,7 @@
12
12
  | **mx** | [**CreateLinkTokenRequestMx**](CreateLinkTokenRequestMx.md) | | [optional] |
13
13
  | **plaid** | [**CreateLinkTokenRequestPlaid**](CreateLinkTokenRequestPlaid.md) | | [optional] |
14
14
  | **teller** | [**CreateLinkTokenRequestTeller**](CreateLinkTokenRequestTeller.md) | | [optional] |
15
+ | **snaptrade** | [**CreateLinkTokenRequestSnaptrade**](CreateLinkTokenRequestSnaptrade.md) | | [optional] |
15
16
 
16
17
  ## Example
17
18
 
@@ -26,7 +27,8 @@ instance = FuseClient::CreateLinkTokenRequest.new(
26
27
  webhook_url: null,
27
28
  mx: null,
28
29
  plaid: null,
29
- teller: null
30
+ teller: null,
31
+ snaptrade: null
30
32
  )
31
33
  ```
32
34
 
@@ -0,0 +1,18 @@
1
+ # FuseClient::CreateLinkTokenRequestSnaptrade
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **config** | [**CreateLinkTokenRequestSnaptradeConfig**](CreateLinkTokenRequestSnaptradeConfig.md) | | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'fuse_client'
13
+
14
+ instance = FuseClient::CreateLinkTokenRequestSnaptrade.new(
15
+ config: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,18 @@
1
+ # FuseClient::CreateLinkTokenRequestSnaptradeConfig
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **connection_type** | **String** | SnapTrade connection type. Defaults to &#39;read&#39; | [optional][default to &#39;read&#39;] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'fuse_client'
13
+
14
+ instance = FuseClient::CreateLinkTokenRequestSnaptradeConfig.new(
15
+ connection_type: null
16
+ )
17
+ ```
18
+
@@ -6,20 +6,9 @@
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **id** | **String** | A original ID for the transaction that to help you tie data back to your systems. | |
8
8
  | **merchant_id** | **String** | A Fuse defined, unique ID for the merchant associated with this transaction. | [optional] |
9
- | **name** | **String** | The original or enhanced name of the merchant. | [optional] |
9
+ | **merchant_name** | **String** | The name of the merchant. | [optional] |
10
10
  | **logo** | [**MerchantLogo**](MerchantLogo.md) | | [optional] |
11
- | **amount** | **Float** | The amount of the transaction in cents, in the currency of the account. | [optional] |
12
- | **category** | [**TransactionCategory**](TransactionCategory.md) | | [optional] |
13
- | **is_bill_pay** | **Boolean** | Whether the transaction is a bill pay. | [optional] |
14
- | **is_direct_deposit** | **Boolean** | Whether the transaction is a direct deposit. | [optional] |
15
- | **is_expense** | **Boolean** | Whether the transaction is a an expense | [optional] |
16
- | **is_fee** | **Boolean** | Whether the transaction is a fee. | [optional] |
17
- | **is_income** | **Boolean** | Whether the transaction is income. | [optional] |
18
- | **is_international** | **Boolean** | Whether the transaction is international. | [optional] |
19
- | **is_overdraft_fee** | **Boolean** | This indicates whether the transaction represents an overdraft fee. | [optional] |
20
- | **is_payroll_advance** | **Boolean** | Whether the transaction is a payroll advance. | [optional] |
21
- | **is_subscription** | **Boolean** | Whether the transaction is a subscription. | [optional] |
22
- | **type** | **String** | The type of transaction | [optional] |
11
+ | **categories** | **Array&lt;String&gt;** | Hierarchical transaction categories: Each element narrows down from parent to nested sub-categories. Example: [&#39;personnel&#39;, &#39;employee&#39;, &#39;payroll&#39;]. | [optional] |
23
12
 
24
13
  ## Example
25
14
 
@@ -29,20 +18,9 @@ require 'fuse_client'
29
18
  instance = FuseClient::EnrichedTransaction.new(
30
19
  id: null,
31
20
  merchant_id: null,
32
- name: null,
21
+ merchant_name: null,
33
22
  logo: null,
34
- amount: null,
35
- category: null,
36
- is_bill_pay: null,
37
- is_direct_deposit: null,
38
- is_expense: null,
39
- is_fee: null,
40
- is_income: null,
41
- is_international: null,
42
- is_overdraft_fee: null,
43
- is_payroll_advance: null,
44
- is_subscription: null,
45
- type: null
23
+ categories: null
46
24
  )
47
25
  ```
48
26
 
@@ -8,8 +8,11 @@
8
8
  | **event_type** | **String** | | |
9
9
  | **status** | [**ExternalTransactionEventStatus**](ExternalTransactionEventStatus.md) | | |
10
10
  | **amount** | **Float** | Amount in cents associated with the transaction. Use positive values to represent money going out and negative to represent money going in. | |
11
+ | **country_code** | **String** | | [optional][default to &#39;US&#39;] |
11
12
  | **iso_currency_code** | **String** | The ISO-4217 currency code. | |
12
13
  | **transaction_type** | [**TransactionEventType**](TransactionEventType.md) | | [optional] |
14
+ | **transaction_description** | **String** | | [optional] |
15
+ | **transaction_owner_type** | **String** | | [optional][default to &#39;consumer&#39;] |
13
16
  | **merchant_name** | **String** | | |
14
17
  | **timestamp** | **String** | Datetime of the transaction In ISO-8601 format | |
15
18
  | **balance** | **Float** | The running balance of the account after the transaction has occurred, in cents | [optional] |
@@ -24,8 +27,11 @@ instance = FuseClient::ExternalTransactionEvent.new(
24
27
  event_type: null,
25
28
  status: null,
26
29
  amount: null,
30
+ country_code: null,
27
31
  iso_currency_code: null,
28
32
  transaction_type: null,
33
+ transaction_description: null,
34
+ transaction_owner_type: null,
29
35
  merchant_name: null,
30
36
  timestamp: null,
31
37
  balance: null
@@ -5,6 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **remote_id** | **String** | Remote Id of the account, ie Plaid or Teller account id | |
8
+ | **currency** | **String** | The ISO-4217 currency code of the account. | |
8
9
  | **fingerprint** | **String** | Uniquely identifies this account across all accounts for a single financial connection. Used for reconnection deduplication. See more information here: https://letsfuse.readme.io/docs/duplicate-accounts | |
9
10
  | **institution** | [**FinancialConnectionsAccountInstitution**](FinancialConnectionsAccountInstitution.md) | | [optional] |
10
11
  | **mask** | **String** | The partial account number. | [optional] |
@@ -21,6 +22,7 @@ require 'fuse_client'
21
22
 
22
23
  instance = FuseClient::FinancialConnectionsAccount.new(
23
24
  remote_id: null,
25
+ currency: null,
24
26
  fingerprint: null,
25
27
  institution: null,
26
28
  mask: null,
@@ -5,6 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **remote_id** | **String** | Remote Id of the account, ie Plaid or Teller account id | |
8
+ | **currency** | **String** | The ISO-4217 currency code of the account. | |
8
9
  | **fingerprint** | **String** | Uniquely identifies this account across all accounts for a single financial connection. Used for reconnection deduplication. See more information here: https://letsfuse.readme.io/docs/duplicate-accounts | |
9
10
  | **institution** | [**FinancialConnectionsAccountInstitution**](FinancialConnectionsAccountInstitution.md) | | [optional] |
10
11
  | **mask** | **String** | The partial account number. | [optional] |
@@ -28,6 +29,7 @@ require 'fuse_client'
28
29
 
29
30
  instance = FuseClient::FinancialConnectionsAccountLiability.new(
30
31
  remote_id: null,
32
+ currency: null,
31
33
  fingerprint: null,
32
34
  institution: null,
33
35
  mask: null,
data/docs/FuseApi.md CHANGED
@@ -603,7 +603,7 @@ api_instance = FuseClient::FuseApi.new
603
603
  fuse_client_id = 'fuse_client_id_example' # String |
604
604
  fuse_api_key = 'fuse_api_key_example' # String |
605
605
  opts = {
606
- enrich_transactions_request: FuseClient::EnrichTransactionsRequest.new({transactions: [FuseClient::TransactionToEnrich.new({id: 'id_example', merchant_name: 'merchant_name_example'})]}) # EnrichTransactionsRequest |
606
+ enrich_transactions_request: FuseClient::EnrichTransactionsRequest.new({transactions: [FuseClient::TransactionToEnrich.new({id: 'id_example', description: 'description_example', amount: 3.56, direction: 'incoming'})]}) # EnrichTransactionsRequest |
607
607
  }
608
608
 
609
609
  begin
@@ -5,10 +5,14 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **id** | **String** | A unique ID for the transaction that to help you tie data back to your systems. | |
8
- | **merchant_name** | **String** | The name of the merchant. | |
8
+ | **description** | **String** | The name of the merchant if available or a description of the transaction. | |
9
9
  | **mcc** | **String** | The merchant category code. | [optional] |
10
- | **amount** | **Float** | The amount of the transaction in cents, in the currency of the account. | [optional] |
11
- | **type** | **String** | The type of the transaction | [optional] |
10
+ | **amount** | **Float** | The amount of the transaction in cents, in the currency of the account. Must be a positive value. Use the type field to indicate the direction. | |
11
+ | **direction** | **String** | The direction of the transaction. | |
12
+ | **country_code** | **String** | | [optional][default to &#39;US&#39;] |
13
+ | **iso_currency_code** | **String** | | [optional][default to &#39;USD&#39;] |
14
+ | **date** | **String** | The date the transaction was posted. | [optional] |
15
+ | **owner_type** | **String** | | [optional][default to &#39;consumer&#39;] |
12
16
 
13
17
  ## Example
14
18
 
@@ -17,10 +21,14 @@ require 'fuse_client'
17
21
 
18
22
  instance = FuseClient::TransactionToEnrich.new(
19
23
  id: null,
20
- merchant_name: null,
24
+ description: null,
21
25
  mcc: null,
22
26
  amount: null,
23
- type: null
27
+ direction: null,
28
+ country_code: null,
29
+ iso_currency_code: null,
30
+ date: null,
31
+ owner_type: null
24
32
  )
25
33
  ```
26
34
 
@@ -422,7 +422,11 @@ module FuseClient
422
422
  [
423
423
  {
424
424
  url: "https://sandbox-api.letsfuse.com",
425
- description: "sandbox",
425
+ description: "Fuse sandbox API server",
426
+ },
427
+ {
428
+ url: "https://api.letsfuse.com",
429
+ description: "Fuse production API server",
426
430
  }
427
431
  ]
428
432
  end
@@ -21,6 +21,9 @@ module FuseClient
21
21
  # The ISO-4217 currency code of the transaction
22
22
  attr_accessor :iso_currency_code
23
23
 
24
+ # The name of the end user associated with this consumer risk report.
25
+ attr_accessor :end_user_name
26
+
24
27
  # This is used to determine the timeframe and other metadata for the consumer risk report.
25
28
  attr_accessor :customization_id
26
29
 
@@ -29,6 +32,7 @@ module FuseClient
29
32
  {
30
33
  :'account_id' => :'account_id',
31
34
  :'iso_currency_code' => :'iso_currency_code',
35
+ :'end_user_name' => :'end_user_name',
32
36
  :'customization_id' => :'customization_id'
33
37
  }
34
38
  end
@@ -43,6 +47,7 @@ module FuseClient
43
47
  {
44
48
  :'account_id' => :'String',
45
49
  :'iso_currency_code' => :'String',
50
+ :'end_user_name' => :'String',
46
51
  :'customization_id' => :'String'
47
52
  }
48
53
  end
@@ -76,6 +81,10 @@ module FuseClient
76
81
  self.iso_currency_code = attributes[:'iso_currency_code']
77
82
  end
78
83
 
84
+ if attributes.key?(:'end_user_name')
85
+ self.end_user_name = attributes[:'end_user_name']
86
+ end
87
+
79
88
  if attributes.key?(:'customization_id')
80
89
  self.customization_id = attributes[:'customization_id']
81
90
  end
@@ -116,6 +125,7 @@ module FuseClient
116
125
  self.class == o.class &&
117
126
  account_id == o.account_id &&
118
127
  iso_currency_code == o.iso_currency_code &&
128
+ end_user_name == o.end_user_name &&
119
129
  customization_id == o.customization_id
120
130
  end
121
131
 
@@ -128,7 +138,7 @@ module FuseClient
128
138
  # Calculates hash code according to all attributes.
129
139
  # @return [Integer] Hash code
130
140
  def hash
131
- [account_id, iso_currency_code, customization_id].hash
141
+ [account_id, iso_currency_code, end_user_name, customization_id].hash
132
142
  end
133
143
 
134
144
  # Builds the object from hash
@@ -35,6 +35,8 @@ module FuseClient
35
35
 
36
36
  attr_accessor :teller
37
37
 
38
+ attr_accessor :snaptrade
39
+
38
40
  # Attribute mapping from ruby-style variable name to JSON key.
39
41
  def self.attribute_map
40
42
  {
@@ -45,7 +47,8 @@ module FuseClient
45
47
  :'webhook_url' => :'webhook_url',
46
48
  :'mx' => :'mx',
47
49
  :'plaid' => :'plaid',
48
- :'teller' => :'teller'
50
+ :'teller' => :'teller',
51
+ :'snaptrade' => :'snaptrade'
49
52
  }
50
53
  end
51
54
 
@@ -64,7 +67,8 @@ module FuseClient
64
67
  :'webhook_url' => :'String',
65
68
  :'mx' => :'CreateLinkTokenRequestMx',
66
69
  :'plaid' => :'CreateLinkTokenRequestPlaid',
67
- :'teller' => :'CreateLinkTokenRequestTeller'
70
+ :'teller' => :'CreateLinkTokenRequestTeller',
71
+ :'snaptrade' => :'CreateLinkTokenRequestSnaptrade'
68
72
  }
69
73
  end
70
74
 
@@ -120,6 +124,10 @@ module FuseClient
120
124
  if attributes.key?(:'teller')
121
125
  self.teller = attributes[:'teller']
122
126
  end
127
+
128
+ if attributes.key?(:'snaptrade')
129
+ self.snaptrade = attributes[:'snaptrade']
130
+ end
123
131
  end
124
132
 
125
133
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -167,7 +175,8 @@ module FuseClient
167
175
  webhook_url == o.webhook_url &&
168
176
  mx == o.mx &&
169
177
  plaid == o.plaid &&
170
- teller == o.teller
178
+ teller == o.teller &&
179
+ snaptrade == o.snaptrade
171
180
  end
172
181
 
173
182
  # @see the `==` method
@@ -179,7 +188,7 @@ module FuseClient
179
188
  # Calculates hash code according to all attributes.
180
189
  # @return [Integer] Hash code
181
190
  def hash
182
- [institution_id, entity, client_name, session_client_secret, webhook_url, mx, plaid, teller].hash
191
+ [institution_id, entity, client_name, session_client_secret, webhook_url, mx, plaid, teller, snaptrade].hash
183
192
  end
184
193
 
185
194
  # Builds the object from hash
@@ -0,0 +1,220 @@
1
+ =begin
2
+ #Fuse
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FuseClient
17
+ # An object specifying information about the SnapTrade configuration to use when creating a link token.
18
+ class CreateLinkTokenRequestSnaptrade
19
+ attr_accessor :config
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'config' => :'config'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'config' => :'CreateLinkTokenRequestSnaptradeConfig'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FuseClient::CreateLinkTokenRequestSnaptrade` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FuseClient::CreateLinkTokenRequestSnaptrade`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'config')
62
+ self.config = attributes[:'config']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ config == o.config
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] Object to be compared
89
+ def eql?(o)
90
+ self == o
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Integer] Hash code
95
+ def hash
96
+ [config].hash
97
+ end
98
+
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 self.build_from_hash(attributes)
103
+ new.build_from_hash(attributes)
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ attributes = attributes.transform_keys(&:to_sym)
112
+ self.class.openapi_types.each_pair do |key, type|
113
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
114
+ self.send("#{key}=", nil)
115
+ elsif type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that 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
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 :Time
136
+ Time.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
+ # models (e.g. Pet) or oneOf
167
+ klass = FuseClient.const_get(type)
168
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ if value.nil?
191
+ is_nullable = self.class.openapi_nullable.include?(attr)
192
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
193
+ end
194
+
195
+ hash[param] = _to_hash(value)
196
+ end
197
+ hash
198
+ end
199
+
200
+ # Outputs non-array value in the form of hash
201
+ # For object, use to_hash. Otherwise, just return the value
202
+ # @param [Object] value Any valid value
203
+ # @return [Hash] Returns the value in the form of hash
204
+ def _to_hash(value)
205
+ if value.is_a?(Array)
206
+ value.compact.map { |v| _to_hash(v) }
207
+ elsif value.is_a?(Hash)
208
+ {}.tap do |hash|
209
+ value.each { |k, v| hash[k] = _to_hash(v) }
210
+ end
211
+ elsif value.respond_to? :to_hash
212
+ value.to_hash
213
+ else
214
+ value
215
+ end
216
+ end
217
+
218
+ end
219
+
220
+ end