budgea_client 3.0.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/budgea_openapi.json +6 -4
  4. data/docs/Connector.md +1 -0
  5. data/lib/budgea_client/models/connector.rb +15 -4
  6. data/lib/budgea_client/version.rb +1 -1
  7. data/pkg/budgea_client-3.0.1.gem +0 -0
  8. data/spec/api/administration_api_spec.rb +225 -23
  9. data/spec/api/authentication_api_spec.rb +81 -11
  10. data/spec/api/banks_api_spec.rb +379 -236
  11. data/spec/api/connections_api_spec.rb +76 -39
  12. data/spec/api/documents_api_spec.rb +124 -114
  13. data/spec/api/ocr_api_spec.rb +13 -3
  14. data/spec/api/oidc_api_spec.rb +14 -4
  15. data/spec/api/pfm_api_spec.rb +61 -51
  16. data/spec/api/providers_api_spec.rb +260 -238
  17. data/spec/api/recipients_api_spec.rb +23 -9
  18. data/spec/api/terms_api_spec.rb +17 -8
  19. data/spec/api/transfers_api_spec.rb +88 -57
  20. data/spec/api/users_management_api_spec.rb +25 -15
  21. data/spec/api/wealth_api_spec.rb +150 -24
  22. data/spec/api_client_spec.rb +45 -35
  23. data/spec/configuration_spec.rb +19 -9
  24. data/spec/models/access_spec.rb +16 -7
  25. data/spec/models/account_log_spec.rb +21 -12
  26. data/spec/models/account_spec.rb +59 -20
  27. data/spec/models/account_type_spec.rb +19 -10
  28. data/spec/models/alert_spec.rb +19 -10
  29. data/spec/models/category_spec.rb +21 -12
  30. data/spec/models/client_spec.rb +25 -28
  31. data/spec/models/connection_log_spec.rb +38 -17
  32. data/spec/models/connection_spec.rb +33 -12
  33. data/spec/models/connector_logo_spec.rb +16 -7
  34. data/spec/models/connector_spec.rb +18 -0
  35. data/spec/models/currency_spec.rb +38 -5
  36. data/spec/models/device_spec.rb +18 -9
  37. data/spec/models/document_spec.rb +37 -34
  38. data/spec/models/document_type_spec.rb +14 -5
  39. data/spec/models/field_spec.rb +32 -11
  40. data/spec/models/field_value_spec.rb +13 -4
  41. data/spec/models/file_spec.rb +15 -6
  42. data/spec/models/group_spec.rb +19 -10
  43. data/spec/models/hash_table_spec.rb +15 -6
  44. data/spec/models/inline_response_200_10_spec.rb +19 -4
  45. data/spec/models/inline_response_200_11_spec.rb +19 -4
  46. data/spec/models/inline_response_200_12_spec.rb +19 -4
  47. data/spec/models/inline_response_200_13_spec.rb +19 -4
  48. data/spec/models/inline_response_200_14_spec.rb +19 -4
  49. data/spec/models/inline_response_200_15_spec.rb +19 -4
  50. data/spec/models/inline_response_200_16_spec.rb +19 -4
  51. data/spec/models/inline_response_200_17_spec.rb +19 -4
  52. data/spec/models/inline_response_200_18_spec.rb +19 -4
  53. data/spec/models/inline_response_200_19_spec.rb +13 -4
  54. data/spec/models/inline_response_200_1_spec.rb +13 -4
  55. data/spec/models/inline_response_200_20_spec.rb +19 -4
  56. data/spec/models/inline_response_200_21_spec.rb +19 -4
  57. data/spec/models/inline_response_200_22_spec.rb +19 -4
  58. data/spec/models/inline_response_200_23_spec.rb +19 -4
  59. data/spec/models/inline_response_200_24_spec.rb +19 -4
  60. data/spec/models/inline_response_200_25_spec.rb +19 -4
  61. data/spec/models/inline_response_200_26_spec.rb +19 -4
  62. data/spec/models/inline_response_200_27_spec.rb +19 -4
  63. data/spec/models/inline_response_200_28_spec.rb +19 -4
  64. data/spec/models/inline_response_200_29_spec.rb +19 -4
  65. data/spec/models/inline_response_200_2_spec.rb +14 -5
  66. data/spec/models/inline_response_200_30_spec.rb +19 -4
  67. data/spec/models/inline_response_200_31_spec.rb +19 -4
  68. data/spec/models/inline_response_200_32_spec.rb +19 -4
  69. data/spec/models/inline_response_200_33_spec.rb +19 -4
  70. data/spec/models/inline_response_200_34_spec.rb +7 -1
  71. data/spec/models/inline_response_200_35_spec.rb +7 -1
  72. data/spec/models/inline_response_200_36_spec.rb +7 -1
  73. data/spec/models/inline_response_200_37_spec.rb +7 -1
  74. data/spec/models/inline_response_200_38_spec.rb +7 -1
  75. data/spec/models/inline_response_200_3_spec.rb +15 -12
  76. data/spec/models/inline_response_200_4_spec.rb +14 -17
  77. data/spec/models/inline_response_200_5_spec.rb +33 -6
  78. data/spec/models/inline_response_200_6_spec.rb +15 -12
  79. data/spec/models/inline_response_200_7_spec.rb +25 -4
  80. data/spec/models/inline_response_200_8_spec.rb +19 -4
  81. data/spec/models/inline_response_200_9_spec.rb +19 -4
  82. data/spec/models/inline_response_200_spec.rb +18 -3
  83. data/spec/models/investment_spec.rb +36 -27
  84. data/spec/models/investment_value_spec.rb +17 -8
  85. data/spec/models/invite_spec.rb +17 -8
  86. data/spec/models/locked_user_spec.rb +14 -5
  87. data/spec/models/oidc_whitelist_spec.rb +13 -4
  88. data/spec/models/pocket_spec.rb +21 -12
  89. data/spec/models/profile_spec.rb +23 -14
  90. data/spec/models/project_spec.rb +20 -11
  91. data/spec/models/project_type_spec.rb +14 -5
  92. data/spec/models/recipient_log_spec.rb +6 -0
  93. data/spec/models/recipient_spec.rb +44 -17
  94. data/spec/models/security_spec.rb +16 -7
  95. data/spec/models/subscription_spec.rb +28 -13
  96. data/spec/models/terms_of_service_spec.rb +16 -7
  97. data/spec/models/transaction_information_spec.rb +15 -6
  98. data/spec/models/transaction_spec.rb +71 -32
  99. data/spec/models/transactions_cluster_spec.rb +20 -11
  100. data/spec/models/transfer_log_spec.rb +6 -0
  101. data/spec/models/transfer_spec.rb +33 -18
  102. data/spec/models/user_alert_spec.rb +25 -16
  103. data/spec/models/user_spec.rb +18 -9
  104. data/spec/models/webhook_spec.rb +31 -10
  105. data/spec/spec_helper.rb +62 -2
  106. metadata +3 -14
  107. data/docs/Bank.md +0 -20
  108. data/docs/BankCategory.md +0 -9
  109. data/docs/ConnectionContact.md +0 -17
  110. data/lib/budgea_client/models/bank.rb +0 -335
  111. data/lib/budgea_client/models/bank_category.rb +0 -206
  112. data/lib/budgea_client/models/connection_contact.rb +0 -274
  113. data/spec/models/bank_category_spec.rb +0 -38
  114. data/spec/models/bank_spec.rb +0 -92
  115. data/spec/models/connection_contact_spec.rb +0 -86
