budgea_client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (284) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +12 -0
  3. data/Gemfile.lock +89 -0
  4. data/README.md +619 -0
  5. data/Rakefile +13 -0
  6. data/budgea_client.gemspec +35 -0
  7. data/docs/Access.md +12 -0
  8. data/docs/Account.md +25 -0
  9. data/docs/AccountLog.md +15 -0
  10. data/docs/AccountType.md +15 -0
  11. data/docs/AdministrationApi.md +944 -0
  12. data/docs/Alert.md +15 -0
  13. data/docs/AuthenticationApi.md +398 -0
  14. data/docs/Bank.md +18 -0
  15. data/docs/BankCategory.md +9 -0
  16. data/docs/BanksApi.md +6558 -0
  17. data/docs/Category.md +17 -0
  18. data/docs/Client.md +18 -0
  19. data/docs/Connection.md +16 -0
  20. data/docs/ConnectionContact.md +17 -0
  21. data/docs/ConnectionLog.md +21 -0
  22. data/docs/ConnectionsApi.md +934 -0
  23. data/docs/ConnectorLogo.md +11 -0
  24. data/docs/Currency.md +10 -0
  25. data/docs/Device.md +14 -0
  26. data/docs/Document.md +29 -0
  27. data/docs/DocumentType.md +10 -0
  28. data/docs/DocumentsApi.md +5228 -0
  29. data/docs/Field.md +15 -0
  30. data/docs/File.md +11 -0
  31. data/docs/Group.md +15 -0
  32. data/docs/HashTable.md +11 -0
  33. data/docs/InlineResponse200.md +8 -0
  34. data/docs/InlineResponse2001.md +9 -0
  35. data/docs/InlineResponse20010.md +8 -0
  36. data/docs/InlineResponse20011.md +8 -0
  37. data/docs/InlineResponse20012.md +8 -0
  38. data/docs/InlineResponse20013.md +8 -0
  39. data/docs/InlineResponse20014.md +8 -0
  40. data/docs/InlineResponse20015.md +8 -0
  41. data/docs/InlineResponse20016.md +8 -0
  42. data/docs/InlineResponse20017.md +8 -0
  43. data/docs/InlineResponse20018.md +8 -0
  44. data/docs/InlineResponse20019.md +8 -0
  45. data/docs/InlineResponse2002.md +10 -0
  46. data/docs/InlineResponse20020.md +8 -0
  47. data/docs/InlineResponse20021.md +8 -0
  48. data/docs/InlineResponse20022.md +8 -0
  49. data/docs/InlineResponse20023.md +8 -0
  50. data/docs/InlineResponse20024.md +8 -0
  51. data/docs/InlineResponse20025.md +8 -0
  52. data/docs/InlineResponse20026.md +8 -0
  53. data/docs/InlineResponse20027.md +8 -0
  54. data/docs/InlineResponse20028.md +8 -0
  55. data/docs/InlineResponse20029.md +8 -0
  56. data/docs/InlineResponse2003.md +10 -0
  57. data/docs/InlineResponse20030.md +8 -0
  58. data/docs/InlineResponse20031.md +8 -0
  59. data/docs/InlineResponse20032.md +8 -0
  60. data/docs/InlineResponse20033.md +8 -0
  61. data/docs/InlineResponse2004.md +12 -0
  62. data/docs/InlineResponse2005.md +9 -0
  63. data/docs/InlineResponse2006.md +10 -0
  64. data/docs/InlineResponse2007.md +8 -0
  65. data/docs/InlineResponse2008.md +8 -0
  66. data/docs/InlineResponse2009.md +8 -0
  67. data/docs/Investment.md +32 -0
  68. data/docs/InvestmentValue.md +13 -0
  69. data/docs/Invite.md +13 -0
  70. data/docs/LockedUser.md +10 -0
  71. data/docs/OCRApi.md +117 -0
  72. data/docs/OIDCApi.md +167 -0
  73. data/docs/OidcWhitelist.md +9 -0
  74. data/docs/PFMApi.md +2204 -0
  75. data/docs/Pocket.md +17 -0
  76. data/docs/Profile.md +15 -0
  77. data/docs/Project.md +16 -0
  78. data/docs/ProjectType.md +10 -0
  79. data/docs/ProvidersApi.md +7014 -0
  80. data/docs/Recipient.md +22 -0
  81. data/docs/RecipientsApi.md +244 -0
  82. data/docs/Security.md +12 -0
  83. data/docs/Subscription.md +18 -0
  84. data/docs/TermsApi.md +218 -0
  85. data/docs/TermsOfService.md +12 -0
  86. data/docs/Transaction.md +33 -0
  87. data/docs/TransactionInformation.md +11 -0
  88. data/docs/TransactionsCluster.md +16 -0
  89. data/docs/Transfer.md +23 -0
  90. data/docs/TransfersApi.md +2404 -0
  91. data/docs/User.md +10 -0
  92. data/docs/UserAlert.md +21 -0
  93. data/docs/UsersManagementApi.md +608 -0
  94. data/docs/WealthApi.md +828 -0
  95. data/docs/Webhook.md +15 -0
  96. data/git_push.sh +55 -0
  97. data/lib/budgea_client.rb +118 -0
  98. data/lib/budgea_client/api/administration_api.rb +1059 -0
  99. data/lib/budgea_client/api/authentication_api.rb +467 -0
  100. data/lib/budgea_client/api/banks_api.rb +7837 -0
  101. data/lib/budgea_client/api/connections_api.rb +1088 -0
  102. data/lib/budgea_client/api/documents_api.rb +6637 -0
  103. data/lib/budgea_client/api/ocr_api.rb +141 -0
  104. data/lib/budgea_client/api/oidc_api.rb +195 -0
  105. data/lib/budgea_client/api/pfm_api.rb +2630 -0
  106. data/lib/budgea_client/api/providers_api.rb +8694 -0
  107. data/lib/budgea_client/api/recipients_api.rb +293 -0
  108. data/lib/budgea_client/api/terms_api.rb +245 -0
  109. data/lib/budgea_client/api/transfers_api.rb +2941 -0
  110. data/lib/budgea_client/api/users_management_api.rb +695 -0
  111. data/lib/budgea_client/api/wealth_api.rb +994 -0
  112. data/lib/budgea_client/api_client.rb +378 -0
  113. data/lib/budgea_client/api_error.rb +28 -0
  114. data/lib/budgea_client/configuration.rb +192 -0
  115. data/lib/budgea_client/models/access.rb +224 -0
  116. data/lib/budgea_client/models/account.rb +383 -0
  117. data/lib/budgea_client/models/account_log.rb +266 -0
  118. data/lib/budgea_client/models/account_type.rb +281 -0
  119. data/lib/budgea_client/models/alert.rb +273 -0
  120. data/lib/budgea_client/models/bank.rb +308 -0
  121. data/lib/budgea_client/models/bank_category.rb +201 -0
  122. data/lib/budgea_client/models/category.rb +299 -0
  123. data/lib/budgea_client/models/client.rb +305 -0
  124. data/lib/budgea_client/models/connection.rb +276 -0
  125. data/lib/budgea_client/models/connection_contact.rb +274 -0
  126. data/lib/budgea_client/models/connection_log.rb +324 -0
  127. data/lib/budgea_client/models/connector_logo.rb +223 -0
  128. data/lib/budgea_client/models/currency.rb +216 -0
  129. data/lib/budgea_client/models/device.rb +269 -0
  130. data/lib/budgea_client/models/document.rb +398 -0
  131. data/lib/budgea_client/models/document_type.rb +213 -0
  132. data/lib/budgea_client/models/field.rb +273 -0
  133. data/lib/budgea_client/models/file.rb +225 -0
  134. data/lib/budgea_client/models/group.rb +246 -0
  135. data/lib/budgea_client/models/hash_table.rb +227 -0
  136. data/lib/budgea_client/models/inline_response_200.rb +185 -0
  137. data/lib/budgea_client/models/inline_response_200_1.rb +199 -0
  138. data/lib/budgea_client/models/inline_response_200_10.rb +185 -0
  139. data/lib/budgea_client/models/inline_response_200_11.rb +185 -0
  140. data/lib/budgea_client/models/inline_response_200_12.rb +185 -0
  141. data/lib/budgea_client/models/inline_response_200_13.rb +185 -0
  142. data/lib/budgea_client/models/inline_response_200_14.rb +185 -0
  143. data/lib/budgea_client/models/inline_response_200_15.rb +185 -0
  144. data/lib/budgea_client/models/inline_response_200_16.rb +185 -0
  145. data/lib/budgea_client/models/inline_response_200_17.rb +185 -0
  146. data/lib/budgea_client/models/inline_response_200_18.rb +185 -0
  147. data/lib/budgea_client/models/inline_response_200_19.rb +185 -0
  148. data/lib/budgea_client/models/inline_response_200_2.rb +209 -0
  149. data/lib/budgea_client/models/inline_response_200_20.rb +185 -0
  150. data/lib/budgea_client/models/inline_response_200_21.rb +185 -0
  151. data/lib/budgea_client/models/inline_response_200_22.rb +185 -0
  152. data/lib/budgea_client/models/inline_response_200_23.rb +185 -0
  153. data/lib/budgea_client/models/inline_response_200_24.rb +185 -0
  154. data/lib/budgea_client/models/inline_response_200_25.rb +185 -0
  155. data/lib/budgea_client/models/inline_response_200_26.rb +185 -0
  156. data/lib/budgea_client/models/inline_response_200_27.rb +185 -0
  157. data/lib/budgea_client/models/inline_response_200_28.rb +185 -0
  158. data/lib/budgea_client/models/inline_response_200_29.rb +185 -0
  159. data/lib/budgea_client/models/inline_response_200_3.rb +214 -0
  160. data/lib/budgea_client/models/inline_response_200_30.rb +185 -0
  161. data/lib/budgea_client/models/inline_response_200_31.rb +185 -0
  162. data/lib/budgea_client/models/inline_response_200_32.rb +185 -0
  163. data/lib/budgea_client/models/inline_response_200_33.rb +185 -0
  164. data/lib/budgea_client/models/inline_response_200_4.rb +239 -0
  165. data/lib/budgea_client/models/inline_response_200_5.rb +199 -0
  166. data/lib/budgea_client/models/inline_response_200_6.rb +214 -0
  167. data/lib/budgea_client/models/inline_response_200_7.rb +185 -0
  168. data/lib/budgea_client/models/inline_response_200_8.rb +185 -0
  169. data/lib/budgea_client/models/inline_response_200_9.rb +185 -0
  170. data/lib/budgea_client/models/investment.rb +449 -0
  171. data/lib/budgea_client/models/investment_value.rb +249 -0
  172. data/lib/budgea_client/models/invite.rb +233 -0
  173. data/lib/budgea_client/models/locked_user.rb +206 -0
  174. data/lib/budgea_client/models/oidc_whitelist.rb +198 -0
  175. data/lib/budgea_client/models/pocket.rb +298 -0
  176. data/lib/budgea_client/models/profile.rb +308 -0
  177. data/lib/budgea_client/models/project.rb +301 -0
  178. data/lib/budgea_client/models/project_type.rb +206 -0
  179. data/lib/budgea_client/models/recipient.rb +343 -0
  180. data/lib/budgea_client/models/security.rb +229 -0
  181. data/lib/budgea_client/models/subscription.rb +299 -0
  182. data/lib/budgea_client/models/terms_of_service.rb +229 -0
  183. data/lib/budgea_client/models/transaction.rb +507 -0
  184. data/lib/budgea_client/models/transaction_information.rb +224 -0
  185. data/lib/budgea_client/models/transactions_cluster.rb +277 -0
  186. data/lib/budgea_client/models/transfer.rb +354 -0
  187. data/lib/budgea_client/models/user.rb +244 -0
  188. data/lib/budgea_client/models/user_alert.rb +333 -0
  189. data/lib/budgea_client/models/webhook.rb +264 -0
  190. data/lib/budgea_client/version.rb +5 -0
  191. data/pkg/budgea_client-1.0.0.gem +0 -0
  192. data/spec/api/administration_api_spec.rb +271 -0
  193. data/spec/api/authentication_api_spec.rb +126 -0
  194. data/spec/api/banks_api_spec.rb +1787 -0
  195. data/spec/api/connections_api_spec.rb +279 -0
  196. data/spec/api/documents_api_spec.rb +1557 -0
  197. data/spec/api/ocr_api_spec.rb +54 -0
  198. data/spec/api/oidc_api_spec.rb +65 -0
  199. data/spec/api/pfm_api_spec.rb +613 -0
  200. data/spec/api/providers_api_spec.rb +2029 -0
  201. data/spec/api/recipients_api_spec.rb +89 -0
  202. data/spec/api/terms_api_spec.rb +79 -0
  203. data/spec/api/transfers_api_spec.rb +661 -0
  204. data/spec/api/users_management_api_spec.rb +177 -0
  205. data/spec/api/wealth_api_spec.rb +246 -0
  206. data/spec/api_client_spec.rb +216 -0
  207. data/spec/configuration_spec.rb +32 -0
  208. data/spec/models/access_spec.rb +56 -0
  209. data/spec/models/account_log_spec.rb +74 -0
  210. data/spec/models/account_spec.rb +134 -0
  211. data/spec/models/account_type_spec.rb +74 -0
  212. data/spec/models/alert_spec.rb +74 -0
  213. data/spec/models/bank_category_spec.rb +38 -0
  214. data/spec/models/bank_spec.rb +92 -0
  215. data/spec/models/category_spec.rb +86 -0
  216. data/spec/models/client_spec.rb +92 -0
  217. data/spec/models/connection_contact_spec.rb +86 -0
  218. data/spec/models/connection_log_spec.rb +110 -0
  219. data/spec/models/connection_spec.rb +80 -0
  220. data/spec/models/connector_logo_spec.rb +50 -0
  221. data/spec/models/currency_spec.rb +44 -0
  222. data/spec/models/device_spec.rb +68 -0
  223. data/spec/models/document_spec.rb +158 -0
  224. data/spec/models/document_type_spec.rb +44 -0
  225. data/spec/models/field_spec.rb +74 -0
  226. data/spec/models/file_spec.rb +50 -0
  227. data/spec/models/group_spec.rb +74 -0
  228. data/spec/models/hash_table_spec.rb +50 -0
  229. data/spec/models/inline_response_200_10_spec.rb +32 -0
  230. data/spec/models/inline_response_200_11_spec.rb +32 -0
  231. data/spec/models/inline_response_200_12_spec.rb +32 -0
  232. data/spec/models/inline_response_200_13_spec.rb +32 -0
  233. data/spec/models/inline_response_200_14_spec.rb +32 -0
  234. data/spec/models/inline_response_200_15_spec.rb +32 -0
  235. data/spec/models/inline_response_200_16_spec.rb +32 -0
  236. data/spec/models/inline_response_200_17_spec.rb +32 -0
  237. data/spec/models/inline_response_200_18_spec.rb +32 -0
  238. data/spec/models/inline_response_200_19_spec.rb +32 -0
  239. data/spec/models/inline_response_200_1_spec.rb +38 -0
  240. data/spec/models/inline_response_200_20_spec.rb +32 -0
  241. data/spec/models/inline_response_200_21_spec.rb +32 -0
  242. data/spec/models/inline_response_200_22_spec.rb +32 -0
  243. data/spec/models/inline_response_200_23_spec.rb +32 -0
  244. data/spec/models/inline_response_200_24_spec.rb +32 -0
  245. data/spec/models/inline_response_200_25_spec.rb +32 -0
  246. data/spec/models/inline_response_200_26_spec.rb +32 -0
  247. data/spec/models/inline_response_200_27_spec.rb +32 -0
  248. data/spec/models/inline_response_200_28_spec.rb +32 -0
  249. data/spec/models/inline_response_200_29_spec.rb +32 -0
  250. data/spec/models/inline_response_200_2_spec.rb +44 -0
  251. data/spec/models/inline_response_200_30_spec.rb +32 -0
  252. data/spec/models/inline_response_200_31_spec.rb +32 -0
  253. data/spec/models/inline_response_200_32_spec.rb +32 -0
  254. data/spec/models/inline_response_200_33_spec.rb +32 -0
  255. data/spec/models/inline_response_200_3_spec.rb +44 -0
  256. data/spec/models/inline_response_200_4_spec.rb +56 -0
  257. data/spec/models/inline_response_200_5_spec.rb +38 -0
  258. data/spec/models/inline_response_200_6_spec.rb +44 -0
  259. data/spec/models/inline_response_200_7_spec.rb +32 -0
  260. data/spec/models/inline_response_200_8_spec.rb +32 -0
  261. data/spec/models/inline_response_200_9_spec.rb +32 -0
  262. data/spec/models/inline_response_200_spec.rb +32 -0
  263. data/spec/models/investment_spec.rb +176 -0
  264. data/spec/models/investment_value_spec.rb +62 -0
  265. data/spec/models/invite_spec.rb +62 -0
  266. data/spec/models/locked_user_spec.rb +44 -0
  267. data/spec/models/oidc_whitelist_spec.rb +38 -0
  268. data/spec/models/pocket_spec.rb +86 -0
  269. data/spec/models/profile_spec.rb +78 -0
  270. data/spec/models/project_spec.rb +80 -0
  271. data/spec/models/project_type_spec.rb +44 -0
  272. data/spec/models/recipient_spec.rb +116 -0
  273. data/spec/models/security_spec.rb +56 -0
  274. data/spec/models/subscription_spec.rb +92 -0
  275. data/spec/models/terms_of_service_spec.rb +56 -0
  276. data/spec/models/transaction_information_spec.rb +50 -0
  277. data/spec/models/transaction_spec.rb +182 -0
  278. data/spec/models/transactions_cluster_spec.rb +80 -0
  279. data/spec/models/transfer_spec.rb +122 -0
  280. data/spec/models/user_alert_spec.rb +110 -0
  281. data/spec/models/user_spec.rb +48 -0
  282. data/spec/models/webhook_spec.rb +74 -0
  283. data/spec/spec_helper.rb +51 -0
  284. metadata +599 -0
