storecove 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/lib/storecove/api/invoice_submissions_api.rb +148 -0
  3. data/lib/storecove/api/shop_account_requests_api.rb +323 -0
  4. data/lib/storecove/api/shop_accounts_api.rb +376 -0
  5. data/lib/storecove/api/shops_api.rb +87 -0
  6. data/lib/storecove/api_client.rb +379 -0
  7. data/lib/storecove/api_error.rb +47 -0
  8. data/lib/storecove/configuration.rb +214 -0
  9. data/lib/storecove/models/accounting_cost_code.rb +298 -0
  10. data/lib/storecove/models/accounting_customer_party.rb +210 -0
  11. data/lib/storecove/models/country.rb +280 -0
  12. data/lib/storecove/models/currency_code.rb +209 -0
  13. data/lib/storecove/models/error_model.rb +208 -0
  14. data/lib/storecove/models/invoice_line.rb +327 -0
  15. data/lib/storecove/models/invoice_line_tax.rb +222 -0
  16. data/lib/storecove/models/invoice_recipient.rb +227 -0
  17. data/lib/storecove/models/invoice_recipient_preflight.rb +211 -0
  18. data/lib/storecove/models/invoice_submission.rb +321 -0
  19. data/lib/storecove/models/invoice_submission_invoice.rb +506 -0
  20. data/lib/storecove/models/invoice_submission_result.rb +200 -0
  21. data/lib/storecove/models/legal_entity.rb +264 -0
  22. data/lib/storecove/models/legal_entity_identifier.rb +217 -0
  23. data/lib/storecove/models/logos.rb +217 -0
  24. data/lib/storecove/models/party.rb +242 -0
  25. data/lib/storecove/models/party_address.rb +331 -0
  26. data/lib/storecove/models/party_contact.rb +218 -0
  27. data/lib/storecove/models/preflight_invoice_recipient_result.rb +233 -0
  28. data/lib/storecove/models/public_identifiers.rb +190 -0
  29. data/lib/storecove/models/public_identifiers_inner.rb +258 -0
  30. data/lib/storecove/models/shop.rb +237 -0
  31. data/lib/storecove/models/shop_account.rb +270 -0
  32. data/lib/storecove/models/shop_account_input.rb +244 -0
  33. data/lib/storecove/models/shop_account_request.rb +236 -0
  34. data/lib/storecove/models/shop_account_request_input.rb +235 -0
  35. data/lib/storecove/models/shop_account_request_update.rb +226 -0
  36. data/lib/storecove/models/shop_account_update.rb +220 -0
  37. data/lib/storecove/models/swagger-codegen +2799 -0
  38. data/lib/storecove/version.rb +26 -0
  39. data/lib/storecove.rb +82 -0
  40. data/storecove.gemspec +55 -0
  41. metadata +263 -0