@@ -1,4 +1,14 @@
1
- # frozen_string_literal: true
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
2
12
 
3
13
  # load the gem
4
14
  require 'budgea_client'
@@ -47,5 +57,55 @@ RSpec.configure do |config|
47
57
 
48
58
  # The settings below are suggested to provide a good initial experience
49
59
  # with RSpec, but feel free to customize to your heart's content.
50
- # frozen_string_literal: true
60
+ =begin
61
+ # These two settings work together to allow you to limit a spec run
62
+ # to individual examples or groups you care about by tagging them with
63
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
64
+ # get run.
65
+ config.filter_run :focus
66
+ config.run_all_when_everything_filtered = true
67
+
68
+ # Allows RSpec to persist some state between runs in order to support
69
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
70
+ # you configure your source control system to ignore this file.
71
+ config.example_status_persistence_file_path = "spec/examples.txt"
72
+
73
+ # Limits the available syntax to the non-monkey patched syntax that is
74
+ # recommended. For more details, see:
75
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
76
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
77
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
78
+ config.disable_monkey_patching!
79
+
80
+ # This setting enables warnings. It's recommended, but in some cases may
81
+ # be too noisy due to issues in dependencies.
82
+ config.warnings = true
83
+
84
+ # Many RSpec users commonly either run the entire suite or an individual
85
+ # file, and it's useful to allow more verbose output when running an
86
+ # individual spec file.
87
+ if config.files_to_run.one?
88
+ # Use the documentation formatter for detailed output,
89
+ # unless a formatter has already been configured
90
+ # (e.g. via a command-line flag).
91
+ config.default_formatter = 'doc'
92
+ end
93
+
94
+ # Print the 10 slowest examples and example groups at the
95
+ # end of the spec run, to help surface which specs are running
96
+ # particularly slow.
97
+ config.profile_examples = 10
98
+
99
+ # Run specs in random order to surface order dependencies. If you find an
100
+ # order dependency and want to debug it, you can fix the order by providing
101
+ # the seed, which is printed after each run.
102
+ # --seed 1234
103
+ config.order = :random
104
+
105
+ # Seed global randomization in this process using the `--seed` CLI option.
106
+ # Setting this allows you to use `--seed` to deterministically reproduce
107
+ # test failures related to randomization by passing the same `--seed` value
108
+ # as the one that triggered the failure.
109
+ Kernel.srand config.seed
110
+ =end
51
111
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: budgea_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chaker Nakhli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-04 00:00:00.000000000 Z
11
+ date: 2019-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -212,15 +212,12 @@ files:
212
212
  - docs/Alert.md
