budgea_client 4.0.3 → 5.0.0

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 (125) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +50 -5
  4. data/budgea_openapi.json +1888 -383
  5. data/docs/Account.md +2 -0
  6. data/docs/AccountLog.md +1 -0
  7. data/docs/AdministrationApi.md +366 -55
  8. data/docs/AuthenticationApi.md +15 -13
  9. data/docs/BanksApi.md +988 -194
  10. data/docs/Client.md +1 -1
  11. data/docs/Connection.md +2 -0
  12. data/docs/ConnectionLog.md +1 -0
  13. data/docs/ConnectionSource.md +18 -0
  14. data/docs/ConnectionsApi.md +618 -25
  15. data/docs/Connector.md +1 -1
  16. data/docs/ConnectorSource.md +15 -0
  17. data/docs/DocumentsApi.md +72 -72
  18. data/docs/Field.md +1 -0
  19. data/docs/InlineResponse20011.md +1 -1
  20. data/docs/InlineResponse20012.md +1 -1
  21. data/docs/InlineResponse20013.md +1 -1
  22. data/docs/InlineResponse20014.md +1 -1
  23. data/docs/InlineResponse20015.md +1 -1
  24. data/docs/InlineResponse20016.md +1 -1
  25. data/docs/InlineResponse20017.md +1 -1
  26. data/docs/InlineResponse20018.md +1 -1
  27. data/docs/InlineResponse20019.md +2 -1
  28. data/docs/InlineResponse20030.md +1 -1
  29. data/docs/InlineResponse20031.md +1 -1
  30. data/docs/InlineResponse20032.md +1 -1
  31. data/docs/InlineResponse20033.md +1 -1
  32. data/docs/InlineResponse20034.md +1 -1
  33. data/docs/InlineResponse20035.md +1 -1
  34. data/docs/InlineResponse20036.md +1 -1
  35. data/docs/InlineResponse20037.md +1 -1
  36. data/docs/InlineResponse20038.md +1 -1
  37. data/docs/InlineResponse20039.md +1 -1
  38. data/docs/InlineResponse20040.md +1 -1
  39. data/docs/InlineResponse20041.md +9 -0
  40. data/docs/InlineResponse20042.md +9 -0
  41. data/docs/OIDCApi.md +3 -3
  42. data/docs/Order.md +14 -0
  43. data/docs/PFMApi.md +87 -39
  44. data/docs/ProvidersApi.md +979 -122
  45. data/docs/RecipientsApi.md +4 -4
  46. data/docs/Subscription.md +1 -0
  47. data/docs/SubscriptionLog.md +15 -0
  48. data/docs/TermsApi.md +3 -3
  49. data/docs/Transaction.md +1 -0
  50. data/docs/Transfer.md +5 -1
  51. data/docs/TransferApi.md +77 -0
  52. data/docs/TransfersApi.md +39 -39
  53. data/docs/UsersManagementApi.md +13 -13
  54. data/docs/WealthApi.md +24 -24
  55. data/lib/budgea_client.rb +7 -2
  56. data/lib/budgea_client/api/administration_api.rb +381 -71
  57. data/lib/budgea_client/api/authentication_api.rb +16 -13
  58. data/lib/budgea_client/api/banks_api.rb +1034 -211
  59. data/lib/budgea_client/api/connections_api.rb +648 -30
  60. data/lib/budgea_client/api/documents_api.rb +85 -85
  61. data/lib/budgea_client/api/oidc_api.rb +3 -3
  62. data/lib/budgea_client/api/pfm_api.rb +87 -40
  63. data/lib/budgea_client/api/providers_api.rb +1045 -151
  64. data/lib/budgea_client/api/recipients_api.rb +4 -4
  65. data/lib/budgea_client/api/terms_api.rb +3 -3
  66. data/lib/budgea_client/api/transfer_api.rb +94 -0
  67. data/lib/budgea_client/api/transfers_api.rb +39 -39
  68. data/lib/budgea_client/api/users_management_api.rb +14 -14
  69. data/lib/budgea_client/api/wealth_api.rb +25 -25
  70. data/lib/budgea_client/models/account.rb +24 -4
  71. data/lib/budgea_client/models/account_log.rb +16 -1
  72. data/lib/budgea_client/models/client.rb +11 -11
  73. data/lib/budgea_client/models/connection.rb +23 -4
  74. data/lib/budgea_client/models/connection_log.rb +11 -1
  75. data/lib/budgea_client/models/connection_source.rb +309 -0
  76. data/lib/budgea_client/models/connector.rb +18 -15
  77. data/lib/budgea_client/models/connector_source.rb +273 -0
  78. data/lib/budgea_client/models/field.rb +14 -4
  79. data/lib/budgea_client/models/inline_response_200_11.rb +18 -18
  80. data/lib/budgea_client/models/inline_response_200_12.rb +11 -11
  81. data/lib/budgea_client/models/inline_response_200_13.rb +11 -11
  82. data/lib/budgea_client/models/inline_response_200_14.rb +18 -18
  83. data/lib/budgea_client/models/inline_response_200_15.rb +11 -11
  84. data/lib/budgea_client/models/inline_response_200_16.rb +11 -11
  85. data/lib/budgea_client/models/inline_response_200_17.rb +11 -11
  86. data/lib/budgea_client/models/inline_response_200_18.rb +18 -18
  87. data/lib/budgea_client/models/inline_response_200_19.rb +21 -11
  88. data/lib/budgea_client/models/inline_response_200_30.rb +18 -18
  89. data/lib/budgea_client/models/inline_response_200_31.rb +11 -11
  90. data/lib/budgea_client/models/inline_response_200_32.rb +18 -18
  91. data/lib/budgea_client/models/inline_response_200_33.rb +18 -18
  92. data/lib/budgea_client/models/inline_response_200_34.rb +11 -11
  93. data/lib/budgea_client/models/inline_response_200_35.rb +18 -18
  94. data/lib/budgea_client/models/inline_response_200_36.rb +18 -18
  95. data/lib/budgea_client/models/inline_response_200_37.rb +11 -11
  96. data/lib/budgea_client/models/inline_response_200_38.rb +18 -18
  97. data/lib/budgea_client/models/inline_response_200_39.rb +11 -11
  98. data/lib/budgea_client/models/inline_response_200_40.rb +18 -18
  99. data/lib/budgea_client/models/inline_response_200_41.rb +200 -0
  100. data/lib/budgea_client/models/inline_response_200_42.rb +200 -0
  101. data/lib/budgea_client/models/order.rb +259 -0
  102. data/lib/budgea_client/models/subscription.rb +11 -1
  103. data/lib/budgea_client/models/subscription_log.rb +269 -0
  104. data/lib/budgea_client/models/transaction.rb +11 -1
  105. data/lib/budgea_client/models/transfer.rb +49 -2
  106. data/lib/budgea_client/models/user.rb +2 -2
  107. data/lib/budgea_client/version.rb +1 -1
  108. data/original_budgea_openapi.json +1980 -351
  109. data/pkg/budgea_client-2.0.0.gem +0 -0
  110. data/pkg/budgea_client-3.0.1.gem +0 -0
  111. data/pkg/budgea_client-4.0.0.gem +0 -0
  112. data/spec/api/transfer_api_spec.rb +54 -0
  113. data/spec/models/connection_source_spec.rb +101 -0
  114. data/spec/models/connector_source_spec.rb +83 -0
  115. data/spec/models/inline_response_200_41_spec.rb +47 -0
  116. data/spec/models/inline_response_200_42_spec.rb +47 -0
  117. data/spec/models/order_spec.rb +77 -0
  118. data/spec/models/subscription_log_spec.rb +83 -0
  119. metadata +34 -9
  120. data/config.yaml +0 -15
  121. data/pkg/budgea_client-2.0.1.gem +0 -0
  122. data/pkg/budgea_client-2.0.2.gem +0 -0
  123. data/pkg/budgea_client-3.0.0.gem +0 -0
  124. data/pkg/budgea_client-4.0.1.gem +0 -0
  125. data/pkg/budgea_client-4.0.2.gem +0 -0
