storecove 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/storecove/api/invoice_submissions_api.rb +148 -0
- data/lib/storecove/api/shop_account_requests_api.rb +323 -0
- data/lib/storecove/api/shop_accounts_api.rb +376 -0
- data/lib/storecove/api/shops_api.rb +87 -0
- data/lib/storecove/api_client.rb +379 -0
- data/lib/storecove/api_error.rb +47 -0
- data/lib/storecove/configuration.rb +214 -0
- data/lib/storecove/models/accounting_cost_code.rb +298 -0
- data/lib/storecove/models/accounting_customer_party.rb +210 -0
- data/lib/storecove/models/country.rb +280 -0
- data/lib/storecove/models/currency_code.rb +209 -0
- data/lib/storecove/models/error_model.rb +208 -0
- data/lib/storecove/models/invoice_line.rb +327 -0
- data/lib/storecove/models/invoice_line_tax.rb +222 -0
- data/lib/storecove/models/invoice_recipient.rb +227 -0
- data/lib/storecove/models/invoice_recipient_preflight.rb +211 -0
- data/lib/storecove/models/invoice_submission.rb +321 -0
- data/lib/storecove/models/invoice_submission_invoice.rb +506 -0
- data/lib/storecove/models/invoice_submission_result.rb +200 -0
- data/lib/storecove/models/legal_entity.rb +264 -0
- data/lib/storecove/models/legal_entity_identifier.rb +217 -0
- data/lib/storecove/models/logos.rb +217 -0
- data/lib/storecove/models/party.rb +242 -0
- data/lib/storecove/models/party_address.rb +331 -0
- data/lib/storecove/models/party_contact.rb +218 -0
- data/lib/storecove/models/preflight_invoice_recipient_result.rb +233 -0
- data/lib/storecove/models/public_identifiers.rb +190 -0
- data/lib/storecove/models/public_identifiers_inner.rb +258 -0
- data/lib/storecove/models/shop.rb +237 -0
- data/lib/storecove/models/shop_account.rb +270 -0
- data/lib/storecove/models/shop_account_input.rb +244 -0
- data/lib/storecove/models/shop_account_request.rb +236 -0
- data/lib/storecove/models/shop_account_request_input.rb +235 -0
- data/lib/storecove/models/shop_account_request_update.rb +226 -0
- data/lib/storecove/models/shop_account_update.rb +220 -0
- data/lib/storecove/models/swagger-codegen +2799 -0
- data/lib/storecove/version.rb +26 -0
- data/lib/storecove.rb +82 -0
- data/storecove.gemspec +55 -0
- metadata +263 -0
@@ -0,0 +1,270 @@
|
|
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 ShopAccount
|
29
|
+
# The Storecove id for the ShopAccount
|
30
|
+
attr_accessor :id
|
31
|
+
|
32
|
+
# See <<_swagger_api_shopaccountinput>>.
|
33
|
+
attr_accessor :username
|
34
|
+
|
35
|
+
# See <<_swagger_api_shopaccountinput>>.
|
36
|
+
attr_accessor :external_user_id
|
37
|
+
|
38
|
+
# See <<_swagger_api_shopaccountinput>>.
|
39
|
+
attr_accessor :email
|
40
|
+
|
41
|
+
# The date from invoices will be collected. This field defaults to the first day of the month the ShopAccount was created in.
|
42
|
+
attr_accessor :from_date
|
43
|
+
|
44
|
+
# Whether or not Storecove has detected and confirmed a sign-in failure. This field is reset to false each time a ShopAccount is updated and the username or password has changed.
|
45
|
+
attr_accessor :sign_in_error_confirmed
|
46
|
+
|
47
|
+
# The date on which the sign-in error was confirmed.
|
48
|
+
attr_accessor :sign_in_error_confirmed_at
|
49
|
+
|
50
|
+
# See <<_swagger_api_shopaccountinput>>.
|
51
|
+
attr_accessor :shop
|
52
|
+
|
53
|
+
|
54
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
55
|
+
def self.attribute_map
|
56
|
+
{
|
57
|
+
:'id' => :'id',
|
58
|
+
:'username' => :'username',
|
59
|
+
:'external_user_id' => :'external_user_id',
|
60
|
+
:'email' => :'email',
|
61
|
+
:'from_date' => :'from_date',
|
62
|
+
:'sign_in_error_confirmed' => :'sign_in_error_confirmed',
|
63
|
+
:'sign_in_error_confirmed_at' => :'sign_in_error_confirmed_at',
|
64
|
+
:'shop' => :'shop'
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# Attribute type mapping.
|
69
|
+
def self.swagger_types
|
70
|
+
{
|
71
|
+
:'id' => :'Integer',
|
72
|
+
:'username' => :'String',
|
73
|
+
:'external_user_id' => :'String',
|
74
|
+
:'email' => :'String',
|
75
|
+
:'from_date' => :'Date',
|
76
|
+
:'sign_in_error_confirmed' => :'BOOLEAN',
|
77
|
+
:'sign_in_error_confirmed_at' => :'Date',
|
78
|
+
:'shop' => :'Shop'
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
# Initializes the object
|
83
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
84
|
+
def initialize(attributes = {})
|
85
|
+
return unless attributes.is_a?(Hash)
|
86
|
+
|
87
|
+
# convert string to symbol for hash key
|
88
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
89
|
+
|
90
|
+
if attributes.has_key?(:'id')
|
91
|
+
self.id = attributes[:'id']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.has_key?(:'username')
|
95
|
+
self.username = attributes[:'username']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.has_key?(:'external_user_id')
|
99
|
+
self.external_user_id = attributes[:'external_user_id']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.has_key?(:'email')
|
103
|
+
self.email = attributes[:'email']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.has_key?(:'from_date')
|
107
|
+
self.from_date = attributes[:'from_date']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.has_key?(:'sign_in_error_confirmed')
|
111
|
+
self.sign_in_error_confirmed = attributes[:'sign_in_error_confirmed']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.has_key?(:'sign_in_error_confirmed_at')
|
115
|
+
self.sign_in_error_confirmed_at = attributes[:'sign_in_error_confirmed_at']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.has_key?(:'shop')
|
119
|
+
self.shop = attributes[:'shop']
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
125
|
+
# @return Array for valid properies with the reasons
|
126
|
+
def list_invalid_properties
|
127
|
+
invalid_properties = Array.new
|
128
|
+
return invalid_properties
|
129
|
+
end
|
130
|
+
|
131
|
+
# Check to see if the all the properties in the model are valid
|
132
|
+
# @return true if the model is valid
|
133
|
+
def valid?
|
134
|
+
return true
|
135
|
+
end
|
136
|
+
|
137
|
+
# Checks equality by comparing each attribute.
|
138
|
+
# @param [Object] Object to be compared
|
139
|
+
def ==(o)
|
140
|
+
return true if self.equal?(o)
|
141
|
+
self.class == o.class &&
|
142
|
+
id == o.id &&
|
143
|
+
username == o.username &&
|
144
|
+
external_user_id == o.external_user_id &&
|
145
|
+
email == o.email &&
|
146
|
+
from_date == o.from_date &&
|
147
|
+
sign_in_error_confirmed == o.sign_in_error_confirmed &&
|
148
|
+
sign_in_error_confirmed_at == o.sign_in_error_confirmed_at &&
|
149
|
+
shop == o.shop
|
150
|
+
end
|
151
|
+
|
152
|
+
# @see the `==` method
|
153
|
+
# @param [Object] Object to be compared
|
154
|
+
def eql?(o)
|
155
|
+
self == o
|
156
|
+
end
|
157
|
+
|
158
|
+
# Calculates hash code according to all attributes.
|
159
|
+
# @return [Fixnum] Hash code
|
160
|
+
def hash
|
161
|
+
[id, username, external_user_id, email, from_date, sign_in_error_confirmed, sign_in_error_confirmed_at, shop].hash
|
162
|
+
end
|
163
|
+
|
164
|
+
# Builds the object from hash
|
165
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
166
|
+
# @return [Object] Returns the model itself
|
167
|
+
def build_from_hash(attributes)
|
168
|
+
return nil unless attributes.is_a?(Hash)
|
169
|
+
self.class.swagger_types.each_pair do |key, type|
|
170
|
+
if type =~ /^Array<(.*)>/i
|
171
|
+
# check to ensure the input is an array given that the the attribute
|
172
|
+
# is documented as an array but the input is not
|
173
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
174
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
175
|
+
end
|
176
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
177
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
178
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
179
|
+
end
|
180
|
+
|
181
|
+
self
|
182
|
+
end
|
183
|
+
|
184
|
+
# Deserializes the data based on type
|
185
|
+
# @param string type Data type
|
186
|
+
# @param string value Value to be deserialized
|
187
|
+
# @return [Object] Deserialized data
|
188
|
+
def _deserialize(type, value)
|
189
|
+
case type.to_sym
|
190
|
+
when :DateTime
|
191
|
+
DateTime.parse(value)
|
192
|
+
when :Date
|
193
|
+
Date.parse(value)
|
194
|
+
when :String
|
195
|
+
value.to_s
|
196
|
+
when :Integer
|
197
|
+
value.to_i
|
198
|
+
when :Float
|
199
|
+
value.to_f
|
200
|
+
when :BOOLEAN
|
201
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
202
|
+
true
|
203
|
+
else
|
204
|
+
false
|
205
|
+
end
|
206
|
+
when :Object
|
207
|
+
# generic object (usually a Hash), return directly
|
208
|
+
value
|
209
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
210
|
+
inner_type = Regexp.last_match[:inner_type]
|
211
|
+
value.map { |v| _deserialize(inner_type, v) }
|
212
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
213
|
+
k_type = Regexp.last_match[:k_type]
|
214
|
+
v_type = Regexp.last_match[:v_type]
|
215
|
+
{}.tap do |hash|
|
216
|
+
value.each do |k, v|
|
217
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
else # model
|
221
|
+
temp_model = StorecoveApi.const_get(type).new
|
222
|
+
temp_model.build_from_hash(value)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
# Returns the string representation of the object
|
227
|
+
# @return [String] String presentation of the object
|
228
|
+
def to_s
|
229
|
+
to_hash.to_s
|
230
|
+
end
|
231
|
+
|
232
|
+
# to_body is an alias to to_hash (backward compatibility)
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_body
|
235
|
+
to_hash
|
236
|
+
end
|
237
|
+
|
238
|
+
# Returns the object in the form of hash
|
239
|
+
# @return [Hash] Returns the object in the form of hash
|
240
|
+
def to_hash
|
241
|
+
hash = {}
|
242
|
+
self.class.attribute_map.each_pair do |attr, param|
|
243
|
+
value = self.send(attr)
|
244
|
+
next if value.nil?
|
245
|
+
hash[param] = _to_hash(value)
|
246
|
+
end
|
247
|
+
hash
|
248
|
+
end
|
249
|
+
|
250
|
+
# Outputs non-array value in the form of hash
|
251
|
+
# For object, use to_hash. Otherwise, just return the value
|
252
|
+
# @param [Object] value Any valid value
|
253
|
+
# @return [Hash] Returns the value in the form of hash
|
254
|
+
def _to_hash(value)
|
255
|
+
if value.is_a?(Array)
|
256
|
+
value.compact.map{ |v| _to_hash(v) }
|
257
|
+
elsif value.is_a?(Hash)
|
258
|
+
{}.tap do |hash|
|
259
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
260
|
+
end
|
261
|
+
elsif value.respond_to? :to_hash
|
262
|
+
value.to_hash
|
263
|
+
else
|
264
|
+
value
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
end
|
269
|
+
|
270
|
+
end
|
@@ -0,0 +1,244 @@
|
|
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 ShopAccountInput
|
29
|
+
# The username for the account. The username needs to be unique in combination with the shop_id.
|
30
|
+
attr_accessor :username
|
31
|
+
|
32
|
+
# The password for the account.
|
33
|
+
attr_accessor :password
|
34
|
+
|
35
|
+
# The _external_user_id_ is what identifies the entity for which you create this ShopAccount. This could be a user, however, if your users can manage multiple organizations/administrations, then it is a better idea to put the organization/administration identifier in this field, because the _external_user_id_ groups the ShopAccounts into a set that all deliver their invoices to the same destination (typically an email address).
|
36
|
+
attr_accessor :external_user_id
|
37
|
+
|
38
|
+
# This is email address determines where the invoices for all ShopAccounts in the same _external_user_id_ group are sent. Each time you create or update a ShopAccount for an _external_user_id_ and also provide __email__, the email destination for all the ShopAccounts in the _external_user_id_ group are updated at the same time. We suggest you provide an immutable email address. If your user can change the email address to which the invoices are to be sent, then you will need to do an update for one of the ShopAccounts for that user in order for Storecove to start using the new email address. Note that this field is mandatory for the first ShopAccount that you create for an entity.
|
39
|
+
attr_accessor :email
|
40
|
+
|
41
|
+
# The id of the Shop the account is for.
|
42
|
+
attr_accessor :shop_id
|
43
|
+
|
44
|
+
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
46
|
+
def self.attribute_map
|
47
|
+
{
|
48
|
+
:'username' => :'username',
|
49
|
+
:'password' => :'password',
|
50
|
+
:'external_user_id' => :'external_user_id',
|
51
|
+
:'email' => :'email',
|
52
|
+
:'shop_id' => :'shop_id'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute type mapping.
|
57
|
+
def self.swagger_types
|
58
|
+
{
|
59
|
+
:'username' => :'String',
|
60
|
+
:'password' => :'String',
|
61
|
+
:'external_user_id' => :'String',
|
62
|
+
:'email' => :'String',
|
63
|
+
:'shop_id' => :'Integer'
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# Initializes the object
|
68
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
69
|
+
def initialize(attributes = {})
|
70
|
+
return unless attributes.is_a?(Hash)
|
71
|
+
|
72
|
+
# convert string to symbol for hash key
|
73
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
74
|
+
|
75
|
+
if attributes.has_key?(:'username')
|
76
|
+
self.username = attributes[:'username']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.has_key?(:'password')
|
80
|
+
self.password = attributes[:'password']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.has_key?(:'external_user_id')
|
84
|
+
self.external_user_id = attributes[:'external_user_id']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.has_key?(:'email')
|
88
|
+
self.email = attributes[:'email']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.has_key?(:'shop_id')
|
92
|
+
self.shop_id = attributes[:'shop_id']
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
98
|
+
# @return Array for valid properies with the reasons
|
99
|
+
def list_invalid_properties
|
100
|
+
invalid_properties = Array.new
|
101
|
+
return invalid_properties
|
102
|
+
end
|
103
|
+
|
104
|
+
# Check to see if the all the properties in the model are valid
|
105
|
+
# @return true if the model is valid
|
106
|
+
def valid?
|
107
|
+
return false if @username.nil?
|
108
|
+
return false if @password.nil?
|
109
|
+
return false if @external_user_id.nil?
|
110
|
+
return false if @shop_id.nil?
|
111
|
+
return true
|
112
|
+
end
|
113
|
+
|
114
|
+
# Checks equality by comparing each attribute.
|
115
|
+
# @param [Object] Object to be compared
|
116
|
+
def ==(o)
|
117
|
+
return true if self.equal?(o)
|
118
|
+
self.class == o.class &&
|
119
|
+
username == o.username &&
|
120
|
+
password == o.password &&
|
121
|
+
external_user_id == o.external_user_id &&
|
122
|
+
email == o.email &&
|
123
|
+
shop_id == o.shop_id
|
124
|
+
end
|
125
|
+
|
126
|
+
# @see the `==` method
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def eql?(o)
|
129
|
+
self == o
|
130
|
+
end
|
131
|
+
|
132
|
+
# Calculates hash code according to all attributes.
|
133
|
+
# @return [Fixnum] Hash code
|
134
|
+
def hash
|
135
|
+
[username, password, external_user_id, email, shop_id].hash
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def build_from_hash(attributes)
|
142
|
+
return nil unless attributes.is_a?(Hash)
|
143
|
+
self.class.swagger_types.each_pair do |key, type|
|
144
|
+
if type =~ /^Array<(.*)>/i
|
145
|
+
# check to ensure the input is an array given that the the attribute
|
146
|
+
# is documented as an array but the input is not
|
147
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
148
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
149
|
+
end
|
150
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
151
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
152
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
153
|
+
end
|
154
|
+
|
155
|
+
self
|
156
|
+
end
|
157
|
+
|
158
|
+
# Deserializes the data based on type
|
159
|
+
# @param string type Data type
|
160
|
+
# @param string value Value to be deserialized
|
161
|
+
# @return [Object] Deserialized data
|
162
|
+
def _deserialize(type, value)
|
163
|
+
case type.to_sym
|
164
|
+
when :DateTime
|
165
|
+
DateTime.parse(value)
|
166
|
+
when :Date
|
167
|
+
Date.parse(value)
|
168
|
+
when :String
|
169
|
+
value.to_s
|
170
|
+
when :Integer
|
171
|
+
value.to_i
|
172
|
+
when :Float
|
173
|
+
value.to_f
|
174
|
+
when :BOOLEAN
|
175
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
176
|
+
true
|
177
|
+
else
|
178
|
+
false
|
179
|
+
end
|
180
|
+
when :Object
|
181
|
+
# generic object (usually a Hash), return directly
|
182
|
+
value
|
183
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
184
|
+
inner_type = Regexp.last_match[:inner_type]
|
185
|
+
value.map { |v| _deserialize(inner_type, v) }
|
186
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
187
|
+
k_type = Regexp.last_match[:k_type]
|
188
|
+
v_type = Regexp.last_match[:v_type]
|
189
|
+
{}.tap do |hash|
|
190
|
+
value.each do |k, v|
|
191
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
else # model
|
195
|
+
temp_model = StorecoveApi.const_get(type).new
|
196
|
+
temp_model.build_from_hash(value)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# Returns the string representation of the object
|
201
|
+
# @return [String] String presentation of the object
|
202
|
+
def to_s
|
203
|
+
to_hash.to_s
|
204
|
+
end
|
205
|
+
|
206
|
+
# to_body is an alias to to_hash (backward compatibility)
|
207
|
+
# @return [Hash] Returns the object in the form of hash
|
208
|
+
def to_body
|
209
|
+
to_hash
|
210
|
+
end
|
211
|
+
|
212
|
+
# Returns the object in the form of hash
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
214
|
+
def to_hash
|
215
|
+
hash = {}
|
216
|
+
self.class.attribute_map.each_pair do |attr, param|
|
217
|
+
value = self.send(attr)
|
218
|
+
next if value.nil?
|
219
|
+
hash[param] = _to_hash(value)
|
220
|
+
end
|
221
|
+
hash
|
222
|
+
end
|
223
|
+
|
224
|
+
# Outputs non-array value in the form of hash
|
225
|
+
# For object, use to_hash. Otherwise, just return the value
|
226
|
+
# @param [Object] value Any valid value
|
227
|
+
# @return [Hash] Returns the value in the form of hash
|
228
|
+
def _to_hash(value)
|
229
|
+
if value.is_a?(Array)
|
230
|
+
value.compact.map{ |v| _to_hash(v) }
|
231
|
+
elsif value.is_a?(Hash)
|
232
|
+
{}.tap do |hash|
|
233
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
234
|
+
end
|
235
|
+
elsif value.respond_to? :to_hash
|
236
|
+
value.to_hash
|
237
|
+
else
|
238
|
+
value
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|