wallee-ruby-sdk 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +21 -11
  3. data/lib/wallee-ruby-sdk/models/abstract_debt_collection_case_update.rb +270 -0
  4. data/lib/wallee-ruby-sdk/models/abstract_payment_link_update.rb +302 -0
  5. data/lib/wallee-ruby-sdk/models/abstract_subscription_affiliate_update.rb +230 -0
  6. data/lib/wallee-ruby-sdk/models/abstract_transaction_pending.rb +14 -4
  7. data/lib/wallee-ruby-sdk/models/criteria_operator.rb +1 -0
  8. data/lib/wallee-ruby-sdk/models/debt_collection_case.rb +502 -0
  9. data/lib/wallee-ruby-sdk/models/debt_collection_case_create.rb +310 -0
  10. data/lib/wallee-ruby-sdk/models/debt_collection_case_document.rb +300 -0
  11. data/lib/wallee-ruby-sdk/models/debt_collection_case_source.rb +232 -0
  12. data/lib/wallee-ruby-sdk/models/debt_collection_case_state.rb +48 -0
  13. data/lib/wallee-ruby-sdk/models/debt_collection_case_update.rb +300 -0
  14. data/lib/wallee-ruby-sdk/models/debt_collection_environment.rb +43 -0
  15. data/lib/wallee-ruby-sdk/models/debt_collection_receipt.rb +288 -0
  16. data/lib/wallee-ruby-sdk/models/debt_collection_receipt_source.rb +222 -0
  17. data/lib/wallee-ruby-sdk/models/debt_collector.rb +222 -0
  18. data/lib/wallee-ruby-sdk/models/debt_collector_condition.rb +258 -0
  19. data/lib/wallee-ruby-sdk/models/debt_collector_condition_type.rb +222 -0
  20. data/lib/wallee-ruby-sdk/models/debt_collector_configuration.rb +302 -0
  21. data/lib/wallee-ruby-sdk/models/document_template_type.rb +1 -11
  22. data/lib/wallee-ruby-sdk/models/entity_export_request.rb +215 -0
  23. data/lib/wallee-ruby-sdk/models/entity_query.rb +1 -1
  24. data/lib/wallee-ruby-sdk/models/entity_query_order_by.rb +10 -0
  25. data/lib/wallee-ruby-sdk/models/environment.rb +43 -0
  26. data/lib/wallee-ruby-sdk/models/metric_usage.rb +232 -0
  27. data/lib/wallee-ruby-sdk/models/payment_connector.rb +23 -1
  28. data/lib/wallee-ruby-sdk/models/payment_contract.rb +338 -0
  29. data/lib/wallee-ruby-sdk/models/payment_contract_state.rb +46 -0
  30. data/lib/wallee-ruby-sdk/models/payment_contract_type.rb +232 -0
  31. data/lib/wallee-ruby-sdk/models/payment_link.rb +382 -0
  32. data/lib/wallee-ruby-sdk/models/payment_link_active.rb +342 -0
  33. data/lib/wallee-ruby-sdk/models/payment_link_create.rb +337 -0
  34. data/lib/wallee-ruby-sdk/models/payment_link_protection_mode.rb +43 -0
  35. data/lib/wallee-ruby-sdk/models/payment_link_update.rb +332 -0
  36. data/lib/wallee-ruby-sdk/models/payment_method.rb +13 -1
  37. data/lib/wallee-ruby-sdk/models/payment_processor_configuration.rb +11 -1
  38. data/lib/wallee-ruby-sdk/models/refund.rb +11 -1
  39. data/lib/wallee-ruby-sdk/models/rest_address_format.rb +234 -0
  40. data/lib/wallee-ruby-sdk/models/rest_address_format_field.rb +51 -0
  41. data/lib/wallee-ruby-sdk/models/rest_country.rb +11 -1
  42. data/lib/wallee-ruby-sdk/models/subscription.rb +11 -1
  43. data/lib/wallee-ruby-sdk/models/subscription_affiliate.rb +290 -0
  44. data/lib/wallee-ruby-sdk/models/subscription_affiliate_create.rb +255 -0
  45. data/lib/wallee-ruby-sdk/models/subscription_affiliate_deleted.rb +290 -0
  46. data/lib/wallee-ruby-sdk/models/subscription_affiliate_deleting.rb +290 -0
  47. data/lib/wallee-ruby-sdk/models/subscription_affiliate_inactive.rb +260 -0
  48. data/lib/wallee-ruby-sdk/models/subscription_affiliate_update.rb +260 -0
  49. data/lib/wallee-ruby-sdk/models/subscription_change_request.rb +2 -2
  50. data/lib/wallee-ruby-sdk/models/subscription_create_request.rb +2 -2
  51. data/lib/wallee-ruby-sdk/models/subscription_pending.rb +11 -1
  52. data/lib/wallee-ruby-sdk/models/tokenizationn_mode.rb +44 -0
  53. data/lib/wallee-ruby-sdk/models/transaction.rb +63 -3
  54. data/lib/wallee-ruby-sdk/models/transaction_create.rb +41 -1
  55. data/lib/wallee-ruby-sdk/models/transaction_environment_selection_strategy.rb +43 -0
  56. data/lib/wallee-ruby-sdk/models/transaction_invoice.rb +11 -1
  57. data/lib/wallee-ruby-sdk/models/transaction_pending.rb +11 -1
  58. data/lib/wallee-ruby-sdk/models/unencrypted_card_data.rb +228 -0
  59. data/lib/wallee-ruby-sdk/models/unencrypted_card_data_create.rb +233 -0
  60. data/lib/wallee-ruby-sdk/models/webhook_listener_entity.rb +1 -11
  61. data/lib/wallee-ruby-sdk/services/account_service_api.rb +2 -2
  62. data/lib/wallee-ruby-sdk/services/application_user_service_api.rb +2 -2
  63. data/lib/wallee-ruby-sdk/services/card_processing_service_api.rb +176 -0
  64. data/lib/wallee-ruby-sdk/services/charge_attempt_service_api.rb +2 -2
  65. data/lib/wallee-ruby-sdk/services/charge_flow_level_service_api.rb +4 -4
  66. data/lib/wallee-ruby-sdk/services/charge_flow_service_api.rb +6 -6
  67. data/lib/wallee-ruby-sdk/services/condition_type_service_api.rb +4 -4
  68. data/lib/wallee-ruby-sdk/services/country_service_api.rb +2 -2
  69. data/lib/wallee-ruby-sdk/services/country_state_service_api.rb +4 -4
  70. data/lib/wallee-ruby-sdk/services/currency_service_api.rb +2 -2
  71. data/lib/wallee-ruby-sdk/services/debt_collection_case_service_api.rb +800 -0
  72. data/lib/wallee-ruby-sdk/services/debt_collector_configuration_service_api.rb +217 -0
  73. data/lib/wallee-ruby-sdk/services/debt_collector_service_api.rb +143 -0
  74. data/lib/wallee-ruby-sdk/services/delivery_indication_service_api.rb +6 -6
  75. data/lib/wallee-ruby-sdk/services/document_template_service_api.rb +2 -2
  76. data/lib/wallee-ruby-sdk/services/document_template_type_service_api.rb +4 -4
  77. data/lib/wallee-ruby-sdk/services/human_user_service_api.rb +59 -2
  78. data/lib/wallee-ruby-sdk/services/installment_payment_service_api.rb +4 -4
  79. data/lib/wallee-ruby-sdk/services/installment_payment_slice_service_api.rb +2 -2
  80. data/lib/wallee-ruby-sdk/services/installment_plan_calculation_service_api.rb +2 -2
  81. data/lib/wallee-ruby-sdk/services/installment_plan_configuration_service_api.rb +2 -2
  82. data/lib/wallee-ruby-sdk/services/installment_plan_slice_configuration_service_api.rb +2 -2
  83. data/lib/wallee-ruby-sdk/services/label_description_group_service_api.rb +4 -4
  84. data/lib/wallee-ruby-sdk/services/label_description_service_api.rb +4 -4
  85. data/lib/wallee-ruby-sdk/services/language_service_api.rb +2 -2
  86. data/lib/wallee-ruby-sdk/services/legal_organization_form_service_api.rb +201 -0
  87. data/lib/wallee-ruby-sdk/services/manual_task_service_api.rb +2 -2
  88. data/lib/wallee-ruby-sdk/services/mertic_usage_service_api.rb +100 -0
  89. data/lib/wallee-ruby-sdk/services/payment_connector_configuration_service_api.rb +2 -2
  90. data/lib/wallee-ruby-sdk/services/payment_connector_service_api.rb +4 -4
  91. data/lib/wallee-ruby-sdk/services/payment_link_service_api.rb +402 -0
  92. data/lib/wallee-ruby-sdk/services/payment_method_configuration_service_api.rb +2 -2
  93. data/lib/wallee-ruby-sdk/services/payment_method_service_api.rb +4 -4
  94. data/lib/wallee-ruby-sdk/services/payment_processor_configuration_service_api.rb +2 -2
  95. data/lib/wallee-ruby-sdk/services/payment_processor_service_api.rb +4 -4
  96. data/lib/wallee-ruby-sdk/services/permission_service_api.rb +4 -4
  97. data/lib/wallee-ruby-sdk/services/refund_service_api.rb +10 -10
  98. data/lib/wallee-ruby-sdk/services/space_service_api.rb +2 -2
  99. data/lib/wallee-ruby-sdk/services/static_value_service_api.rb +4 -4
  100. data/lib/wallee-ruby-sdk/services/subscriber_service_api.rb +2 -2
  101. data/lib/wallee-ruby-sdk/services/subscription_affiliate_service_api.rb +402 -0
  102. data/lib/wallee-ruby-sdk/services/subscription_charge_service_api.rb +4 -4
  103. data/lib/wallee-ruby-sdk/services/subscription_ledger_entry_service_api.rb +2 -2
  104. data/lib/wallee-ruby-sdk/services/subscription_metric_service_api.rb +2 -2
  105. data/lib/wallee-ruby-sdk/services/subscription_metric_usage_service_api.rb +2 -2
  106. data/lib/wallee-ruby-sdk/services/subscription_period_bill_service_api.rb +2 -2
  107. data/lib/wallee-ruby-sdk/services/subscription_product_component_group_service_api.rb +2 -2
  108. data/lib/wallee-ruby-sdk/services/subscription_product_component_service_api.rb +2 -2
  109. data/lib/wallee-ruby-sdk/services/subscription_product_fee_tier_service_api.rb +2 -2
  110. data/lib/wallee-ruby-sdk/services/subscription_product_metered_fee_service_api.rb +2 -2
  111. data/lib/wallee-ruby-sdk/services/subscription_product_period_fee_service_api.rb +2 -2
  112. data/lib/wallee-ruby-sdk/services/subscription_product_retirement_service_api.rb +2 -2
  113. data/lib/wallee-ruby-sdk/services/subscription_product_service_api.rb +2 -2
  114. data/lib/wallee-ruby-sdk/services/subscription_product_setup_fee_service_api.rb +2 -2
  115. data/lib/wallee-ruby-sdk/services/subscription_product_version_retirement_service_api.rb +2 -2
  116. data/lib/wallee-ruby-sdk/services/subscription_product_version_service_api.rb +2 -2
  117. data/lib/wallee-ruby-sdk/services/subscription_service_api.rb +12 -12
  118. data/lib/wallee-ruby-sdk/services/subscription_suspension_service_api.rb +2 -2
  119. data/lib/wallee-ruby-sdk/services/subscription_version_service_api.rb +2 -2
  120. data/lib/wallee-ruby-sdk/services/token_service_api.rb +2 -2
  121. data/lib/wallee-ruby-sdk/services/token_version_service_api.rb +4 -4
  122. data/lib/wallee-ruby-sdk/services/transaction_completion_service_api.rb +6 -6
  123. data/lib/wallee-ruby-sdk/services/transaction_invoice_service_api.rb +6 -6
  124. data/lib/wallee-ruby-sdk/services/transaction_service_api.rb +143 -18
  125. data/lib/wallee-ruby-sdk/services/transaction_void_service_api.rb +6 -6
  126. data/lib/wallee-ruby-sdk/services/user_account_role_service_api.rb +6 -6
  127. data/lib/wallee-ruby-sdk/services/user_space_role_service_api.rb +9 -9
  128. data/lib/wallee-ruby-sdk/services/webhook_listener_service_api.rb +2 -2
  129. data/lib/wallee-ruby-sdk/services/webhook_url_service_api.rb +2 -2
  130. data/lib/wallee-ruby-sdk/version.rb +1 -1
  131. data/lib/wallee-ruby-sdk.rb +47 -0
  132. metadata +50 -3