@@ -24,7 +24,7 @@ module BudgeaClient
24
24
 
25
25
  attr_accessor :private_key
26
26
 
27
- attr_accessor :redirect_uri
27
+ attr_accessor :redirect_uris
28
28
 
29
29
  # Should the client display the company manager page.
30
30
  attr_accessor :pro
@@ -42,7 +42,7 @@ module BudgeaClient
42
42
  :'secret' => :'secret',
43
43
  :'public_key' => :'public_key',
44
44
  :'private_key' => :'private_key',
45
- :'redirect_uri' => :'redirect_uri',
45
+ :'redirect_uris' => :'redirect_uris',
46
46
  :'pro' => :'pro',
47
47
  :'id_logo' => :'id_logo',
48
48
  :'config' => :'config'
@@ -57,7 +57,7 @@ module BudgeaClient
57
57
  :'secret' => :'String',
58
58
  :'public_key' => :'String',
59
59
  :'private_key' => :'String',
60
- :'redirect_uri' => :'String',
60
+ :'redirect_uris' => :'String',
61
61
  :'pro' => :'BOOLEAN',
62
62
  :'id_logo' => :'Integer',
63
63
  :'config' => :'String'
@@ -94,10 +94,10 @@ module BudgeaClient
94
94
  self.private_key = attributes[:'private_key']