@@ -0,0 +1,308 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'date'
4
+
5
+ module BudgeaClient
6
+
7
+ class Profile
8
+ attr_accessor :id
9
+
10
+ attr_accessor :id_user
11
+
12
+ attr_accessor :role
13
+
14
+ attr_accessor :email
15
+
16
+ attr_accessor :statut
17
+
18
+ attr_accessor :admin
19
+
20
+ attr_accessor :conf
21
+
22
+ attr_accessor :lang
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'id' => :'id',
50
+ :'id_user' => :'id_user',
51
+ :'role' => :'role',
52
+ :'email' => :'email',
53
+ :'statut' => :'statut',
54
+ :'admin' => :'admin',
55
+ :'conf' => :'conf',
56
+ :'lang' => :'lang'
57
+ }
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.swagger_types
62
+ {
63
+ :'id' => :'Integer',
64
+ :'id_user' => :'Integer',
65
+ :'role' => :'String',
66
+ :'email' => :'String',
67
+ :'statut' => :'Integer',
68
+ :'admin' => :'BOOLEAN',
69
+ :'conf' => :'String',
70
+ :'lang' => :'String'
71
+ }
72
+ end
73
+
74
+ # Initializes the object
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ def initialize(attributes = {})
77
+ return unless attributes.is_a?(Hash)
78
+
79
+ # convert string to symbol for hash key
80
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
81
+
82
+ if attributes.has_key?(:'id')
83
+ self.id = attributes[:'id']
84
+ end
85
+
86
+ if attributes.has_key?(:'id_user')
87
+ self.id_user = attributes[:'id_user']
88
+ end
89
+
90
+ if attributes.has_key?(:'role')
91
+ self.role = attributes[:'role']
92
+ else
93
+ self.role = "admin"
94
+ end
95
+
96
+ if attributes.has_key?(:'email')
97
+ self.email = attributes[:'email']
98
+ end
99
+
100
+ if attributes.has_key?(:'statut')
101
+ self.statut = attributes[:'statut']
102
+ end
103
+
104
+ if attributes.has_key?(:'admin')
105
+ self.admin = attributes[:'admin']
106
+ else
107
+ self.admin = false
108
+ end
109
+
110
+ if attributes.has_key?(:'conf')
111
+ self.conf = attributes[:'conf']
112
+ end
113
+
114
+ if attributes.has_key?(:'lang')
115
+ self.lang = attributes[:'lang']
116
+ end
117
+
118
+ end
119
+
120
+ # Show invalid properties with the reasons. Usually used together with valid?
121
+ # @return Array for valid properties with the reasons
122
+ def list_invalid_properties
123
+ invalid_properties = Array.new
124
+ if @id.nil?
125
+ invalid_properties.push("invalid value for 'id', id cannot be nil.")
126
+ end
127
+
128
+ if @id_user.nil?
129
+ invalid_properties.push("invalid value for 'id_user', id_user cannot be nil.")
130
+ end
131
+
132
+ if @role.nil?
133
+ invalid_properties.push("invalid value for 'role', role cannot be nil.")
134
+ end
135
+
136
+ if @email.nil?
137
+ invalid_properties.push("invalid value for 'email', email cannot be nil.")
138
+ end
139
+
140
+ if @statut.nil?
141
+ invalid_properties.push("invalid value for 'statut', statut cannot be nil.")
142
+ end
143
+
144
+ if @admin.nil?
145
+ invalid_properties.push("invalid value for 'admin', admin cannot be nil.")
146
+ end
147
+
148
+ return invalid_properties
149
+ end
150
+
151
+ # Check to see if the all the properties in the model are valid
152
+ # @return true if the model is valid
153
+ def valid?
154
+ return false if @id.nil?
155
+ return false if @id_user.nil?
156
+ return false if @role.nil?
157
+ role_validator = EnumAttributeValidator.new('String', ["admin", "ser"])
158
+ return false unless role_validator.valid?(@role)
159
+ return false if @email.nil?
160
+ return false if @statut.nil?
161
+ return false if @admin.nil?
162
+ return true
163
+ end
164
+
165
+ # Custom attribute writer method checking allowed values (enum).
166
+ # @param [Object] role Object to be assigned
167
+ def role=(role)
168
+ validator = EnumAttributeValidator.new('String', ["admin", "ser"])
169
+ unless validator.valid?(role)
170
+ fail ArgumentError, "invalid value for 'role', must be one of #{validator.allowable_values}."
171
+ end
172
+ @role = role
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_user == o.id_user &&
182
+ role == o.role &&
183
+ email == o.email &&
184
+ statut == o.statut &&
185
+ admin == o.admin &&
186
+ conf == o.conf &&
187
+ lang == o.lang
188
+ end
189
+
190
+ # @see the `==` method
191
+ # @param [Object] Object to be compared
192
+ def eql?(o)
193
+ self == o
194
+ end
195
+
196
+ # Calculates hash code according to all attributes.
197
+ # @return [Fixnum] Hash code
198
+ def hash
199
+ [id, id_user, role, email, statut, admin, conf, lang].hash
200
+ end
201
+
202
+ # Builds the object from hash
203
+ # @param [Hash] attributes Model attributes in the form of hash
204
+ # @return [Object] Returns the model itself
205
+ def build_from_hash(attributes)
206
+ return nil unless attributes.is_a?(Hash)
207
+ self.class.swagger_types.each_pair do |key, type|
208
+ if type =~ /\AArray<(.*)>/i
209
+ # check to ensure the input is an array given that the the attribute
210
+ # is documented as an array but the input is not
211
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
212
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
213
+ end
214
+ elsif !attributes[self.class.attribute_map[key]].nil?
215
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
216
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
217
+ end
218
+
219
+ self
220
+ end
221
+
222
+ # Deserializes the data based on type
223
+ # @param string type Data type
224
+ # @param string value Value to be deserialized
225
+ # @return [Object] Deserialized data
226
+ def _deserialize(type, value)
227
+ case type.to_sym
228
+ when :DateTime
229
+ DateTime.parse(value)
230
+ when :Date
231
+ Date.parse(value)
232
+ when :String
233
+ value.to_s
234
+ when :Integer
235
+ value.to_i
236
+ when :Float
237
+ value.to_f
238
+ when :BOOLEAN
239
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
240
+ true
241
+ else
242
+ false
243
+ end
244
+ when :Object
245
+ # generic object (usually a Hash), return directly
246
+ value
247
+ when /\AArray<(?<inner_type>.+)>\z/
248
+ inner_type = Regexp.last_match[:inner_type]
249
+ value.map { |v| _deserialize(inner_type, v) }
250
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
251
+ k_type = Regexp.last_match[:k_type]
252
+ v_type = Regexp.last_match[:v_type]
253
+ {}.tap do |hash|
254
+ value.each do |k, v|
255
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
256
+ end
257
+ end
258
+ else # model
259
+ temp_model = BudgeaClient.const_get(type).new
260
+ temp_model.build_from_hash(value)
261
+ end
262
+ end
263
+
264
+ # Returns the string representation of the object
265
+ # @return [String] String presentation of the object
266
+ def to_s
267
+ to_hash.to_s
268
+ end
269
+
270
+ # to_body is an alias to to_hash (backward compatibility)
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_body
273
+ to_hash
274
+ end
275
+
276
+ # Returns the object in the form of hash
277
+ # @return [Hash] Returns the object in the form of hash
278
+ def to_hash
279
+ hash = {}
280
+ self.class.attribute_map.each_pair do |attr, param|
281
+ value = self.send(attr)
282
+ next if value.nil?
283
+ hash[param] = _to_hash(value)
284
+ end
285
+ hash
286
+ end
287
+
288
+ # Outputs non-array value in the form of hash
289
+ # For object, use to_hash. Otherwise, just return the value
290
+ # @param [Object] value Any valid value
291
+ # @return [Hash] Returns the value in the form of hash
292
+ def _to_hash(value)
293
+ if value.is_a?(Array)
294
+ value.compact.map{ |v| _to_hash(v) }
295
+ elsif value.is_a?(Hash)
296
+ {}.tap do |hash|
297
+ value.each { |k, v| hash[k] = _to_hash(v) }
298
+ end
299
+ elsif value.respond_to? :to_hash
300
+ value.to_hash
301
+ else
302
+ value
303
+ end
304
+ end
305
+
306
+ end
307
+
308
+ end
@@ -0,0 +1,301 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'date'
4
+
5
+ module BudgeaClient
6
+
7
+ class Project
8
+ attr_accessor :id
9
+
10
+ attr_accessor :id_user
11
+
12
+ attr_accessor :id_type
13
+
14
+ attr_accessor :name
15
+
16
+ attr_accessor :target
17
+
18
+ attr_accessor :saved
19
+
20
+ attr_accessor :monthly_savings
21
+
22
+ attr_accessor :comment
23
+
24
+ attr_accessor :active
25
+
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'id' => :'id',
31
+ :'id_user' => :'id_user',
32
+ :'id_type' => :'id_type',
33
+ :'name' => :'name',
34
+ :'target' => :'target',
35
+ :'saved' => :'saved',
36
+ :'monthly_savings' => :'monthly_savings',
37
+ :'comment' => :'comment',
38
+ :'active' => :'active'
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.swagger_types
44
+ {
45
+ :'id' => :'Integer',
46
+ :'id_user' => :'Integer',
47
+ :'id_type' => :'Integer',
48
+ :'name' => :'String',
49
+ :'target' => :'Float',
50
+ :'saved' => :'Float',
51
+ :'monthly_savings' => :'Float',
52
+ :'comment' => :'String',
53
+ :'active' => :'BOOLEAN'
54
+ }
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ return unless attributes.is_a?(Hash)
61
+
62
+ # convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
64
+
65
+ if attributes.has_key?(:'id')
66
+ self.id = attributes[:'id']
67
+ end
68
+
69
+ if attributes.has_key?(:'id_user')
70
+ self.id_user = attributes[:'id_user']
71
+ end
72
+
73
+ if attributes.has_key?(:'id_type')
74
+ self.id_type = attributes[:'id_type']
75
+ end
76
+
77
+ if attributes.has_key?(:'name')
78
+ self.name = attributes[:'name']
79
+ end
80
+
81
+ if attributes.has_key?(:'target')
82
+ self.target = attributes[:'target']
83
+ end
84
+
85
+ if attributes.has_key?(:'saved')
86
+ self.saved = attributes[:'saved']
87
+ else
88
+ self.saved = 0.0
89
+ end
90
+
91
+ if attributes.has_key?(:'monthly_savings')
92
+ self.monthly_savings = attributes[:'monthly_savings']
93
+ end
94
+
95
+ if attributes.has_key?(:'comment')
96
+ self.comment = attributes[:'comment']
97
+ else
98
+ self.comment = ""
99
+ end
100
+
101
+ if attributes.has_key?(:'active')
102
+ self.active = attributes[:'active']
103
+ else
104
+ self.active = true
105
+ end
106
+
107
+ end
108
+
109
+ # Show invalid properties with the reasons. Usually used together with valid?
110
+ # @return Array for valid properties with the reasons
111
+ def list_invalid_properties
112
+ invalid_properties = Array.new
113
+ if @id.nil?
114
+ invalid_properties.push("invalid value for 'id', id cannot be nil.")
115
+ end
116
+
117
+ if @id_user.nil?
118
+ invalid_properties.push("invalid value for 'id_user', id_user cannot be nil.")
119
+ end
120
+
121
+ if @id_type.nil?
122
+ invalid_properties.push("invalid value for 'id_type', id_type cannot be nil.")
123
+ end
124
+
125
+ if @name.nil?
126
+ invalid_properties.push("invalid value for 'name', name cannot be nil.")
127
+ end
128
+
129
+ if @target.nil?
130
+ invalid_properties.push("invalid value for 'target', target cannot be nil.")
131
+ end
132
+
133
+ if @saved.nil?
134
+ invalid_properties.push("invalid value for 'saved', saved cannot be nil.")
135
+ end
136
+
137
+ if @monthly_savings.nil?
138
+ invalid_properties.push("invalid value for 'monthly_savings', monthly_savings cannot be nil.")
139
+ end
140
+
141
+ if @comment.nil?
142
+ invalid_properties.push("invalid value for 'comment', comment cannot be nil.")
143
+ end
144
+
145
+ if @active.nil?
146
+ invalid_properties.push("invalid value for 'active', active cannot be nil.")
147
+ end
148
+
149
+ return invalid_properties
150
+ end
151
+
152
+ # Check to see if the all the properties in the model are valid
153
+ # @return true if the model is valid
154
+ def valid?
155
+ return false if @id.nil?
156
+ return false if @id_user.nil?
157
+ return false if @id_type.nil?
158
+ return false if @name.nil?
159
+ return false if @target.nil?
160
+ return false if @saved.nil?
161
+ return false if @monthly_savings.nil?
162
+ return false if @comment.nil?
163
+ return false if @active.nil?
164
+ return true
165
+ end
166
+
167
+ # Checks equality by comparing each attribute.
168
+ # @param [Object] Object to be compared
169
+ def ==(o)
170
+ return true if self.equal?(o)
171
+ self.class == o.class &&
172
+ id == o.id &&
173
+ id_user == o.id_user &&
174
+ id_type == o.id_type &&
175
+ name == o.name &&
176
+ target == o.target &&
177
+ saved == o.saved &&
178
+ monthly_savings == o.monthly_savings &&
179
+ comment == o.comment &&
180
+ active == o.active
181
+ end
182
+
183
+ # @see the `==` method
184
+ # @param [Object] Object to be compared
185
+ def eql?(o)
186
+ self == o
187
+ end
188
+
189
+ # Calculates hash code according to all attributes.
190
+ # @return [Fixnum] Hash code
191
+ def hash
192
+ [id, id_user, id_type, name, target, saved, monthly_savings, comment, active].hash
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def build_from_hash(attributes)
199
+ return nil unless attributes.is_a?(Hash)
200
+ self.class.swagger_types.each_pair do |key, type|
201
+ if type =~ /\AArray<(.*)>/i
202
+ # check to ensure the input is an array given that the the attribute
203
+ # is documented as an array but the input is not
204
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
205
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
206
+ end
207
+ elsif !attributes[self.class.attribute_map[key]].nil?
208
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
209
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
210
+ end
211
+
212
+ self
213
+ end
214
+
215
+ # Deserializes the data based on type
216
+ # @param string type Data type
217
+ # @param string value Value to be deserialized
218
+ # @return [Object] Deserialized data
219
+ def _deserialize(type, value)
220
+ case type.to_sym
221
+ when :DateTime
222
+ DateTime.parse(value)
223
+ when :Date
224
+ Date.parse(value)
225
+ when :String
226
+ value.to_s
227
+ when :Integer
228
+ value.to_i
229
+ when :Float
230
+ value.to_f
231
+ when :BOOLEAN
232
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
233
+ true
234
+ else
235
+ false
236
+ end
237
+ when :Object
238
+ # generic object (usually a Hash), return directly
239
+ value
240
+ when /\AArray<(?<inner_type>.+)>\z/
241
+ inner_type = Regexp.last_match[:inner_type]
242
+ value.map { |v| _deserialize(inner_type, v) }
243
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
244
+ k_type = Regexp.last_match[:k_type]
245
+ v_type = Regexp.last_match[:v_type]
246
+ {}.tap do |hash|
247
+ value.each do |k, v|
248
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
249
+ end
250
+ end
251
+ else # model
252
+ temp_model = BudgeaClient.const_get(type).new
253
+ temp_model.build_from_hash(value)
254
+ end
255
+ end
256
+
257
+ # Returns the string representation of the object
258
+ # @return [String] String presentation of the object
259
+ def to_s
260
+ to_hash.to_s
261
+ end
262
+
263
+ # to_body is an alias to to_hash (backward compatibility)
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_body
266
+ to_hash
267
+ end
268
+
269
+ # Returns the object in the form of hash
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_hash
272
+ hash = {}
273
+ self.class.attribute_map.each_pair do |attr, param|
274
+ value = self.send(attr)
275
+ next if value.nil?
276
+ hash[param] = _to_hash(value)
277
+ end
278
+ hash
279
+ end
280
+
281
+ # Outputs non-array value in the form of hash
282
+ # For object, use to_hash. Otherwise, just return the value
283
+ # @param [Object] value Any valid value
284
+ # @return [Hash] Returns the value in the form of hash
285
+ def _to_hash(value)
286
+ if value.is_a?(Array)
287
+ value.compact.map{ |v| _to_hash(v) }
288
+ elsif value.is_a?(Hash)
289
+ {}.tap do |hash|
290
+ value.each { |k, v| hash[k] = _to_hash(v) }
291
+ end
292
+ elsif value.respond_to? :to_hash
293
+ value.to_hash
294
+ else
295
+ value
296
+ end
297
+ end
298
+
299
+ end
300
+
301
+ end