@@ -0,0 +1,290 @@
1
+ =begin
2
+ Wallee API: 1.0.0
3
+
4
+ The wallee API allows an easy interaction with the wallee web service.
5
+
6
+
7
+
8
+ Licensed under the Apache License, Version 2.0 (the "License");
9
+ you may not use this file except in compliance with the License.
10
+ You may obtain a copy of the License at
11
+
12
+ http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ Unless required by applicable law or agreed to in writing, software
15
+ distributed under the License is distributed on an "AS IS" BASIS,
16
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ See the License for the specific language governing permissions and
18
+ limitations under the License.
19
+
20
+ =end
21
+
22
+ require 'date'
23
+
24
+ module Wallee
25
+ #
26
+ class SubscriptionAffiliateDeleting
27
+ # The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.
28
+ attr_accessor :external_id
29
+
30
+ # The ID is the primary key of the entity. The ID identifies the entity uniquely.
31
+ attr_accessor :id
32
+
33
+ #
34
+ attr_accessor :language
35
+
36
+ # The linked space id holds the ID of the space to which the entity belongs to.
37
+ attr_accessor :linked_space_id
38
+
39
+ # Meta data allow to store additional data along the object.
40
+ attr_accessor :meta_data
41
+
42
+ #
43
+ attr_accessor :name
44
+
45
+ # The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed.
46
+ attr_accessor :planned_purge_date
47
+
48
+ #
49
+ attr_accessor :reference
50
+
51
+ #
52
+ attr_accessor :state
53
+
54
+ # The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
55
+ attr_accessor :version
56
+
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'external_id' => :'externalId',
62
+ :'id' => :'id',
63
+ :'language' => :'language',
64
+ :'linked_space_id' => :'linkedSpaceId',
65
+ :'meta_data' => :'metaData',
66
+ :'name' => :'name',
67
+ :'planned_purge_date' => :'plannedPurgeDate',
68
+ :'reference' => :'reference',
69
+ :'state' => :'state',
70
+ :'version' => :'version'
71
+ }
72
+ end
73
+
74
+ # Attribute type mapping.
75
+ def self.swagger_types
76
+ {
77
+ :'external_id' => :'String',
78
+ :'id' => :'Integer',
79
+ :'language' => :'String',
80
+ :'linked_space_id' => :'Integer',
81
+ :'meta_data' => :'Hash<String, String>',
82
+ :'name' => :'String',
83
+ :'planned_purge_date' => :'DateTime',
84
+ :'reference' => :'String',
85
+ :'state' => :'CreationEntityState',
86
+ :'version' => :'Integer'
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?(:'externalId')
99
+ self.external_id = attributes[:'externalId']
100
+ end
101
+
102
+ if attributes.has_key?(:'id')
103
+ self.id = attributes[:'id']
104
+ end
105
+
106
+ if attributes.has_key?(:'language')
107
+ self.language = attributes[:'language']
108
+ end
109
+
110
+ if attributes.has_key?(:'linkedSpaceId')
111
+ self.linked_space_id = attributes[:'linkedSpaceId']
112
+ end
113
+
114
+ if attributes.has_key?(:'metaData')
115
+ if (value = attributes[:'metaData']).is_a?(Array)
116
+ self.meta_data = value
117
+ end
118
+ end
119
+
120
+ if attributes.has_key?(:'name')
121
+ self.name = attributes[:'name']
122
+ end
123
+
124
+ if attributes.has_key?(:'plannedPurgeDate')
125
+ self.planned_purge_date = attributes[:'plannedPurgeDate']
126
+ end
127
+
128
+ if attributes.has_key?(:'reference')
129
+ self.reference = attributes[:'reference']
130
+ end
131
+
132
+ if attributes.has_key?(:'state')
133
+ self.state = attributes[:'state']
134
+ end
135
+
136
+ if attributes.has_key?(:'version')
137
+ self.version = attributes[:'version']
138
+ end
139
+
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properies with the reasons
144
+ def list_invalid_properties
145
+ invalid_properties = Array.new
146
+ return invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ return true
153
+ end
154
+
155
+ # Checks equality by comparing each attribute.
156
+ # @param [Object] Object to be compared
157
+ def ==(o)
158
+ return true if self.equal?(o)
159
+ self.class == o.class &&
160
+ external_id == o.external_id &&
161
+ id == o.id &&
162
+ language == o.language &&
163
+ linked_space_id == o.linked_space_id &&
164
+ meta_data == o.meta_data &&
165
+ name == o.name &&
166
+ planned_purge_date == o.planned_purge_date &&
167
+ reference == o.reference &&
168
+ state == o.state &&
169
+ version == o.version
170
+ end
171
+
172
+ # @see the `==` method
173
+ # @param [Object] Object to be compared
174
+ def eql?(o)
175
+ self == o
176
+ end
177
+
178
+ # Calculates hash code according to all attributes.
179
+ # @return [Fixnum] Hash code
180
+ def hash
181
+ [external_id, id, language, linked_space_id, meta_data, name, planned_purge_date, reference, state, version].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+ self.class.swagger_types.each_pair do |key, type|
190
+ if type =~ /\AArray<(.*)>/i
191
+ # check to ensure the input is an array given that the the attribute
192
+ # is documented as an array but the input is not
193
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
194
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
195
+ end
196
+ elsif !attributes[self.class.attribute_map[key]].nil?
197
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
198
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
199
+ end
200
+
201
+ self
202
+ end
203
+
204
+ # Deserializes the data based on type
205
+ # @param string type Data type
206
+ # @param string value Value to be deserialized
207
+ # @return [Object] Deserialized data
208
+ def _deserialize(type, value)
209
+ case type.to_sym
210
+ when :DateTime
211
+ DateTime.parse(value)
212
+ when :Date
213
+ Date.parse(value)
214
+ when :String
215
+ value.to_s
216
+ when :Integer
217
+ value.to_i
218
+ when :Float
219
+ value.to_f
220
+ when :BOOLEAN
221
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
222
+ true
223
+ else
224
+ false
225
+ end
226
+ when :Object
227
+ # generic object (usually a Hash), return directly
228
+ value
229
+ when /\AArray<(?<inner_type>.+)>\z/
230
+ inner_type = Regexp.last_match[:inner_type]
231
+ value.map { |v| _deserialize(inner_type, v) }
232
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
233
+ k_type = Regexp.last_match[:k_type]
234
+ v_type = Regexp.last_match[:v_type]
235
+ {}.tap do |hash|
236
+ value.each do |k, v|
237
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
238
+ end
239
+ end
240
+ else # model
241
+ temp_model = Wallee.const_get(type).new
242
+ temp_model.build_from_hash(value)
243
+ end
244
+ end
245
+
246
+ # Returns the string representation of the object
247
+ # @return [String] String presentation of the object
248
+ def to_s
249
+ to_hash.to_s
250
+ end
251
+
252
+ # to_body is an alias to to_hash (backward compatibility)
253
+ # @return [Hash] Returns the object in the form of hash
254
+ def to_body
255
+ to_hash
256
+ end
257
+
258
+ # Returns the object in the form of hash
259
+ # @return [Hash] Returns the object in the form of hash
260
+ def to_hash
261
+ hash = {}
262
+ self.class.attribute_map.each_pair do |attr, param|
263
+ value = self.send(attr)
264
+ next if value.nil?
265
+ hash[param] = _to_hash(value)
266
+ end
267
+ hash
268
+ end
269
+
270
+ # Outputs non-array value in the form of hash
271
+ # For object, use to_hash. Otherwise, just return the value
272
+ # @param [Object] value Any valid value
273
+ # @return [Hash] Returns the value in the form of hash
274
+ def _to_hash(value)
275
+ if value.is_a?(Array)
276
+ value.compact.map{ |v| _to_hash(v) }
277
+ elsif value.is_a?(Hash)
278
+ {}.tap do |hash|
279
+ value.each { |k, v| hash[k] = _to_hash(v) }
280
+ end
281
+ elsif value.respond_to? :to_hash
282
+ value.to_hash
283
+ else
284
+ value
285
+ end
286
+ end
287
+
288
+ end
289
+
290
+ end
@@ -0,0 +1,260 @@
1
+ =begin
2
+ Wallee API: 1.0.0
3
+
4
+ The wallee API allows an easy interaction with the wallee web service.
5
+
6
+
7
+
8
+ Licensed under the Apache License, Version 2.0 (the "License");
9
+ you may not use this file except in compliance with the License.
10
+ You may obtain a copy of the License at
11
+
12
+ http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ Unless required by applicable law or agreed to in writing, software
15
+ distributed under the License is distributed on an "AS IS" BASIS,
16
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ See the License for the specific language governing permissions and
18
+ limitations under the License.
19
+
20
+ =end
21
+
22
+ require 'date'
23
+
24
+ module Wallee
25
+ #
26
+ class SubscriptionAffiliateInactive
27
+ # The ID is the primary key of the entity. The ID identifies the entity uniquely.
28
+ attr_accessor :id
29
+
30
+ # The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
31
+ attr_accessor :version
32
+
33
+ #
34
+ attr_accessor :language
35
+
36
+ # Meta data allow to store additional data along the object.
37
+ attr_accessor :meta_data
38
+
39
+ #
40
+ attr_accessor :name
41
+
42
+ #
43
+ attr_accessor :state
44
+
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'id' => :'id',
50
+ :'version' => :'version',
51
+ :'language' => :'language',
52
+ :'meta_data' => :'metaData',
53
+ :'name' => :'name',
54
+ :'state' => :'state'
55
+ }
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.swagger_types
60
+ {
61
+ :'id' => :'Integer',
62
+ :'version' => :'Integer',
63
+ :'language' => :'String',
64
+ :'meta_data' => :'Hash<String, String>',
65
+ :'name' => :'String',
66
+ :'state' => :'CreationEntityState'
67
+ }
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ return unless attributes.is_a?(Hash)
74
+
75
+ # convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
77
+
78
+ if attributes.has_key?(:'id')
79
+ self.id = attributes[:'id']
80
+ end
81
+
82
+ if attributes.has_key?(:'version')
83
+ self.version = attributes[:'version']
84
+ end
85
+
86
+ if attributes.has_key?(:'language')
87
+ self.language = attributes[:'language']
88
+ end
89
+
90
+ if attributes.has_key?(:'metaData')
91
+ if (value = attributes[:'metaData']).is_a?(Array)
92
+ self.meta_data = value
93
+ end
94
+ end
95
+
96
+ if attributes.has_key?(:'name')
97
+ self.name = attributes[:'name']
98
+ end
99
+
100
+ if attributes.has_key?(:'state')
101
+ self.state = attributes[:'state']
102
+ end
103
+
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properies with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
110
+ if @id.nil?
111
+ invalid_properties.push("invalid value for 'id', id cannot be nil.")
112
+ end
113
+
114
+ if @version.nil?
115
+ invalid_properties.push("invalid value for 'version', version cannot be nil.")
116
+ end
117
+
118
+ return invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ return false if @id.nil?
125
+ return false if @version.nil?
126
+ return true
127
+ end
128
+
129
+ # Checks equality by comparing each attribute.
130
+ # @param [Object] Object to be compared
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ id == o.id &&
135
+ version == o.version &&
136
+ language == o.language &&
137
+ meta_data == o.meta_data &&
138
+ name == o.name &&
139
+ state == o.state
140
+ end
141
+
142
+ # @see the `==` method
143
+ # @param [Object] Object to be compared
144
+ def eql?(o)
145
+ self == o
146
+ end
147
+
148
+ # Calculates hash code according to all attributes.
149
+ # @return [Fixnum] Hash code
150
+ def hash
151
+ [id, version, language, meta_data, name, state].hash
152
+ end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def build_from_hash(attributes)
158
+ return nil unless attributes.is_a?(Hash)
159
+ self.class.swagger_types.each_pair do |key, type|
160
+ if type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
164
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
165
+ end
166
+ elsif !attributes[self.class.attribute_map[key]].nil?
167
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
168
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
169
+ end
170
+
171
+ self
172
+ end
173
+
174
+ # Deserializes the data based on type
175
+ # @param string type Data type
176
+ # @param string value Value to be deserialized
177
+ # @return [Object] Deserialized data
178
+ def _deserialize(type, value)
179
+ case type.to_sym
180
+ when :DateTime
181
+ DateTime.parse(value)
182
+ when :Date
183
+ Date.parse(value)
184
+ when :String
185
+ value.to_s
186
+ when :Integer
187
+ value.to_i
188
+ when :Float
189
+ value.to_f
190
+ when :BOOLEAN
191
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
+ true
193
+ else
194
+ false
195
+ end
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ else # model
211
+ temp_model = Wallee.const_get(type).new
212
+ temp_model.build_from_hash(value)
213
+ end
214
+ end
215
+
216
+ # Returns the string representation of the object
217
+ # @return [String] String presentation of the object
218
+ def to_s
219
+ to_hash.to_s
220
+ end
221
+
222
+ # to_body is an alias to to_hash (backward compatibility)
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_body
225
+ to_hash
226
+ end
227
+
228
+ # Returns the object in the form of hash
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_hash
231
+ hash = {}
232
+ self.class.attribute_map.each_pair do |attr, param|
233
+ value = self.send(attr)
234
+ next if value.nil?
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map{ |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+
258
+ end
259
+
260
+ end