95
95
  end
96
96
 
97
- if attributes.has_key?(:'redirect_uri')
98
- self.redirect_uri = attributes[:'redirect_uri']
97
+ if attributes.has_key?(:'redirect_uris')
98
+ self.redirect_uris = attributes[:'redirect_uris']
99
99
  else
100
- self.redirect_uri = ''
100
+ self.redirect_uris = ''
101
101
  end
102
102
 
103
103
  if attributes.has_key?(:'pro')
@@ -131,8 +131,8 @@ module BudgeaClient
131
131
  invalid_properties.push('invalid value for "secret", secret cannot be nil.')
132
132
  end
133
133
 
134
- if @redirect_uri.nil?
135
- invalid_properties.push('invalid value for "redirect_uri", redirect_uri cannot be nil.')
134
+ if @redirect_uris.nil?
135
+ invalid_properties.push('invalid value for "redirect_uris", redirect_uris cannot be nil.')
136
136
  end
137
137
 
138
138
  if @pro.nil?
@@ -148,7 +148,7 @@ module BudgeaClient
148
148
  return false if @id.nil?
149
149
  return false if @name.nil?
150
150
  return false if @secret.nil?
151
- return false if @redirect_uri.nil?
151
+ return false if @redirect_uris.nil?
152
152
  return false if @pro.nil?
153
153
  true
154
154
  end
@@ -163,7 +163,7 @@ module BudgeaClient
163
163
  secret == o.secret &&
164
164
  public_key == o.public_key &&
165
165
  private_key == o.private_key &&
166
- redirect_uri == o.redirect_uri &&
166
+ redirect_uris == o.redirect_uris &&
167
167
  pro == o.pro &&
168
168
  id_logo == o.id_logo &&
169
169
  config == o.config
@@ -178,7 +178,7 @@ module BudgeaClient
178
178
  # Calculates hash code according to all attributes.
179
179
  # @return [Fixnum] Hash code
180
180
  def hash
181
- [id, name, secret, public_key, private_key, redirect_uri, pro, id_logo, config].hash
181
+ [id, name, secret, public_key, private_key, redirect_uris, pro, id_logo, config].hash
182
182
  end
183
183
 
184
184
  # Builds the object from hash
