budgea_client 4.0.3 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -17,13 +17,13 @@ module BudgeaClient
17
17
  # total number of results
18
18
  attr_accessor :total
19
19
 
20
- attr_accessor :authproviders
20
+ attr_accessor :profiles
21
21
 
22
22
  # Attribute mapping from ruby-style variable name to JSON key.
23
23
  def self.attribute_map
24
24
  {
25
25
  :'total' => :'total',
26
- :'authproviders' => :'authproviders'
26
+ :'profiles' => :'profiles'
27
27
  }
28
28
  end
29
29
 
@@ -31,7 +31,7 @@ module BudgeaClient
31
31
  def self.swagger_types
32
32
  {
33
33
  :'total' => :'Float',
34
- :'authproviders' => :'Array<AuthProvider>'
34
+ :'profiles' => :'Array<Profile>'
35
35
  }
36
36
  end
37
37
 
@@ -47,9 +47,9 @@ module BudgeaClient
47
47
  self.total = attributes[:'total']
48
48
  end
49
49
 
50
- if attributes.has_key?(:'authproviders')
51
- if (value = attributes[:'authproviders']).is_a?(Array)
52
- self.authproviders = value
50
+ if attributes.has_key?(:'profiles')
51
+ if (value = attributes[:'profiles']).is_a?(Array)
52
+ self.profiles = value
53
53
  end
54
54
  end
55
55
  end
@@ -58,8 +58,8 @@ module BudgeaClient
58
58
  # @return Array for valid properties with the reasons
59
59
  def list_invalid_properties
60
60
  invalid_properties = Array.new
61
- if @authproviders.nil?
62
- invalid_properties.push('invalid value for "authproviders", authproviders cannot be nil.')
61
+ if @profiles.nil?
62
+ invalid_properties.push('invalid value for "profiles", profiles cannot be nil.')
63
63
  end
64
64
 
65
65
  invalid_properties
@@ -68,7 +68,7 @@ module BudgeaClient
68
68
  # Check to see if the all the properties in the model are valid
69
69
  # @return true if the model is valid
70
70
  def valid?
71
- return false if @authproviders.nil?
71
+ return false if @profiles.nil?
72
72
  true
73
73
  end
74
74
 
@@ -78,7 +78,7 @@ module BudgeaClient
78
78
  return true if self.equal?(o)
79
79
  self.class == o.class &&
80
80
  total == o.total &&
81
- authproviders == o.authproviders
81
+ profiles == o.profiles
82
82
  end
83
83
 
84
84
  # @see the `==` method
@@ -90,7 +90,7 @@ module BudgeaClient
90
90
  # Calculates hash code according to all attributes.
91
91
  # @return [Fixnum] Hash code
92
92
  def hash
93
- [total, authproviders].hash
93
+ [total, profiles].hash
94
94
  end
95
95
 
96
96
  # Builds the object from hash
@@ -14,24 +14,24 @@ require 'date'
14
14
 
15
15
  module BudgeaClient
16
16
  class InlineResponse20040
17
+ attr_accessor :webhooks
18
+
17
19
  # total number of results
18
20
  attr_accessor :total
19
21
 
20
- attr_accessor :webhooklogs
21
-
22
22
  # Attribute mapping from ruby-style variable name to JSON key.
23
23
  def self.attribute_map
24
24
  {
25
- :'total' => :'total',
26
- :'webhooklogs' => :'webhooklogs'
25
+ :'webhooks' => :'webhooks',
26
+ :'total' => :'total'
27
27
  }
28
28
  end
29
29
 
30
30
  # Attribute type mapping.
31
31
  def self.swagger_types
32
32
  {
33
- :'total' => :'Float',
34
- :'webhooklogs' => :'Array<WebhookLog>'
33
+ :'webhooks' => :'Array<Webhook>',
34
+ :'total' => :'Float'
35
35
  }
36
36
  end
37
37
 
@@ -43,14 +43,14 @@ module BudgeaClient
43
43
  # convert string to symbol for hash key