@@ -0,0 +1,236 @@
1
+ =begin
2
+ #Storecove API
3
+
4
+ #Storecove API
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: apisupport@storecove.nl
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module StorecoveApi
27
+
28
+ class ShopAccountRequest
29
+ attr_accessor :id
30
+
31
+ attr_accessor :username
32
+
33
+ attr_accessor :external_user_id
34
+
35
+ attr_accessor :request_name
36
+
37
+ attr_accessor :request_url
38
+
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'id' => :'id',
44
+ :'username' => :'username',
45
+ :'external_user_id' => :'external_user_id',
46
+ :'request_name' => :'request_name',
47
+ :'request_url' => :'request_url'
48
+ }
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.swagger_types
53
+ {
54
+ :'id' => :'Integer',
55
+ :'username' => :'String',
56
+ :'external_user_id' => :'String',
57
+ :'request_name' => :'String',
58
+ :'request_url' => :'String'
59
+ }
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ return unless attributes.is_a?(Hash)
66
+
67
+ # convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
69
+
70
+ if attributes.has_key?(:'id')
71
+ self.id = attributes[:'id']
72
+ end
73
+
74
+ if attributes.has_key?(:'username')
75
+ self.username = attributes[:'username']
76
+ end
77
+
78
+ if attributes.has_key?(:'external_user_id')
79
+ self.external_user_id = attributes[:'external_user_id']
80
+ end
81
+
82
+ if attributes.has_key?(:'request_name')
83
+ self.request_name = attributes[:'request_name']
84
+ end
85
+
86
+ if attributes.has_key?(:'request_url')
87
+ self.request_url = attributes[:'request_url']
88
+ end
89
+
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properies with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = Array.new
96
+ return invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ return false if @id.nil?
103
+ return true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ id == o.id &&
112
+ username == o.username &&
113
+ external_user_id == o.external_user_id &&
114
+ request_name == o.request_name &&
115
+ request_url == o.request_url
116
+ end
117
+
118
+ # @see the `==` method
119
+ # @param [Object] Object to be compared
120
+ def eql?(o)
121
+ self == o
122
+ end
123
+
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Fixnum] Hash code
126
+ def hash
127
+ [id, username, external_user_id, request_name, request_url].hash
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.swagger_types.each_pair do |key, type|
136
+ if type =~ /^Array<(.*)>/i
137
+ # check to ensure the input is an array given that the the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
140
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
141
+ end
142
+ elsif !attributes[self.class.attribute_map[key]].nil?
143
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def _deserialize(type, value)
155
+ case type.to_sym
156
+ when :DateTime
157
+ DateTime.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :BOOLEAN
167
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ temp_model = StorecoveApi.const_get(type).new
188
+ temp_model.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ next if value.nil?
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map{ |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+
234
+ end
235
+
236
+ end
@@ -0,0 +1,235 @@
1
+ =begin
2
+ #Storecove API
3
+
4
+ #Storecove API
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: apisupport@storecove.nl
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module StorecoveApi
27
+
28
+ class ShopAccountRequestInput
29
+ attr_accessor :username
30
+
31
+ attr_accessor :password
32
+
33
+ attr_accessor :external_user_id
34
+
35
+ attr_accessor :request_name
36
+
37
+ attr_accessor :request_url
38
+
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'username' => :'username',
44
+ :'password' => :'password',
45
+ :'external_user_id' => :'external_user_id',
46
+ :'request_name' => :'request_name',
47
+ :'request_url' => :'request_url'
48
+ }
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.swagger_types
53
+ {
54
+ :'username' => :'String',
55
+ :'password' => :'String',
56
+ :'external_user_id' => :'String',
57
+ :'request_name' => :'String',
58
+ :'request_url' => :'String'
59
+ }
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ return unless attributes.is_a?(Hash)
66
+
67
+ # convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
69
+
70
+ if attributes.has_key?(:'username')
71
+ self.username = attributes[:'username']
72
+ end
73
+
74
+ if attributes.has_key?(:'password')
75
+ self.password = attributes[:'password']
76
+ end
77
+
78
+ if attributes.has_key?(:'external_user_id')
79
+ self.external_user_id = attributes[:'external_user_id']
80
+ end
81
+
82
+ if attributes.has_key?(:'request_name')
83
+ self.request_name = attributes[:'request_name']
84
+ end
85
+
86
+ if attributes.has_key?(:'request_url')
87
+ self.request_url = attributes[:'request_url']
88
+ end
89
+
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properies with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = Array.new
96
+ return invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ return true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ username == o.username &&
111
+ password == o.password &&
112
+ external_user_id == o.external_user_id &&
113
+ request_name == o.request_name &&
114
+ request_url == o.request_url
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Fixnum] Hash code
125
+ def hash
126
+ [username, password, external_user_id, request_name, request_url].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ self.class.swagger_types.each_pair do |key, type|
135
+ if type =~ /^Array<(.*)>/i
136
+ # check to ensure the input is an array given that the the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :DateTime
156
+ DateTime.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :BOOLEAN
166
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ temp_model = StorecoveApi.const_get(type).new
187
+ temp_model.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ next if value.nil?
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map{ |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+
233
+ end
234
+
235
+ end
@@ -0,0 +1,226 @@
1
+ =begin
2
+ #Storecove API
3
+
4
+ #Storecove API
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: apisupport@storecove.nl
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module StorecoveApi
27
+
28
+ class ShopAccountRequestUpdate
29
+ attr_accessor :username
30
+
31
+ attr_accessor :password
32
+
33
+ attr_accessor :request_name
34
+
35
+ attr_accessor :request_url
36
+
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'username' => :'username',
42
+ :'password' => :'password',
43
+ :'request_name' => :'request_name',
44
+ :'request_url' => :'request_url'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+ :'username' => :'String',
52
+ :'password' => :'String',
53
+ :'request_name' => :'String',
54
+ :'request_url' => :'String'
55
+ }
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ return unless attributes.is_a?(Hash)
62
+
63
+ # convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
65
+
66
+ if attributes.has_key?(:'username')
67
+ self.username = attributes[:'username']
68
+ end
69
+
70
+ if attributes.has_key?(:'password')
71
+ self.password = attributes[:'password']
72
+ end
73
+
74
+ if attributes.has_key?(:'request_name')
75
+ self.request_name = attributes[:'request_name']
76
+ end
77
+
78
+ if attributes.has_key?(:'request_url')
79
+ self.request_url = attributes[:'request_url']
80
+ end
81
+
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properies with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ return invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ return true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ username == o.username &&
103
+ password == o.password &&
104
+ request_name == o.request_name &&
105
+ request_url == o.request_url
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Fixnum] Hash code
116
+ def hash
117
+ [username, password, request_name, request_url].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ self.class.swagger_types.each_pair do |key, type|
126
+ if type =~ /^Array<(.*)>/i
127
+ # check to ensure the input is an array given that the the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
130
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
135
+ end
136
+
137
+ self
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def _deserialize(type, value)
145
+ case type.to_sym
146
+ when :DateTime
147
+ DateTime.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :BOOLEAN
157
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ temp_model = StorecoveApi.const_get(type).new
178
+ temp_model.build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ next if value.nil?
201
+ hash[param] = _to_hash(value)
202
+ end
203
+ hash
204
+ end
205
+
206
+ # Outputs non-array value in the form of hash
207
+ # For object, use to_hash. Otherwise, just return the value
208
+ # @param [Object] value Any valid value
209
+ # @return [Hash] Returns the value in the form of hash
210
+ def _to_hash(value)
211
+ if value.is_a?(Array)
212
+ value.compact.map{ |v| _to_hash(v) }
213
+ elsif value.is_a?(Hash)
214
+ {}.tap do |hash|
215
+ value.each { |k, v| hash[k] = _to_hash(v) }
216
+ end
217
+ elsif value.respond_to? :to_hash
218
+ value.to_hash
219
+ else
220
+ value
221
+ end
222
+ end
223
+
224
+ end
225
+
226
+ end