@@ -26,6 +26,9 @@ module BudgeaClient
26
26
  # Last successful update
27
27
  attr_accessor :last_update
28
28
 
29
+ # Creation date
30
+ attr_accessor :created
31
+
29
32
  # If the last update has failed, the error code
30
33
  attr_accessor :error
31
34
 
@@ -48,6 +51,8 @@ module BudgeaClient
48
51
 
49
52
  attr_accessor :subscriptions
50
53
 
54
+ attr_accessor :connection
55
+
51
56
  # Attribute mapping from ruby-style variable name to JSON key.
52
57
  def self.attribute_map
53
58
  {
@@ -55,6 +60,7 @@ module BudgeaClient
55
60
  :'id_user' => :'id_user',
56
61
  :'id_connector' => :'id_connector',
57
62
  :'last_update' => :'last_update',
63
+ :'created' => :'created',
58
64
  :'error' => :'error',
59
65
  :'error_message' => :'error_message',
60
66
  :'expire' => :'expire',
@@ -62,7 +68,8 @@ module BudgeaClient
62
68
  :'last_push' => :'last_push',
63
69
  :'next_try' => :'next_try',
64
70
  :'accounts' => :'accounts',
65
- :'subscriptions' => :'subscriptions'
71
+ :'subscriptions' => :'subscriptions',
72
+ :'connection' => :'connection'
66
73
  }
67
74
  end
68
75
 
@@ -73,6 +80,7 @@ module BudgeaClient
73
80
  :'id_user' => :'Integer',
74
81
  :'id_connector' => :'Integer',
75
82
  :'last_update' => :'DateTime',
83
+ :'created' => :'DateTime',
76
84
  :'error' => :'String',
77
85
  :'error_message' => :'String',
78
86
  :'expire' => :'DateTime',
@@ -80,7 +88,8 @@ module BudgeaClient
80
88
  :'last_push' => :'DateTime',
81
89
  :'next_try' => :'DateTime',
82
90
  :'accounts' => :'Array<Account>',
83
- :'subscriptions' => :'Array<Subscription>'
91
+ :'subscriptions' => :'Array<Subscription>',
92
+ :'connection' => :'Connection'
84
93
  }
85
94
  end
86
95
 
@@ -108,6 +117,10 @@ module BudgeaClient
108
117
  self.last_update = attributes[:'last_update']
109
118
  end
110
119
 
120
+ if attributes.has_key?(:'created')
121
+ self.created = attributes[:'created']
122
+ end
123
+
111
124
  if attributes.has_key?(:'error')
112
125
  self.error = attributes[:'error']
113
126
  end
@@ -145,6 +158,10 @@ module BudgeaClient
145
158
  self.subscriptions = value
146
159
  end
147
160
  end
161
+
162
+ if attributes.has_key?(:'connection')
163
+ self.connection = attributes[:'connection']
164
+ end
148
165
  end
149
166
 
150
167
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -184,6 +201,7 @@ module BudgeaClient
184
201
  id_user == o.id_user &&
185
202
  id_connector == o.id_connector &&
186
203
  last_update == o.last_update &&
204
+ created == o.created &&
187
205
  error == o.error &&
188
206
  error_message == o.error_message &&
189
207
  expire == o.expire &&
@@ -191,7 +209,8 @@ module BudgeaClient
191
209
  last_push == o.last_push &&
192
210
  next_try == o.next_try &&
193
211
  accounts == o.accounts &&
194
- subscriptions == o.subscriptions
212
+ subscriptions == o.subscriptions &&
213
+ connection == o.connection
195
214
  end
196
215
 
197
216
  # @see the `==` method
@@ -203,7 +222,7 @@ module BudgeaClient
203
222
  # Calculates hash code according to all attributes.
204
223
  # @return [Fixnum] Hash code
205
224
  def hash
206
- [id, id_user, id_connector, last_update, error, error_message, expire, active, last_push, next_try, accounts, subscriptions].hash
225
+ [id, id_user, id_connector, last_update, created, error, error_message, expire, active, last_push, next_try, accounts, subscriptions, connection].hash
207
226
  end