213
213
  - docs/AuthProvider.md
214
214
  - docs/AuthenticationApi.md
215
- - docs/Bank.md
216
- - docs/BankCategory.md
217
215
  - docs/BanksApi.md
218
216
  - docs/Category.md
219
217
  - docs/Certificate.md
220
218
  - docs/Client.md
221
219
  - docs/ConfigLog.md
222
220
  - docs/Connection.md
223
- - docs/ConnectionContact.md
224
221
  - docs/ConnectionLog.md
225
222
  - docs/ConnectionsApi.md
226
223
  - docs/Connector.md
@@ -338,14 +335,11 @@ files:
338
335
  - lib/budgea_client/models/account_type.rb
339
336
  - lib/budgea_client/models/alert.rb
340
337
  - lib/budgea_client/models/auth_provider.rb
341
- - lib/budgea_client/models/bank.rb
342
- - lib/budgea_client/models/bank_category.rb
343
338
  - lib/budgea_client/models/category.rb
344
339
  - lib/budgea_client/models/certificate.rb
345
340
  - lib/budgea_client/models/client.rb
346
341
  - lib/budgea_client/models/config_log.rb
347
342
  - lib/budgea_client/models/connection.rb
348
- - lib/budgea_client/models/connection_contact.rb
349
343
  - lib/budgea_client/models/connection_log.rb
350
344
  - lib/budgea_client/models/connector.rb
351
345
  - lib/budgea_client/models/connector_category.rb
@@ -428,6 +422,7 @@ files:
428
422
  - lib/budgea_client/version.rb
429
423
  - original_budgea_openapi.json
430
424
  - pkg/budgea_client-2.0.0.gem
425
+ - pkg/budgea_client-3.0.1.gem
431
426
  - spec/api/administration_api_spec.rb
432
427
  - spec/api/authentication_api_spec.rb
433
428
  - spec/api/banks_api_spec.rb
@@ -451,13 +446,10 @@ files:
451
446
  - spec/models/account_type_spec.rb
452
447
  - spec/models/alert_spec.rb
453
448
  - spec/models/auth_provider_spec.rb
454
- - spec/models/bank_category_spec.rb
455
- - spec/models/bank_spec.rb
456
449
  - spec/models/category_spec.rb
457
450
  - spec/models/certificate_spec.rb
458
451
  - spec/models/client_spec.rb
459
452
  - spec/models/config_log_spec.rb
460
- - spec/models/connection_contact_spec.rb
461
453
  - spec/models/connection_log_spec.rb
462
454
  - spec/models/connection_spec.rb
463
455
  - spec/models/connector_category_spec.rb
@@ -624,7 +616,6 @@ test_files:
624
616
  - spec/models/connector_spec.rb
625
617
  - spec/models/terms_of_service_spec.rb
