storecove 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/lib/storecove.rb +20 -1
- data/lib/storecove/api/invoice_submissions_api.rb +9 -4
- data/lib/storecove/api/legal_entities_api.rb +248 -0
- data/lib/storecove/api/peppol_identifiers_api.rb +156 -0
- data/lib/storecove/api/purchase_invoices_api.rb +133 -0
- data/lib/storecove/api/shop_account_requests_api.rb +24 -11
- data/lib/storecove/api/shop_accounts_api.rb +25 -12
- data/lib/storecove/api/shops_api.rb +2 -1
- data/lib/storecove/api_client.rb +39 -26
- data/lib/storecove/api_error.rb +1 -0
- data/lib/storecove/configuration.rb +7 -0
- data/lib/storecove/models/accounting_cost_code.rb +2 -1
- data/lib/storecove/models/accounting_customer_party.rb +2 -1
- data/lib/storecove/models/accounting_details.rb +219 -0
- data/lib/storecove/models/accounting_details_1.rb +219 -0
- data/lib/storecove/models/address.rb +2 -1
- data/lib/storecove/models/contact.rb +2 -6
- data/lib/storecove/models/country.rb +10 -0
- data/lib/storecove/models/currency_code.rb +10 -0
- data/lib/storecove/models/error_model.rb +2 -1
- data/lib/storecove/models/invoice.rb +16 -3
- data/lib/storecove/models/invoice_line.rb +251 -6
- data/lib/storecove/models/invoice_recipient.rb +24 -11
- data/lib/storecove/models/invoice_recipient_preflight.rb +21 -19
- data/lib/storecove/models/invoice_submission.rb +20 -9
- data/lib/storecove/models/invoice_submission_result.rb +2 -1
- data/lib/storecove/models/legal_entity.rb +164 -25
- data/lib/storecove/models/legal_entity_create.rb +417 -0
- data/lib/storecove/models/legal_entity_identifier.rb +2 -1
- data/lib/storecove/models/legal_entity_shop.rb +253 -0
- data/lib/storecove/models/legal_entity_update.rb +380 -0
- data/lib/storecove/models/logos.rb +2 -1
- data/lib/storecove/models/party.rb +7 -1
- data/lib/storecove/models/payment_means.rb +199 -0
- data/lib/storecove/models/peppol_identifier.rb +284 -0
- data/lib/storecove/models/peppol_identifier_create.rb +308 -0
- data/lib/storecove/models/preflight_invoice_recipient_result.rb +2 -1
- data/lib/storecove/models/public_identifier.rb +3 -2
- data/lib/storecove/models/public_identifiers.rb +2 -1
- data/lib/storecove/models/purchase_invoice.rb +463 -0
- data/lib/storecove/models/purchase_invoice_invoice_line.rb +247 -0
- data/lib/storecove/models/purchase_invoice_sender.rb +280 -0
- data/lib/storecove/models/purchase_invoice_sender_billing_contact.rb +209 -0
- data/lib/storecove/models/purchase_invoice_ubl.rb +209 -0
- data/lib/storecove/models/shop.rb +3 -2
- data/lib/storecove/models/shop_account_input.rb +2 -1
- data/lib/storecove/models/shop_account_request_input.rb +2 -1
- data/lib/storecove/models/shop_account_request_result.rb +2 -1
- data/lib/storecove/models/shop_account_request_update.rb +2 -1
- data/lib/storecove/models/shop_account_result.rb +2 -1
- data/lib/storecove/models/shop_account_update.rb +2 -1
- data/lib/storecove/models/tax.rb +2 -1
- data/lib/storecove/models/vat_details.rb +209 -0
- data/lib/storecove/models/widget_identification.rb +228 -0
- data/lib/storecove/version.rb +2 -1
- data/spec/api/invoice_submissions_api_spec.rb +9 -20
- data/spec/api/legal_entities_api_spec.rb +84 -0
- data/spec/api/peppol_identifiers_api_spec.rb +63 -0
- data/spec/api/purchase_invoices_api_spec.rb +59 -0
- data/spec/api/shop_account_requests_api_spec.rb +30 -41
- data/spec/api/shop_accounts_api_spec.rb +34 -45
- data/spec/api/shops_api_spec.rb +6 -17
- data/spec/api_client_spec.rb +2 -13
- data/spec/configuration_spec.rb +2 -13
- data/spec/models/accounting_cost_code_spec.rb +3 -14
- data/spec/models/accounting_customer_party_spec.rb +3 -14
- data/spec/models/accounting_details_1_spec.rb +60 -0
- data/spec/models/accounting_details_spec.rb +60 -0
- data/spec/models/{party_address_spec.rb → address_spec.rb} +8 -19
- data/spec/models/{party_contact_spec.rb → contact_spec.rb} +8 -19
- data/spec/models/country_spec.rb +3 -14
- data/spec/models/currency_code_spec.rb +3 -14
- data/spec/models/error_model_spec.rb +3 -14
- data/spec/models/invoice_line_spec.rb +69 -14
- data/spec/models/invoice_recipient_preflight_spec.rb +10 -15
- data/spec/models/invoice_recipient_spec.rb +15 -14
- data/spec/models/{invoice_submission_invoice_spec.rb → invoice_spec.rb} +20 -19
- data/spec/models/invoice_submission_result_spec.rb +4 -15
- data/spec/models/invoice_submission_spec.rb +4 -15
- data/spec/models/legal_entity_create_spec.rb +78 -0
- data/spec/models/legal_entity_identifier_spec.rb +3 -14
- data/spec/models/legal_entity_shop_spec.rb +84 -0
- data/spec/models/legal_entity_spec.rb +7 -18
- data/spec/models/legal_entity_update_spec.rb +78 -0
- data/spec/models/logos_spec.rb +3 -14
- data/spec/models/party_spec.rb +3 -14
- data/spec/models/payment_means_spec.rb +48 -0
- data/spec/models/peppol_identifier_create_spec.rb +54 -0
- data/spec/models/peppol_identifier_spec.rb +54 -0
- data/spec/models/preflight_invoice_recipient_result_spec.rb +3 -14
- data/spec/models/public_identifier_spec.rb +3 -14
- data/spec/models/public_identifiers_spec.rb +3 -14
- data/spec/models/purchase_invoice_invoice_line_spec.rb +78 -0
- data/spec/models/purchase_invoice_sender_billing_contact_spec.rb +54 -0
- data/spec/models/purchase_invoice_sender_spec.rb +96 -0
- data/spec/models/purchase_invoice_spec.rb +188 -0
- data/spec/models/purchase_invoice_ubl_spec.rb +54 -0
- data/spec/models/shop_account_input_spec.rb +3 -14
- data/spec/models/shop_account_request_input_spec.rb +3 -14
- data/spec/models/{shop_account_request_spec.rb → shop_account_request_result_spec.rb} +8 -19
- data/spec/models/shop_account_request_update_spec.rb +3 -14
- data/spec/models/shop_account_result_spec.rb +3 -14
- data/spec/models/shop_account_update_spec.rb +3 -14
- data/spec/models/shop_spec.rb +3 -14
- data/spec/models/{invoice_line_tax_spec.rb → tax_spec.rb} +8 -19
- data/spec/models/vat_details_spec.rb +54 -0
- data/spec/models/widget_identification_spec.rb +48 -0
- data/spec/spec_helper.rb +2 -13
- data/storecove.gemspec +10 -19
- metadata +83 -28
@@ -0,0 +1,417 @@
|
|
1
|
+
=begin
|
2
|
+
#Storecove API
|
3
|
+
|
4
|
+
#Storecove API
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0.1
|
7
|
+
Contact: apisupport@storecove.nl
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module StorecoveApi
|
16
|
+
|
17
|
+
class LegalEntityCreate
|
18
|
+
# The name of the company.
|
19
|
+
attr_accessor :party_name
|
20
|
+
|
21
|
+
# The first address line.
|
22
|
+
attr_accessor :line1
|
23
|
+
|
24
|
+
# The second address line, if applicable
|
25
|
+
attr_accessor :line2
|
26
|
+
|
27
|
+
# The city.
|
28
|
+
attr_accessor :city
|
29
|
+
|
30
|
+
# The zipcode.
|
31
|
+
attr_accessor :zip
|
32
|
+
|
33
|
+
# County, if applicable
|
34
|
+
attr_accessor :county
|
35
|
+
|
36
|
+
attr_accessor :country
|
37
|
+
|
38
|
+
|
39
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
40
|
+
def self.attribute_map
|
41
|
+
{
|
42
|
+
:'party_name' => :'party_name',
|
43
|
+
:'line1' => :'line1',
|
44
|
+
:'line2' => :'line2',
|
45
|
+
:'city' => :'city',
|
46
|
+
:'zip' => :'zip',
|
47
|
+
:'county' => :'county',
|
48
|
+
:'country' => :'country'
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
# Attribute type mapping.
|
53
|
+
def self.swagger_types
|
54
|
+
{
|
55
|
+
:'party_name' => :'String',
|
56
|
+
:'line1' => :'String',
|
57
|
+
:'line2' => :'String',
|
58
|
+
:'city' => :'String',
|
59
|
+
:'zip' => :'String',
|
60
|
+
:'county' => :'String',
|
61
|
+
:'country' => :'Country'
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
# Initializes the object
|
66
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
67
|
+
def initialize(attributes = {})
|
68
|
+
return unless attributes.is_a?(Hash)
|
69
|
+
|
70
|
+
# convert string to symbol for hash key
|
71
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
72
|
+
|
73
|
+
if attributes.has_key?(:'party_name')
|
74
|
+
self.party_name = attributes[:'party_name']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.has_key?(:'line1')
|
78
|
+
self.line1 = attributes[:'line1']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.has_key?(:'line2')
|
82
|
+
self.line2 = attributes[:'line2']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.has_key?(:'city')
|
86
|
+
self.city = attributes[:'city']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.has_key?(:'zip')
|
90
|
+
self.zip = attributes[:'zip']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.has_key?(:'county')
|
94
|
+
self.county = attributes[:'county']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.has_key?(:'country')
|
98
|
+
self.country = attributes[:'country']
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
104
|
+
# @return Array for valid properties with the reasons
|
105
|
+
def list_invalid_properties
|
106
|
+
invalid_properties = Array.new
|
107
|
+
if @party_name.nil?
|
108
|
+
invalid_properties.push("invalid value for 'party_name', party_name cannot be nil.")
|
109
|
+
end
|
110
|
+
|
111
|
+
if @party_name.to_s.length > 64
|
112
|
+
invalid_properties.push("invalid value for 'party_name', the character length must be smaller than or equal to 64.")
|
113
|
+
end
|
114
|
+
|
115
|
+
if @party_name.to_s.length < 2
|
116
|
+
invalid_properties.push("invalid value for 'party_name', the character length must be great than or equal to 2.")
|
117
|
+
end
|
118
|
+
|
119
|
+
if @line1.nil?
|
120
|
+
invalid_properties.push("invalid value for 'line1', line1 cannot be nil.")
|
121
|
+
end
|
122
|
+
|
123
|
+
if @line1.to_s.length > 64
|
124
|
+
invalid_properties.push("invalid value for 'line1', the character length must be smaller than or equal to 64.")
|
125
|
+
end
|
126
|
+
|
127
|
+
if @line1.to_s.length < 2
|
128
|
+
invalid_properties.push("invalid value for 'line1', the character length must be great than or equal to 2.")
|
129
|
+
end
|
130
|
+
|
131
|
+
if !@line2.nil? && @line2.to_s.length > 64
|
132
|
+
invalid_properties.push("invalid value for 'line2', the character length must be smaller than or equal to 64.")
|
133
|
+
end
|
134
|
+
|
135
|
+
if @city.nil?
|
136
|
+
invalid_properties.push("invalid value for 'city', city cannot be nil.")
|
137
|
+
end
|
138
|
+
|
139
|
+
if @city.to_s.length > 64
|
140
|
+
invalid_properties.push("invalid value for 'city', the character length must be smaller than or equal to 64.")
|
141
|
+
end
|
142
|
+
|
143
|
+
if @city.to_s.length < 2
|
144
|
+
invalid_properties.push("invalid value for 'city', the character length must be great than or equal to 2.")
|
145
|
+
end
|
146
|
+
|
147
|
+
if @zip.nil?
|
148
|
+
invalid_properties.push("invalid value for 'zip', zip cannot be nil.")
|
149
|
+
end
|
150
|
+
|
151
|
+
if @zip.to_s.length > 32
|
152
|
+
invalid_properties.push("invalid value for 'zip', the character length must be smaller than or equal to 32.")
|
153
|
+
end
|
154
|
+
|
155
|
+
if @zip.to_s.length < 2
|
156
|
+
invalid_properties.push("invalid value for 'zip', the character length must be great than or equal to 2.")
|
157
|
+
end
|
158
|
+
|
159
|
+
if !@county.nil? && @county.to_s.length > 64
|
160
|
+
invalid_properties.push("invalid value for 'county', the character length must be smaller than or equal to 64.")
|
161
|
+
end
|
162
|
+
|
163
|
+
if @country.nil?
|
164
|
+
invalid_properties.push("invalid value for 'country', country cannot be nil.")
|
165
|
+
end
|
166
|
+
|
167
|
+
return invalid_properties
|
168
|
+
end
|
169
|
+
|
170
|
+
# Check to see if the all the properties in the model are valid
|
171
|
+
# @return true if the model is valid
|
172
|
+
def valid?
|
173
|
+
return false if @party_name.nil?
|
174
|
+
return false if @party_name.to_s.length > 64
|
175
|
+
return false if @party_name.to_s.length < 2
|
176
|
+
return false if @line1.nil?
|
177
|
+
return false if @line1.to_s.length > 64
|
178
|
+
return false if @line1.to_s.length < 2
|
179
|
+
return false if !@line2.nil? && @line2.to_s.length > 64
|
180
|
+
return false if @city.nil?
|
181
|
+
return false if @city.to_s.length > 64
|
182
|
+
return false if @city.to_s.length < 2
|
183
|
+
return false if @zip.nil?
|
184
|
+
return false if @zip.to_s.length > 32
|
185
|
+
return false if @zip.to_s.length < 2
|
186
|
+
return false if !@county.nil? && @county.to_s.length > 64
|
187
|
+
return false if @country.nil?
|
188
|
+
return true
|
189
|
+
end
|
190
|
+
|
191
|
+
# Custom attribute writer method with validation
|
192
|
+
# @param [Object] party_name Value to be assigned
|
193
|
+
def party_name=(party_name)
|
194
|
+
if party_name.nil?
|
195
|
+
fail ArgumentError, "party_name cannot be nil"
|
196
|
+
end
|
197
|
+
|
198
|
+
if party_name.to_s.length > 64
|
199
|
+
fail ArgumentError, "invalid value for 'party_name', the character length must be smaller than or equal to 64."
|
200
|
+
end
|
201
|
+
|
202
|
+
if party_name.to_s.length < 2
|
203
|
+
fail ArgumentError, "invalid value for 'party_name', the character length must be great than or equal to 2."
|
204
|
+
end
|
205
|
+
|
206
|
+
@party_name = party_name
|
207
|
+
end
|
208
|
+
|
209
|
+
# Custom attribute writer method with validation
|
210
|
+
# @param [Object] line1 Value to be assigned
|
211
|
+
def line1=(line1)
|
212
|
+
if line1.nil?
|
213
|
+
fail ArgumentError, "line1 cannot be nil"
|
214
|
+
end
|
215
|
+
|
216
|
+
if line1.to_s.length > 64
|
217
|
+
fail ArgumentError, "invalid value for 'line1', the character length must be smaller than or equal to 64."
|
218
|
+
end
|
219
|
+
|
220
|
+
if line1.to_s.length < 2
|
221
|
+
fail ArgumentError, "invalid value for 'line1', the character length must be great than or equal to 2."
|
222
|
+
end
|
223
|
+
|
224
|
+
@line1 = line1
|
225
|
+
end
|
226
|
+
|
227
|
+
# Custom attribute writer method with validation
|
228
|
+
# @param [Object] line2 Value to be assigned
|
229
|
+
def line2=(line2)
|
230
|
+
|
231
|
+
if !line2.nil? && line2.to_s.length > 64
|
232
|
+
fail ArgumentError, "invalid value for 'line2', the character length must be smaller than or equal to 64."
|
233
|
+
end
|
234
|
+
|
235
|
+
@line2 = line2
|
236
|
+
end
|
237
|
+
|
238
|
+
# Custom attribute writer method with validation
|
239
|
+
# @param [Object] city Value to be assigned
|
240
|
+
def city=(city)
|
241
|
+
if city.nil?
|
242
|
+
fail ArgumentError, "city cannot be nil"
|
243
|
+
end
|
244
|
+
|
245
|
+
if city.to_s.length > 64
|
246
|
+
fail ArgumentError, "invalid value for 'city', the character length must be smaller than or equal to 64."
|
247
|
+
end
|
248
|
+
|
249
|
+
if city.to_s.length < 2
|
250
|
+
fail ArgumentError, "invalid value for 'city', the character length must be great than or equal to 2."
|
251
|
+
end
|
252
|
+
|
253
|
+
@city = city
|
254
|
+
end
|
255
|
+
|
256
|
+
# Custom attribute writer method with validation
|
257
|
+
# @param [Object] zip Value to be assigned
|
258
|
+
def zip=(zip)
|
259
|
+
if zip.nil?
|
260
|
+
fail ArgumentError, "zip cannot be nil"
|
261
|
+
end
|
262
|
+
|
263
|
+
if zip.to_s.length > 32
|
264
|
+
fail ArgumentError, "invalid value for 'zip', the character length must be smaller than or equal to 32."
|
265
|
+
end
|
266
|
+
|
267
|
+
if zip.to_s.length < 2
|
268
|
+
fail ArgumentError, "invalid value for 'zip', the character length must be great than or equal to 2."
|
269
|
+
end
|
270
|
+
|
271
|
+
@zip = zip
|
272
|
+
end
|
273
|
+
|
274
|
+
# Custom attribute writer method with validation
|
275
|
+
# @param [Object] county Value to be assigned
|
276
|
+
def county=(county)
|
277
|
+
|
278
|
+
if !county.nil? && county.to_s.length > 64
|
279
|
+
fail ArgumentError, "invalid value for 'county', the character length must be smaller than or equal to 64."
|
280
|
+
end
|
281
|
+
|
282
|
+
@county = county
|
283
|
+
end
|
284
|
+
|
285
|
+
# Checks equality by comparing each attribute.
|
286
|
+
# @param [Object] Object to be compared
|
287
|
+
def ==(o)
|
288
|
+
return true if self.equal?(o)
|
289
|
+
self.class == o.class &&
|
290
|
+
party_name == o.party_name &&
|
291
|
+
line1 == o.line1 &&
|
292
|
+
line2 == o.line2 &&
|
293
|
+
city == o.city &&
|
294
|
+
zip == o.zip &&
|
295
|
+
county == o.county &&
|
296
|
+
country == o.country
|
297
|
+
end
|
298
|
+
|
299
|
+
# @see the `==` method
|
300
|
+
# @param [Object] Object to be compared
|
301
|
+
def eql?(o)
|
302
|
+
self == o
|
303
|
+
end
|
304
|
+
|
305
|
+
# Calculates hash code according to all attributes.
|
306
|
+
# @return [Fixnum] Hash code
|
307
|
+
def hash
|
308
|
+
[party_name, line1, line2, city, zip, county, country].hash
|
309
|
+
end
|
310
|
+
|
311
|
+
# Builds the object from hash
|
312
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
313
|
+
# @return [Object] Returns the model itself
|
314
|
+
def build_from_hash(attributes)
|
315
|
+
return nil unless attributes.is_a?(Hash)
|
316
|
+
self.class.swagger_types.each_pair do |key, type|
|
317
|
+
if type =~ /\AArray<(.*)>/i
|
318
|
+
# check to ensure the input is an array given that the the attribute
|
319
|
+
# is documented as an array but the input is not
|
320
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
321
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
322
|
+
end
|
323
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
324
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
325
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
326
|
+
end
|
327
|
+
|
328
|
+
self
|
329
|
+
end
|
330
|
+
|
331
|
+
# Deserializes the data based on type
|
332
|
+
# @param string type Data type
|
333
|
+
# @param string value Value to be deserialized
|
334
|
+
# @return [Object] Deserialized data
|
335
|
+
def _deserialize(type, value)
|
336
|
+
case type.to_sym
|
337
|
+
when :DateTime
|
338
|
+
DateTime.parse(value)
|
339
|
+
when :Date
|
340
|
+
Date.parse(value)
|
341
|
+
when :String
|
342
|
+
value.to_s
|
343
|
+
when :Integer
|
344
|
+
value.to_i
|
345
|
+
when :Float
|
346
|
+
value.to_f
|
347
|
+
when :BOOLEAN
|
348
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
349
|
+
true
|
350
|
+
else
|
351
|
+
false
|
352
|
+
end
|
353
|
+
when :Object
|
354
|
+
# generic object (usually a Hash), return directly
|
355
|
+
value
|
356
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
357
|
+
inner_type = Regexp.last_match[:inner_type]
|
358
|
+
value.map { |v| _deserialize(inner_type, v) }
|
359
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
360
|
+
k_type = Regexp.last_match[:k_type]
|
361
|
+
v_type = Regexp.last_match[:v_type]
|
362
|
+
{}.tap do |hash|
|
363
|
+
value.each do |k, v|
|
364
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
365
|
+
end
|
366
|
+
end
|
367
|
+
else # model
|
368
|
+
temp_model = StorecoveApi.const_get(type).new
|
369
|
+
temp_model.build_from_hash(value)
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
# Returns the string representation of the object
|
374
|
+
# @return [String] String presentation of the object
|
375
|
+
def to_s
|
376
|
+
to_hash.to_s
|
377
|
+
end
|
378
|
+
|
379
|
+
# to_body is an alias to to_hash (backward compatibility)
|
380
|
+
# @return [Hash] Returns the object in the form of hash
|
381
|
+
def to_body
|
382
|
+
to_hash
|
383
|
+
end
|
384
|
+
|
385
|
+
# Returns the object in the form of hash
|
386
|
+
# @return [Hash] Returns the object in the form of hash
|
387
|
+
def to_hash
|
388
|
+
hash = {}
|
389
|
+
self.class.attribute_map.each_pair do |attr, param|
|
390
|
+
value = self.send(attr)
|
391
|
+
next if value.nil?
|
392
|
+
hash[param] = _to_hash(value)
|
393
|
+
end
|
394
|
+
hash
|
395
|
+
end
|
396
|
+
|
397
|
+
# Outputs non-array value in the form of hash
|
398
|
+
# For object, use to_hash. Otherwise, just return the value
|
399
|
+
# @param [Object] value Any valid value
|
400
|
+
# @return [Hash] Returns the value in the form of hash
|
401
|
+
def _to_hash(value)
|
402
|
+
if value.is_a?(Array)
|
403
|
+
value.compact.map{ |v| _to_hash(v) }
|
404
|
+
elsif value.is_a?(Hash)
|
405
|
+
{}.tap do |hash|
|
406
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
407
|
+
end
|
408
|
+
elsif value.respond_to? :to_hash
|
409
|
+
value.to_hash
|
410
|
+
else
|
411
|
+
value
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
end
|
416
|
+
|
417
|
+
end
|
@@ -6,6 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 2.0.1
|
7
7
|
Contact: apisupport@storecove.nl
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
9
10
|
|
10
11
|
=end
|
11
12
|
|
@@ -62,7 +63,7 @@ module StorecoveApi
|
|
62
63
|
end
|
63
64
|
|
64
65
|
# Show invalid properties with the reasons. Usually used together with valid?
|
65
|
-
# @return Array for valid
|
66
|
+
# @return Array for valid properties with the reasons
|
66
67
|
def list_invalid_properties
|
67
68
|
invalid_properties = Array.new
|
68
69
|
return invalid_properties
|
@@ -0,0 +1,253 @@
|
|
1
|
+
=begin
|
2
|
+
#Storecove API
|
3
|
+
|
4
|
+
#Storecove API
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0.1
|
7
|
+
Contact: apisupport@storecove.nl
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module StorecoveApi
|
16
|
+
|
17
|
+
class LegalEntityShop
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
attr_accessor :line1
|
21
|
+
|
22
|
+
attr_accessor :line2
|
23
|
+
|
24
|
+
attr_accessor :zip
|
25
|
+
|
26
|
+
attr_accessor :city
|
27
|
+
|
28
|
+
attr_accessor :county
|
29
|
+
|
30
|
+
attr_accessor :country
|
31
|
+
|
32
|
+
attr_accessor :identifiers
|
33
|
+
|
34
|
+
|
35
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
36
|
+
def self.attribute_map
|
37
|
+
{
|
38
|
+
:'name' => :'name',
|
39
|
+
:'line1' => :'line1',
|
40
|
+
:'line2' => :'line2',
|
41
|
+
:'zip' => :'zip',
|
42
|
+
:'city' => :'city',
|
43
|
+
:'county' => :'county',
|
44
|
+
:'country' => :'country',
|
45
|
+
:'identifiers' => :'identifiers'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.swagger_types
|
51
|
+
{
|
52
|
+
:'name' => :'String',
|
53
|
+
:'line1' => :'String',
|
54
|
+
:'line2' => :'String',
|
55
|
+
:'zip' => :'String',
|
56
|
+
:'city' => :'String',
|
57
|
+
:'county' => :'String',
|
58
|
+
:'country' => :'String',
|
59
|
+
:'identifiers' => :'Array<LegalEntityIdentifier>'
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# Initializes the object
|
64
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
65
|
+
def initialize(attributes = {})
|
66
|
+
return unless attributes.is_a?(Hash)
|
67
|
+
|
68
|
+
# convert string to symbol for hash key
|
69
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
70
|
+
|
71
|
+
if attributes.has_key?(:'name')
|
72
|
+
self.name = attributes[:'name']
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes.has_key?(:'line1')
|
76
|
+
self.line1 = attributes[:'line1']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.has_key?(:'line2')
|
80
|
+
self.line2 = attributes[:'line2']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.has_key?(:'zip')
|
84
|
+
self.zip = attributes[:'zip']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.has_key?(:'city')
|
88
|
+
self.city = attributes[:'city']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.has_key?(:'county')
|
92
|
+
self.county = attributes[:'county']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.has_key?(:'country')
|
96
|
+
self.country = attributes[:'country']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.has_key?(:'identifiers')
|
100
|
+
if (value = attributes[:'identifiers']).is_a?(Array)
|
101
|
+
self.identifiers = value
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
108
|
+
# @return Array for valid properties with the reasons
|
109
|
+
def list_invalid_properties
|
110
|
+
invalid_properties = Array.new
|
111
|
+
return invalid_properties
|
112
|
+
end
|
113
|
+
|
114
|
+
# Check to see if the all the properties in the model are valid
|
115
|
+
# @return true if the model is valid
|
116
|
+
def valid?
|
117
|
+
return true
|
118
|
+
end
|
119
|
+
|
120
|
+
# Checks equality by comparing each attribute.
|
121
|
+
# @param [Object] Object to be compared
|
122
|
+
def ==(o)
|
123
|
+
return true if self.equal?(o)
|
124
|
+
self.class == o.class &&
|
125
|
+
name == o.name &&
|
126
|
+
line1 == o.line1 &&
|
127
|
+
line2 == o.line2 &&
|
128
|
+
zip == o.zip &&
|
129
|
+
city == o.city &&
|
130
|
+
county == o.county &&
|
131
|
+
country == o.country &&
|
132
|
+
identifiers == o.identifiers
|
133
|
+
end
|
134
|
+
|
135
|
+
# @see the `==` method
|
136
|
+
# @param [Object] Object to be compared
|
137
|
+
def eql?(o)
|
138
|
+
self == o
|
139
|
+
end
|
140
|
+
|
141
|
+
# Calculates hash code according to all attributes.
|
142
|
+
# @return [Fixnum] Hash code
|
143
|
+
def hash
|
144
|
+
[name, line1, line2, zip, city, county, country, identifiers].hash
|
145
|
+
end
|
146
|
+
|
147
|
+
# Builds the object from hash
|
148
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
149
|
+
# @return [Object] Returns the model itself
|
150
|
+
def build_from_hash(attributes)
|
151
|
+
return nil unless attributes.is_a?(Hash)
|
152
|
+
self.class.swagger_types.each_pair do |key, type|
|
153
|
+
if type =~ /\AArray<(.*)>/i
|
154
|
+
# check to ensure the input is an array given that the the attribute
|
155
|
+
# is documented as an array but the input is not
|
156
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
157
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
158
|
+
end
|
159
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
160
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
161
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
162
|
+
end
|
163
|
+
|
164
|
+
self
|
165
|
+
end
|
166
|
+
|
167
|
+
# Deserializes the data based on type
|
168
|
+
# @param string type Data type
|
169
|
+
# @param string value Value to be deserialized
|
170
|
+
# @return [Object] Deserialized data
|
171
|
+
def _deserialize(type, value)
|
172
|
+
case type.to_sym
|
173
|
+
when :DateTime
|
174
|
+
DateTime.parse(value)
|
175
|
+
when :Date
|
176
|
+
Date.parse(value)
|
177
|
+
when :String
|
178
|
+
value.to_s
|
179
|
+
when :Integer
|
180
|
+
value.to_i
|
181
|
+
when :Float
|
182
|
+
value.to_f
|
183
|
+
when :BOOLEAN
|
184
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
185
|
+
true
|
186
|
+
else
|
187
|
+
false
|
188
|
+
end
|
189
|
+
when :Object
|
190
|
+
# generic object (usually a Hash), return directly
|
191
|
+
value
|
192
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
193
|
+
inner_type = Regexp.last_match[:inner_type]
|
194
|
+
value.map { |v| _deserialize(inner_type, v) }
|
195
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
196
|
+
k_type = Regexp.last_match[:k_type]
|
197
|
+
v_type = Regexp.last_match[:v_type]
|
198
|
+
{}.tap do |hash|
|
199
|
+
value.each do |k, v|
|
200
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
else # model
|
204
|
+
temp_model = StorecoveApi.const_get(type).new
|
205
|
+
temp_model.build_from_hash(value)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
# Returns the string representation of the object
|
210
|
+
# @return [String] String presentation of the object
|
211
|
+
def to_s
|
212
|
+
to_hash.to_s
|
213
|
+
end
|
214
|
+
|
215
|
+
# to_body is an alias to to_hash (backward compatibility)
|
216
|
+
# @return [Hash] Returns the object in the form of hash
|
217
|
+
def to_body
|
218
|
+
to_hash
|
219
|
+
end
|
220
|
+
|
221
|
+
# Returns the object in the form of hash
|
222
|
+
# @return [Hash] Returns the object in the form of hash
|
223
|
+
def to_hash
|
224
|
+
hash = {}
|
225
|
+
self.class.attribute_map.each_pair do |attr, param|
|
226
|
+
value = self.send(attr)
|
227
|
+
next if value.nil?
|
228
|
+
hash[param] = _to_hash(value)
|
229
|
+
end
|
230
|
+
hash
|
231
|
+
end
|
232
|
+
|
233
|
+
# Outputs non-array value in the form of hash
|
234
|
+
# For object, use to_hash. Otherwise, just return the value
|
235
|
+
# @param [Object] value Any valid value
|
236
|
+
# @return [Hash] Returns the value in the form of hash
|
237
|
+
def _to_hash(value)
|
238
|
+
if value.is_a?(Array)
|
239
|
+
value.compact.map{ |v| _to_hash(v) }
|
240
|
+
elsif value.is_a?(Hash)
|
241
|
+
{}.tap do |hash|
|
242
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
243
|
+
end
|
244
|
+
elsif value.respond_to? :to_hash
|
245
|
+
value.to_hash
|
246
|
+
else
|
247
|
+
value
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
end
|
252
|
+
|
253
|
+
end
|