208
227
 
209
228
  # Builds the object from hash
@@ -26,6 +26,9 @@ module BudgeaClient
26
26
  # ID of the connector
27
27
  attr_accessor :id_connector
28
28
 
29
+ # ID of the related connection source
30
+ attr_accessor :id_source
31
+
29
32
  # bcrypt hash of the login
30
33
  attr_accessor :login
31
34
 
@@ -69,6 +72,7 @@ module BudgeaClient
69
72
  :'id_user' => :'id_user',
70
73
  :'id_connection' => :'id_connection',
71
74
  :'id_connector' => :'id_connector',
75
+ :'id_source' => :'id_source',
72
76
  :'login' => :'login',
73
77
  :'error_uid' => :'error_uid',
74
78
  :'timestamp' => :'timestamp',
@@ -91,6 +95,7 @@ module BudgeaClient
91
95
  :'id_user' => :'Integer',
92
96
  :'id_connection' => :'Integer',
93
97
  :'id_connector' => :'Integer',
98
+ :'id_source' => :'Integer',
94
99
  :'login' => :'String',
95
100
  :'error_uid' => :'String',
96
101
  :'timestamp' => :'DateTime',
@@ -130,6 +135,10 @@ module BudgeaClient
130
135
  self.id_connector = attributes[:'id_connector']
131
136
  end
132
137
 
138
+ if attributes.has_key?(:'id_source')
139
+ self.id_source = attributes[:'id_source']
140
+ end
141
+
133
142
  if attributes.has_key?(:'login')
134
143
  self.login = attributes[:'login']
135
144
  end
@@ -216,6 +225,7 @@ module BudgeaClient
216
225
  id_user == o.id_user &&
217
226
  id_connection == o.id_connection &&
218
227
  id_connector == o.id_connector &&
228
+ id_source == o.id_source &&
219
229
  login == o.login &&
220
230
  error_uid == o.error_uid &&
221
231
  timestamp == o.timestamp &&
@@ -239,7 +249,7 @@ module BudgeaClient
239
249
  # Calculates hash code according to all attributes.
240
250
  # @return [Fixnum] Hash code
241
251
  def hash
242
- [id, id_user, id_connection, id_connector, login, error_uid, timestamp, next_try, error, error_message, statut, nb_accounts, start, worker, session_folder_id, fields].hash
252
+ [id, id_user, id_connection, id_connector, id_source, login, error_uid, timestamp, next_try, error, error_message, statut, nb_accounts, start, worker, session_folder_id, fields].hash
243
253
  end
244
254
 
245
255
  # Builds the object from hash