44
44
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
45
45
 
46
- if attributes.has_key?(:'total')
47
- self.total = attributes[:'total']
46
+ if attributes.has_key?(:'webhooks')
47
+ if (value = attributes[:'webhooks']).is_a?(Array)
48
+ self.webhooks = value
49
+ end
48
50
  end
49
51
 
50
- if attributes.has_key?(:'webhooklogs')
51
- if (value = attributes[:'webhooklogs']).is_a?(Array)
52
- self.webhooklogs = value
53
- end
52
+ if attributes.has_key?(:'total')
53
+ self.total = attributes[:'total']
54
54
  end
55
55
  end
56
56
 
@@ -58,8 +58,8 @@ module BudgeaClient
58
58
  # @return Array for valid properties with the reasons
59
59
  def list_invalid_properties
60
60
  invalid_properties = Array.new
61
- if @webhooklogs.nil?
62
- invalid_properties.push('invalid value for "webhooklogs", webhooklogs cannot be nil.')
61
+ if @webhooks.nil?
62
+ invalid_properties.push('invalid value for "webhooks", webhooks cannot be nil.')
63
63
  end
64
64
 
65
65
  invalid_properties
@@ -68,7 +68,7 @@ module BudgeaClient
68
68
  # Check to see if the all the properties in the model are valid
69
69
  # @return true if the model is valid
70
70
  def valid?
71
- return false if @webhooklogs.nil?
71
+ return false if @webhooks.nil?
72
72
  true
73
73
  end
74
74
 
@@ -77,8 +77,8 @@ module BudgeaClient
77
77
  def ==(o)
78
78
  return true if self.equal?(o)
79
79
  self.class == o.class &&
80
- total == o.total &&
81
- webhooklogs == o.webhooklogs
80
+ webhooks == o.webhooks &&
81
+ total == o.total
82
82
  end
83
83
 
84
84
  # @see the `==` method
@@ -90,7 +90,7 @@ module BudgeaClient
90
90
  # Calculates hash code according to all attributes.
91
91
  # @return [Fixnum] Hash code
92
92
  def hash
93
- [total, webhooklogs].hash
93
+ [webhooks, total].hash
94
94
  end
95
95
 
96
96
  # Builds the object from hash