626
618
  - spec/models/invite_spec.rb
627
- - spec/models/connection_contact_spec.rb
628
619
  - spec/models/inline_response_200_13_spec.rb
629
620
  - spec/models/inline_response_200_9_spec.rb
630
621
  - spec/models/recipient_log_spec.rb
@@ -667,8 +658,6 @@ test_files:
667
658
  - spec/models/user_spec.rb
668
659
  - spec/models/inline_response_200_14_spec.rb
669
660
  - spec/models/investment_value_spec.rb
670
- - spec/models/bank_category_spec.rb
671
- - spec/models/bank_spec.rb
672
661
  - spec/models/inline_response_200_7_spec.rb
673
662
  - spec/models/inline_response_200_40_spec.rb
674
663
  - spec/models/inline_response_200_22_spec.rb
@@ -1,20 +0,0 @@
1
- # BudgeaClient::Bank
2
-
3
- ## Properties
4
- Name | Type | Description | Notes
5
- ------------ | ------------- | ------------- | -------------
6
- **id** | **Integer** | ID of the connector |
7
- **name** | **String** | Name of the bank or provider |
8
- **id_weboob** | **String** | |
9
- **hidden** | **BOOLEAN** | This connector is hidden from your users | [optional] [default to false]
10
- **charged** | **BOOLEAN** | Usage of this connector is charged | [default to true]
11
- **code** | **String** | Bank code | [optional]
12
- **beta** | **BOOLEAN** | If true, this connector is perhaps unstable :) | [default to false]
13
- **color** | **String** | Main color of the bank or provider | [optional]
14
- **slug** | **String** | | [optional]
15
- **sync_frequency** | **Float** | How many days to wait between syncs | [optional]
16
- **months_to_fetch** | **Integer** | How many months of history to fetch | [optional]
17
- **account_types** | **Array<String>** | | [optional]
18
- **fields** | [**Array<Field>**](Field.md) | | [optional]
19
-
20
-
@@ -1,9 +0,0 @@
1
- # BudgeaClient::BankCategory
2
-
3
- ## Properties
4
- Name | Type | Description | Notes
5
- ------------ | ------------- | ------------- | -------------
6
- **id** | **Integer** | ID of the bank category |
7
- **name** | **String** | Name of the category | [default to 'false']
8
-
9
-
@@ -1,17 +0,0 @@
1
- # BudgeaClient::ConnectionContact
2
-
3
- ## Properties
4
- Name | Type | Description | Notes
5
- ------------ | ------------- | ------------- | -------------
6
- **id** | **Integer** | |
7
- **id_connection** | **Integer** | |
8
- **name** | **String** | |
9
- **email** | **String** | | [optional]
10
- **phone** | **String** | | [optional]
11
- **mobile** | **String** | | [optional]
12
- **fax** | **String** | | [optional]
13
- **agency** | **String** | | [optional]
14
- **address** | **String** | | [optional]
15
- **role** | **String** | | [optional]
16
-
17
-
@@ -1,335 +0,0 @@
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 Bank
17
- # ID of the connector
18
- attr_accessor :id
19
-
20
- # Name of the bank or provider
21
- attr_accessor :name
22
-
23
- attr_accessor :id_weboob
24
-
25
- # This connector is hidden from your users
26
- attr_accessor :hidden
27
-
28
- # Usage of this connector is charged
29
- attr_accessor :charged
30
-
31
- # Bank code
32
- attr_accessor :code
33
-
34
- # If true, this connector is perhaps unstable :)
35
- attr_accessor :beta
36
-
37
- # Main color of the bank or provider
38
- attr_accessor :color
39
-
40
- attr_accessor :slug
41
-
42
- # How many days to wait between syncs
43
- attr_accessor :sync_frequency
44
-
45
- # How many months of history to fetch
46
- attr_accessor :months_to_fetch
47
-
48
- attr_accessor :account_types
49
-
50
- attr_accessor :fields
51
-
52
- # Attribute mapping from ruby-style variable name to JSON key.
53
- def self.attribute_map
54
- {
55
- :'id' => :'id',
56
- :'name' => :'name',
57
- :'id_weboob' => :'id_weboob',
58
- :'hidden' => :'hidden',
59
- :'charged' => :'charged',
60
- :'code' => :'code',
61
- :'beta' => :'beta',
62
- :'color' => :'color',
63
- :'slug' => :'slug',
64
- :'sync_frequency' => :'sync_frequency',
65
- :'months_to_fetch' => :'months_to_fetch',
66
- :'account_types' => :'account_types',
67
- :'fields' => :'fields'
68
- }
69
- end
70
-
71
- # Attribute type mapping.
72
- def self.swagger_types
73
- {
74
- :'id' => :'Integer',
75
- :'name' => :'String',
76
- :'id_weboob' => :'String',
77
- :'hidden' => :'BOOLEAN',
78
- :'charged' => :'BOOLEAN',
79
- :'code' => :'String',
80
- :'beta' => :'BOOLEAN',
81
- :'color' => :'String',
82
- :'slug' => :'String',
83
- :'sync_frequency' => :'Float',
84
- :'months_to_fetch' => :'Integer',
85
- :'account_types' => :'Array<String>',
86
- :'fields' => :'Array<Field>'
87
- }
88
- end
89
-
90
- # Initializes the object
91
- # @param [Hash] attributes Model attributes in the form of hash
92
- def initialize(attributes = {})
93
- return unless attributes.is_a?(Hash)
94
-
95
- # convert string to symbol for hash key
96
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
97
-
98
- if attributes.has_key?(:'id')
99
- self.id = attributes[:'id']
100
- end
101
-
102
- if attributes.has_key?(:'name')
103
- self.name = attributes[:'name']
104
- end
105
-
106
- if attributes.has_key?(:'id_weboob')
107
- self.id_weboob = attributes[:'id_weboob']
108
- end
109
-
110
- if attributes.has_key?(:'hidden')
111
- self.hidden = attributes[:'hidden']
112
- else
113
- self.hidden = false
114
- end
115
-
116
- if attributes.has_key?(:'charged')
117
- self.charged = attributes[:'charged']
118
- else
119
- self.charged = true
120
- end
121
-
122
- if attributes.has_key?(:'code')
123
- self.code = attributes[:'code']
124
- end
125
-
126
- if attributes.has_key?(:'beta')
127
- self.beta = attributes[:'beta']
128
- else
129
- self.beta = false
130
- end
131
-
132
- if attributes.has_key?(:'color')
133
- self.color = attributes[:'color']
134
- end
135
-
136
- if attributes.has_key?(:'slug')
137
- self.slug = attributes[:'slug']
138
- end
139
-
140
- if attributes.has_key?(:'sync_frequency')
141
- self.sync_frequency = attributes[:'sync_frequency']
142
- end
143
-
144
- if attributes.has_key?(:'months_to_fetch')
145
- self.months_to_fetch = attributes[:'months_to_fetch']
146
- end
147
-
148
- if attributes.has_key?(:'account_types')
149
- if (value = attributes[:'account_types']).is_a?(Array)
150
- self.account_types = value
151
- end
152
- end
153
-
154
- if attributes.has_key?(:'fields')
155
- if (value = attributes[:'fields']).is_a?(Array)
156
- self.fields = value
157
- end
158
- end
159
- end
160
-
161
- # Show invalid properties with the reasons. Usually used together with valid?
162
- # @return Array for valid properties with the reasons
163
- def list_invalid_properties
164
- invalid_properties = Array.new
165
- if @id.nil?
166
- invalid_properties.push('invalid value for "id", id cannot be nil.')
167
- end
168
-
169
- if @name.nil?
170
- invalid_properties.push('invalid value for "name", name cannot be nil.')
171
- end
172
-
173
- if @id_weboob.nil?
174
- invalid_properties.push('invalid value for "id_weboob", id_weboob cannot be nil.')
175
- end
176
-
177
- if @charged.nil?
178
- invalid_properties.push('invalid value for "charged", charged cannot be nil.')
179
- end
180
-
181
- if @beta.nil?
182
- invalid_properties.push('invalid value for "beta", beta cannot be nil.')
183
- end
184
-
185
- invalid_properties
186
- end
187
-
188
- # Check to see if the all the properties in the model are valid
189
- # @return true if the model is valid
190
- def valid?
191
- return false if @id.nil?
192
- return false if @name.nil?
193
- return false if @id_weboob.nil?
194
- return false if @charged.nil?
195
- return false if @beta.nil?
196
- true
197
- end
198
-
199
- # Checks equality by comparing each attribute.
200
- # @param [Object] Object to be compared
201
- def ==(o)
202
- return true if self.equal?(o)
203
- self.class == o.class &&
204
- id == o.id &&
205
- name == o.name &&
206
- id_weboob == o.id_weboob &&
207
- hidden == o.hidden &&
208
- charged == o.charged &&
209
- code == o.code &&
210
- beta == o.beta &&
211
- color == o.color &&
212
- slug == o.slug &&
213
- sync_frequency == o.sync_frequency &&
214
- months_to_fetch == o.months_to_fetch &&
215
- account_types == o.account_types &&
216
- fields == o.fields
217
- end
218
-
219
- # @see the `==` method
220
- # @param [Object] Object to be compared
221
- def eql?(o)
222
- self == o
223
- end
224
-
225
- # Calculates hash code according to all attributes.
226
- # @return [Fixnum] Hash code
227
- def hash
228
- [id, name, id_weboob, hidden, charged, code, beta, color, slug, sync_frequency, months_to_fetch, account_types, fields].hash
229
- end
230
-
231
- # Builds the object from hash
232
- # @param [Hash] attributes Model attributes in the form of hash
233
- # @return [Object] Returns the model itself
234
- def build_from_hash(attributes)
235
- return nil unless attributes.is_a?(Hash)
236
- self.class.swagger_types.each_pair do |key, type|
237
- if type =~ /\AArray<(.*)>/i
238
- # check to ensure the input is an array given that the the attribute
239
- # is documented as an array but the input is not
240
- if attributes[self.class.attribute_map[key]].is_a?(Array)
241
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
242
- end
243
- elsif !attributes[self.class.attribute_map[key]].nil?
244
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
245
- end # or else data not found in attributes(hash), not an issue as the data can be optional
246
- end
247
-
248
- self
249
- end
250
-
251
- # Deserializes the data based on type
252
- # @param string type Data type
253
- # @param string value Value to be deserialized
254
- # @return [Object] Deserialized data
255
- def _deserialize(type, value)
256
- case type.to_sym
257
- when :DateTime
258
- DateTime.parse(value)
259
- when :Date
260
- Date.parse(value)
261
- when :String
262
- value.to_s
263
- when :Integer
264
- value.to_i
265
- when :Float
266
- value.to_f
267
- when :BOOLEAN
268
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
269
- true
270
- else
271
- false
272
- end
273
- when :Object
274
- # generic object (usually a Hash), return directly
275
- value
276
- when /\AArray<(?<inner_type>.+)>\z/
277
- inner_type = Regexp.last_match[:inner_type]
278
- value.map { |v| _deserialize(inner_type, v) }
279
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
280
- k_type = Regexp.last_match[:k_type]
281
- v_type = Regexp.last_match[:v_type]
282
- {}.tap do |hash|
283
- value.each do |k, v|
284
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
285
- end
286
- end
287
- else # model
288
- temp_model = BudgeaClient.const_get(type).new
289
- temp_model.build_from_hash(value)
290
- end
291
- end
292
-
293
- # Returns the string representation of the object
294
- # @return [String] String presentation of the object
295
- def to_s
296
- to_hash.to_s
297
- end
298
-
299
- # to_body is an alias to to_hash (backward compatibility)
300
- # @return [Hash] Returns the object in the form of hash
301
- def to_body
302
- to_hash
303
- end
304
-
305
- # Returns the object in the form of hash
306
- # @return [Hash] Returns the object in the form of hash
307
- def to_hash
308
- hash = {}
309
- self.class.attribute_map.each_pair do |attr, param|
310
- value = self.send(attr)
311
- next if value.nil?
312
- hash[param] = _to_hash(value)
313
- end
314
- hash
315
- end
316
-
317
- # Outputs non-array value in the form of hash
318
- # For object, use to_hash. Otherwise, just return the value
319
- # @param [Object] value Any valid value
320
- # @return [Hash] Returns the value in the form of hash
321
- def _to_hash(value)
322
- if value.is_a?(Array)
323
- value.compact.map { |v| _to_hash(v) }
324
- elsif value.is_a?(Hash)
325
- {}.tap do |hash|
326
- value.each { |k, v| hash[k] = _to_hash(v) }
327
- end
328
- elsif value.respond_to? :to_hash
329
- value.to_hash
330
- else
331
- value
332
- end
333
- end
334
- end
335
- end