@@ -0,0 +1,309 @@
1
+ =begin
2
+ #Budgea API Documentation
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 2.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module BudgeaClient
16
+ class ConnectionSource
17
+ # ID of connection
18
+ attr_accessor :id
19
+
20
+ # ID of the related connection
21
+ attr_accessor :id_connection
22
+
23
+ # ID of the related connector source
24
+ attr_accessor :id_connector_source
25
+
26
+ # Name of the connection source
27
+ attr_accessor :name
28
+
29
+ # Last successful update
30
+ attr_accessor :last_update
31
+
32
+ # This source is not used to synchronize the connection
33
+ attr_accessor :disabled
34
+
35
+ # Creation date of the connection source
36
+ attr_accessor :created
37
+
38
+ # If the last update has failed, the state code
39
+ attr_accessor :state
40
+
41
+ # Expiration date of the access
42
+ attr_accessor :access_expire
43
+
44
+ # Expiration of the connection source. Used to purge the connection in case completion was not finished
45
+ attr_accessor :expire
46
+
47
+ # Date of next synchronization
48
+ attr_accessor :next_try
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'id' => :'id',
54
+ :'id_connection' => :'id_connection',
55
+ :'id_connector_source' => :'id_connector_source',
56
+ :'name' => :'name',
57
+ :'last_update' => :'last_update',
58
+ :'disabled' => :'disabled',
59
+ :'created' => :'created',
60
+ :'state' => :'state',
61
+ :'access_expire' => :'access_expire',
62
+ :'expire' => :'expire',
63
+ :'next_try' => :'next_try'
64
+ }
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.swagger_types
69
+ {
70
+ :'id' => :'Integer',
71
+ :'id_connection' => :'Integer',
72
+ :'id_connector_source' => :'Integer',
73
+ :'name' => :'String',
74
+ :'last_update' => :'DateTime',
75
+ :'disabled' => :'DateTime',
76
+ :'created' => :'DateTime',
77
+ :'state' => :'String',
78
+ :'access_expire' => :'DateTime',
79
+ :'expire' => :'DateTime',
80
+ :'next_try' => :'DateTime'
81
+ }
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ return unless attributes.is_a?(Hash)
88
+
89
+ # convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
91
+
92
+ if attributes.has_key?(:'id')
93
+ self.id = attributes[:'id']
94
+ end
95
+
96
+ if attributes.has_key?(:'id_connection')
97
+ self.id_connection = attributes[:'id_connection']
98
+ end
99
+
100
+ if attributes.has_key?(:'id_connector_source')
101
+ self.id_connector_source = attributes[:'id_connector_source']
102
+ end
103
+
104
+ if attributes.has_key?(:'name')
105
+ self.name = attributes[:'name']
106
+ end
107
+
108
+ if attributes.has_key?(:'last_update')
109
+ self.last_update = attributes[:'last_update']
110
+ end
111
+
112
+ if attributes.has_key?(:'disabled')
113
+ self.disabled = attributes[:'disabled']
114
+ end
115
+
116
+ if attributes.has_key?(:'created')
117
+ self.created = attributes[:'created']
118
+ end
119
+
120
+ if attributes.has_key?(:'state')
121
+ self.state = attributes[:'state']
122
+ end
123
+
124
+ if attributes.has_key?(:'access_expire')
125
+ self.access_expire = attributes[:'access_expire']
126
+ end
127
+
128
+ if attributes.has_key?(:'expire')
129
+ self.expire = attributes[:'expire']
130
+ end
131
+
132
+ if attributes.has_key?(:'next_try')
133
+ self.next_try = attributes[:'next_try']
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ invalid_properties = Array.new
141
+ if @id.nil?
142
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
143
+ end
144
+
145
+ if @id_connection.nil?
146
+ invalid_properties.push('invalid value for "id_connection", id_connection cannot be nil.')
147
+ end
148
+
149
+ if @id_connector_source.nil?
150
+ invalid_properties.push('invalid value for "id_connector_source", id_connector_source cannot be nil.')
151
+ end
152
+
153
+ if @name.nil?
154
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
155
+ end
156
+
157
+ if @created.nil?
158
+ invalid_properties.push('invalid value for "created", created cannot be nil.')
159
+ end
160
+
161
+ invalid_properties
162
+ end
163
+
164
+ # Check to see if the all the properties in the model are valid
165
+ # @return true if the model is valid
166
+ def valid?
167
+ return false if @id.nil?
168
+ return false if @id_connection.nil?
169
+ return false if @id_connector_source.nil?
170
+ return false if @name.nil?
171
+ return false if @created.nil?
172
+ true
173
+ end
174
+
175
+ # Checks equality by comparing each attribute.
176
+ # @param [Object] Object to be compared
177
+ def ==(o)
178
+ return true if self.equal?(o)
179
+ self.class == o.class &&
180
+ id == o.id &&
181
+ id_connection == o.id_connection &&
182
+ id_connector_source == o.id_connector_source &&
183
+ name == o.name &&
184
+ last_update == o.last_update &&
185
+ disabled == o.disabled &&
186
+ created == o.created &&
187
+ state == o.state &&
188
+ access_expire == o.access_expire &&
189
+ expire == o.expire &&
190
+ next_try == o.next_try
191
+ end
192
+
193
+ # @see the `==` method
194
+ # @param [Object] Object to be compared
195
+ def eql?(o)
196
+ self == o
197
+ end
198
+
199
+ # Calculates hash code according to all attributes.
200
+ # @return [Fixnum] Hash code
201
+ def hash
202
+ [id, id_connection, id_connector_source, name, last_update, disabled, created, state, access_expire, expire, next_try].hash
203
+ end
204
+
205
+ # Builds the object from hash
206
+ # @param [Hash] attributes Model attributes in the form of hash
207
+ # @return [Object] Returns the model itself
208
+ def build_from_hash(attributes)
209
+ return nil unless attributes.is_a?(Hash)
210
+ self.class.swagger_types.each_pair do |key, type|
211
+ if type =~ /\AArray<(.*)>/i
212
+ # check to ensure the input is an array given that the the attribute
213
+ # is documented as an array but the input is not
214
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
215
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
216
+ end
217
+ elsif !attributes[self.class.attribute_map[key]].nil?
218
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
219
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
220
+ end
221
+
222
+ self
223
+ end
224
+
225
+ # Deserializes the data based on type
226
+ # @param string type Data type
227
+ # @param string value Value to be deserialized
228
+ # @return [Object] Deserialized data
229
+ def _deserialize(type, value)
230
+ case type.to_sym
231
+ when :DateTime
232
+ DateTime.parse(value)
233
+ when :Date
234
+ Date.parse(value)
235
+ when :String
236
+ value.to_s
237
+ when :Integer
238
+ value.to_i
239
+ when :Float
240
+ value.to_f
241
+ when :BOOLEAN
242
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
243
+ true
244
+ else
245
+ false
246
+ end
247
+ when :Object
248
+ # generic object (usually a Hash), return directly
249
+ value
250
+ when /\AArray<(?<inner_type>.+)>\z/
251
+ inner_type = Regexp.last_match[:inner_type]
252
+ value.map { |v| _deserialize(inner_type, v) }
253
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
254
+ k_type = Regexp.last_match[:k_type]
255
+ v_type = Regexp.last_match[:v_type]
256
+ {}.tap do |hash|
257
+ value.each do |k, v|
258
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
259
+ end
260
+ end
261
+ else # model
262
+ temp_model = BudgeaClient.const_get(type).new
263
+ temp_model.build_from_hash(value)
264
+ end
265
+ end
266
+
267
+ # Returns the string representation of the object
268
+ # @return [String] String presentation of the object
269
+ def to_s
270
+ to_hash.to_s
271
+ end
272
+
273
+ # to_body is an alias to to_hash (backward compatibility)
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_body
276
+ to_hash
277
+ end
278
+
279
+ # Returns the object in the form of hash
280
+ # @return [Hash] Returns the object in the form of hash
281
+ def to_hash
282
+ hash = {}
283
+ self.class.attribute_map.each_pair do |attr, param|
284
+ value = self.send(attr)
285
+ next if value.nil?
286
+ hash[param] = _to_hash(value)
287
+ end
288
+ hash
289
+ end
290
+
291
+ # Outputs non-array value in the form of hash
292
+ # For object, use to_hash. Otherwise, just return the value
293
+ # @param [Object] value Any valid value
294
+ # @return [Hash] Returns the value in the form of hash
295
+ def _to_hash(value)
296
+ if value.is_a?(Array)
297
+ value.compact.map { |v| _to_hash(v) }
298
+ elsif value.is_a?(Hash)
299
+ {}.tap do |hash|
300
+ value.each { |k, v| hash[k] = _to_hash(v) }
301
+ end
302
+ elsif value.respond_to? :to_hash
303
+ value.to_hash
304
+ else
305
+ value
306
+ end
307
+ end
308
+ end
309
+ end