@@ -0,0 +1,200 @@
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 InlineResponse20041
17
+ # total number of results
18
+ attr_accessor :total
19
+
20
+ attr_accessor :authproviders
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'total' => :'total',
26
+ :'authproviders' => :'authproviders'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.swagger_types
32
+ {
33
+ :'total' => :'Float',
34
+ :'authproviders' => :'Array<AuthProvider>'
35
+ }
36
+ end
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ def initialize(attributes = {})
41
+ return unless attributes.is_a?(Hash)
42
+
43
+ # convert string to symbol for hash key
44
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
45
+
46
+ if attributes.has_key?(:'total')
47
+ self.total = attributes[:'total']
48
+ end
49
+
50
+ if attributes.has_key?(:'authproviders')
51
+ if (value = attributes[:'authproviders']).is_a?(Array)
52
+ self.authproviders = value
53
+ end
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ if @authproviders.nil?
62
+ invalid_properties.push('invalid value for "authproviders", authproviders cannot be nil.')
63
+ end
64
+
65
+ invalid_properties
66
+ end
67
+
68
+ # Check to see if the all the properties in the model are valid
69
+ # @return true if the model is valid
70
+ def valid?
71
+ return false if @authproviders.nil?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ total == o.total &&
81
+ authproviders == o.authproviders
82
+ end
83
+
84
+ # @see the `==` method
85
+ # @param [Object] Object to be compared
86
+ def eql?(o)
87
+ self == o
88
+ end
89
+
90
+ # Calculates hash code according to all attributes.
91
+ # @return [Fixnum] Hash code
92
+ def hash
93
+ [total, authproviders].hash
94
+ end
95
+
96
+ # Builds the object from hash
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ # @return [Object] Returns the model itself
99
+ def build_from_hash(attributes)
100
+ return nil unless attributes.is_a?(Hash)
101
+ self.class.swagger_types.each_pair do |key, type|
102
+ if type =~ /\AArray<(.*)>/i
103
+ # check to ensure the input is an array given that the the attribute
104
+ # is documented as an array but the input is not
105
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
106
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
107
+ end
108
+ elsif !attributes[self.class.attribute_map[key]].nil?
109
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
110
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
111
+ end
112
+
113
+ self
114
+ end
115
+
116
+ # Deserializes the data based on type
117
+ # @param string type Data type
118
+ # @param string value Value to be deserialized
119
+ # @return [Object] Deserialized data
120
+ def _deserialize(type, value)
121
+ case type.to_sym
122
+ when :DateTime
123
+ DateTime.parse(value)
124
+ when :Date
125
+ Date.parse(value)
126
+ when :String
127
+ value.to_s
128
+ when :Integer
129
+ value.to_i
130
+ when :Float
131
+ value.to_f
132
+ when :BOOLEAN
133
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
134
+ true
135
+ else
136
+ false
137
+ end
138
+ when :Object
139
+ # generic object (usually a Hash), return directly
140
+ value
141
+ when /\AArray<(?<inner_type>.+)>\z/
142
+ inner_type = Regexp.last_match[:inner_type]
143
+ value.map { |v| _deserialize(inner_type, v) }
144
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
145
+ k_type = Regexp.last_match[:k_type]
146
+ v_type = Regexp.last_match[:v_type]
147
+ {}.tap do |hash|
148
+ value.each do |k, v|
149
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
150
+ end
151
+ end
152
+ else # model
153
+ temp_model = BudgeaClient.const_get(type).new
154
+ temp_model.build_from_hash(value)
155
+ end
156
+ end
157
+
158
+ # Returns the string representation of the object
159
+ # @return [String] String presentation of the object
160
+ def to_s
161
+ to_hash.to_s
162
+ end
163
+
164
+ # to_body is an alias to to_hash (backward compatibility)
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_body
167
+ to_hash
168
+ end
169
+
170
+ # Returns the object in the form of hash
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_hash
173
+ hash = {}
174
+ self.class.attribute_map.each_pair do |attr, param|
175
+ value = self.send(attr)
176
+ next if value.nil?
177
+ hash[param] = _to_hash(value)
178
+ end
179
+ hash
180
+ end
181
+
182
+ # Outputs non-array value in the form of hash
183
+ # For object, use to_hash. Otherwise, just return the value
184
+ # @param [Object] value Any valid value
185
+ # @return [Hash] Returns the value in the form of hash
186
+ def _to_hash(value)
187
+ if value.is_a?(Array)
188
+ value.compact.map { |v| _to_hash(v) }
189
+ elsif value.is_a?(Hash)
190
+ {}.tap do |hash|
191
+ value.each { |k, v| hash[k] = _to_hash(v) }
192
+ end
193
+ elsif value.respond_to? :to_hash
194
+ value.to_hash
195
+ else
196
+ value
197
+ end
198
+ end
199
+ end
200
+ end
@@ -0,0 +1,200 @@
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 InlineResponse20042
17
+ # total number of results
18
+ attr_accessor :total
19
+
20
+ attr_accessor :webhooklogs
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'total' => :'total',
26
+ :'webhooklogs' => :'webhooklogs'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.swagger_types
32
+ {
33
+ :'total' => :'Float',
34
+ :'webhooklogs' => :'Array<WebhookLog>'
35
+ }
36
+ end
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ def initialize(attributes = {})
41
+ return unless attributes.is_a?(Hash)
42
+
43
+ # convert string to symbol for hash key
44
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
45
+
46
+ if attributes.has_key?(:'total')
47
+ self.total = attributes[:'total']
48
+ end
49
+
50
+ if attributes.has_key?(:'webhooklogs')
51
+ if (value = attributes[:'webhooklogs']).is_a?(Array)
52
+ self.webhooklogs = value
53
+ end
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ if @webhooklogs.nil?
62
+ invalid_properties.push('invalid value for "webhooklogs", webhooklogs cannot be nil.')
63
+ end
64
+
65
+ invalid_properties
66
+ end
67
+
68
+ # Check to see if the all the properties in the model are valid
69
+ # @return true if the model is valid
70
+ def valid?
71
+ return false if @webhooklogs.nil?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ total == o.total &&
81
+ webhooklogs == o.webhooklogs
82
+ end
83
+
84
+ # @see the `==` method
85
+ # @param [Object] Object to be compared
86
+ def eql?(o)
87
+ self == o
88
+ end
89
+
90
+ # Calculates hash code according to all attributes.
91
+ # @return [Fixnum] Hash code
92
+ def hash
93
+ [total, webhooklogs].hash
94
+ end
95
+
96
+ # Builds the object from hash
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ # @return [Object] Returns the model itself
99
+ def build_from_hash(attributes)
100
+ return nil unless attributes.is_a?(Hash)
101
+ self.class.swagger_types.each_pair do |key, type|
102
+ if type =~ /\AArray<(.*)>/i
103
+ # check to ensure the input is an array given that the the attribute
104
+ # is documented as an array but the input is not
105
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
106
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
107
+ end
108
+ elsif !attributes[self.class.attribute_map[key]].nil?
109
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
110
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
111
+ end
112
+
113
+ self
114
+ end
115
+
116
+ # Deserializes the data based on type
117
+ # @param string type Data type
118
+ # @param string value Value to be deserialized
119
+ # @return [Object] Deserialized data
120
+ def _deserialize(type, value)
121
+ case type.to_sym
122
+ when :DateTime
123
+ DateTime.parse(value)
124
+ when :Date
125
+ Date.parse(value)
126
+ when :String
127
+ value.to_s
128
+ when :Integer
129
+ value.to_i
130
+ when :Float
131
+ value.to_f
132
+ when :BOOLEAN
133
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
134
+ true
135
+ else
136
+ false
137
+ end
138
+ when :Object
139
+ # generic object (usually a Hash), return directly
140
+ value
141
+ when /\AArray<(?<inner_type>.+)>\z/
142
+ inner_type = Regexp.last_match[:inner_type]
143
+ value.map { |v| _deserialize(inner_type, v) }
144
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
145
+ k_type = Regexp.last_match[:k_type]
146
+ v_type = Regexp.last_match[:v_type]
147
+ {}.tap do |hash|
148
+ value.each do |k, v|
149
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
150
+ end
151
+ end
152
+ else # model
153
+ temp_model = BudgeaClient.const_get(type).new
154
+ temp_model.build_from_hash(value)
155
+ end
156
+ end
157
+
158
+ # Returns the string representation of the object
159
+ # @return [String] String presentation of the object
160
+ def to_s
161
+ to_hash.to_s
162
+ end
163
+
164
+ # to_body is an alias to to_hash (backward compatibility)
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_body
167
+ to_hash
168
+ end
169
+
170
+ # Returns the object in the form of hash
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_hash
173
+ hash = {}
174
+ self.class.attribute_map.each_pair do |attr, param|
175
+ value = self.send(attr)
176
+ next if value.nil?
177
+ hash[param] = _to_hash(value)
178
+ end
179
+ hash
180
+ end
181
+
182
+ # Outputs non-array value in the form of hash
183
+ # For object, use to_hash. Otherwise, just return the value
184
+ # @param [Object] value Any valid value
185
+ # @return [Hash] Returns the value in the form of hash
186
+ def _to_hash(value)
187
+ if value.is_a?(Array)
188
+ value.compact.map { |v| _to_hash(v) }
189
+ elsif value.is_a?(Hash)
190
+ {}.tap do |hash|
191
+ value.each { |k, v| hash[k] = _to_hash(v) }
192
+ end
193
+ elsif value.respond_to? :to_hash
194
+ value.to_hash
195
+ else
196
+ value
197
+ end
198
+ end
199
+ end
200
+ end