storecove 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,280 @@
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
+ class Country
28
+
29
+ AD = "AD".freeze
30
+ AE = "AE".freeze
31
+ AF = "AF".freeze
32
+ AG = "AG".freeze
33
+ AI = "AI".freeze
34
+ AL = "AL".freeze
35
+ AM = "AM".freeze
36
+ AO = "AO".freeze
37
+ AQ = "AQ".freeze
38
+ AR = "AR".freeze
39
+ AS = "AS".freeze
40
+ AT = "AT".freeze
41
+ AU = "AU".freeze
42
+ AW = "AW".freeze
43
+ AX = "AX".freeze
44
+ AZ = "AZ".freeze
45
+ BA = "BA".freeze
46
+ BB = "BB".freeze
47
+ BD = "BD".freeze
48
+ BE = "BE".freeze
49
+ BF = "BF".freeze
50
+ BG = "BG".freeze
51
+ BH = "BH".freeze
52
+ BI = "BI".freeze
53
+ BJ = "BJ".freeze
54
+ BL = "BL".freeze
55
+ BM = "BM".freeze
56
+ BN = "BN".freeze
57
+ BO = "BO".freeze
58
+ BQ = "BQ".freeze
59
+ BR = "BR".freeze
60
+ BS = "BS".freeze
61
+ BT = "BT".freeze
62
+ BV = "BV".freeze
63
+ BW = "BW".freeze
64
+ BY = "BY".freeze
65
+ BZ = "BZ".freeze
66
+ CA = "CA".freeze
67
+ CC = "CC".freeze
68
+ CD = "CD".freeze
69
+ CF = "CF".freeze
70
+ CG = "CG".freeze
71
+ CH = "CH".freeze
72
+ CI = "CI".freeze
73
+ CK = "CK".freeze
74
+ CL = "CL".freeze
75
+ CM = "CM".freeze
76
+ CN = "CN".freeze
77
+ CO = "CO".freeze
78
+ CR = "CR".freeze
79
+ CU = "CU".freeze
80
+ CV = "CV".freeze
81
+ CW = "CW".freeze
82
+ CX = "CX".freeze
83
+ CY = "CY".freeze
84
+ CZ = "CZ".freeze
85
+ DE = "DE".freeze
86
+ DJ = "DJ".freeze
87
+ DK = "DK".freeze
88
+ DM = "DM".freeze
89
+ DO = "DO".freeze
90
+ DZ = "DZ".freeze
91
+ EC = "EC".freeze
92
+ EE = "EE".freeze
93
+ EG = "EG".freeze
94
+ EH = "EH".freeze
95
+ ER = "ER".freeze
96
+ ES = "ES".freeze
97
+ ET = "ET".freeze
98
+ FI = "FI".freeze
99
+ FJ = "FJ".freeze
100
+ FK = "FK".freeze
101
+ FM = "FM".freeze
102
+ FO = "FO".freeze
103
+ FR = "FR".freeze
104
+ GA = "GA".freeze
105
+ GB = "GB".freeze
106
+ GD = "GD".freeze
107
+ GE = "GE".freeze
108
+ GF = "GF".freeze
109
+ GG = "GG".freeze
110
+ GH = "GH".freeze
111
+ GI = "GI".freeze
112
+ GL = "GL".freeze
113
+ GM = "GM".freeze
114
+ GN = "GN".freeze
115
+ GP = "GP".freeze
116
+ GQ = "GQ".freeze
117
+ GR = "GR".freeze
118
+ GS = "GS".freeze
119
+ GT = "GT".freeze
120
+ GU = "GU".freeze
121
+ GW = "GW".freeze
122
+ GY = "GY".freeze
123
+ HK = "HK".freeze
124
+ HM = "HM".freeze
125
+ HN = "HN".freeze
126
+ HR = "HR".freeze
127
+ HT = "HT".freeze
128
+ HU = "HU".freeze
129
+ ID = "ID".freeze
130
+ IE = "IE".freeze
131
+ IL = "IL".freeze
132
+ IM = "IM".freeze
133
+ IN = "IN".freeze
134
+ IO = "IO".freeze
135
+ IQ = "IQ".freeze
136
+ IR = "IR".freeze
137
+ IS = "IS".freeze
138
+ IT = "IT".freeze
139
+ JE = "JE".freeze
140
+ JM = "JM".freeze
141
+ JO = "JO".freeze
142
+ JP = "JP".freeze
143
+ KE = "KE".freeze
144
+ KG = "KG".freeze
145
+ KH = "KH".freeze
146
+ KI = "KI".freeze
147
+ KM = "KM".freeze
148
+ KN = "KN".freeze
149
+ KP = "KP".freeze
150
+ KR = "KR".freeze
151
+ KW = "KW".freeze
152
+ KY = "KY".freeze
153
+ KZ = "KZ".freeze
154
+ LA = "LA".freeze
155
+ LB = "LB".freeze
156
+ LC = "LC".freeze
157
+ LI = "LI".freeze
158
+ LK = "LK".freeze
159
+ LR = "LR".freeze
160
+ LS = "LS".freeze
161
+ LT = "LT".freeze
162
+ LU = "LU".freeze
163
+ LV = "LV".freeze
164
+ LY = "LY".freeze
165
+ MA = "MA".freeze
166
+ MC = "MC".freeze
167
+ MD = "MD".freeze
168
+ ME = "ME".freeze
169
+ MF = "MF".freeze
170
+ MG = "MG".freeze
171
+ MH = "MH".freeze
172
+ MK = "MK".freeze
173
+ ML = "ML".freeze
174
+ MM = "MM".freeze
175
+ MN = "MN".freeze
176
+ MO = "MO".freeze
177
+ MP = "MP".freeze
178
+ MQ = "MQ".freeze
179
+ MR = "MR".freeze
180
+ MS = "MS".freeze
181
+ MT = "MT".freeze
182
+ MU = "MU".freeze
183
+ MV = "MV".freeze
184
+ MW = "MW".freeze
185
+ MX = "MX".freeze
186
+ MY = "MY".freeze
187
+ MZ = "MZ".freeze
188
+ NA = "NA".freeze
189
+ NC = "NC".freeze
190
+ NE = "NE".freeze
191
+ NF = "NF".freeze
192
+ NG = "NG".freeze
193
+ NI = "NI".freeze
194
+ NL = "NL".freeze
195
+ NO = "NO".freeze
196
+ NP = "NP".freeze
197
+ NR = "NR".freeze
198
+ NU = "NU".freeze
199
+ NZ = "NZ".freeze
200
+ OM = "OM".freeze
201
+ PA = "PA".freeze
202
+ PE = "PE".freeze
203
+ PF = "PF".freeze
204
+ PG = "PG".freeze
205
+ PH = "PH".freeze
206
+ PK = "PK".freeze
207
+ PL = "PL".freeze
208
+ PM = "PM".freeze
209
+ PN = "PN".freeze
210
+ PR = "PR".freeze
211
+ PS = "PS".freeze
212
+ PT = "PT".freeze
213
+ PW = "PW".freeze
214
+ PY = "PY".freeze
215
+ QA = "QA".freeze
216
+ RE = "RE".freeze
217
+ RO = "RO".freeze
218
+ RS = "RS".freeze
219
+ RU = "RU".freeze
220
+ RW = "RW".freeze
221
+ SA = "SA".freeze
222
+ SB = "SB".freeze
223
+ SC = "SC".freeze
224
+ SD = "SD".freeze
225
+ SE = "SE".freeze
226
+ SG = "SG".freeze
227
+ SH = "SH".freeze
228
+ SI = "SI".freeze
229
+ SJ = "SJ".freeze
230
+ SK = "SK".freeze
231
+ SL = "SL".freeze
232
+ SM = "SM".freeze
233
+ SN = "SN".freeze
234
+ SO = "SO".freeze
235
+ SR = "SR".freeze
236
+ SS = "SS".freeze
237
+ ST = "ST".freeze
238
+ SV = "SV".freeze
239
+ SX = "SX".freeze
240
+ SY = "SY".freeze
241
+ SZ = "SZ".freeze
242
+ TC = "TC".freeze
243
+ TD = "TD".freeze
244
+ TF = "TF".freeze
245
+ TG = "TG".freeze
246
+ TH = "TH".freeze
247
+ TJ = "TJ".freeze
248
+ TK = "TK".freeze
249
+ TL = "TL".freeze
250
+ TM = "TM".freeze
251
+ TN = "TN".freeze
252
+ TO = "TO".freeze
253
+ TR = "TR".freeze
254
+ TT = "TT".freeze
255
+ TV = "TV".freeze
256
+ TW = "TW".freeze
257
+ TZ = "TZ".freeze
258
+ UA = "UA".freeze
259
+ UG = "UG".freeze
260
+ UM = "UM".freeze
261
+ US = "US".freeze
262
+ UY = "UY".freeze
263
+ UZ = "UZ".freeze
264
+ VA = "VA".freeze
265
+ VC = "VC".freeze
266
+ VE = "VE".freeze
267
+ VG = "VG".freeze
268
+ VI = "VI".freeze
269
+ VN = "VN".freeze
270
+ VU = "VU".freeze
271
+ WF = "WF".freeze
272
+ WS = "WS".freeze
273
+ YE = "YE".freeze
274
+ YT = "YT".freeze
275
+ ZA = "ZA".freeze
276
+ ZM = "ZM".freeze
277
+ ZW = "ZW".freeze
278
+ end
279
+
280
+ end
@@ -0,0 +1,209 @@
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
+ class CurrencyCode
28
+
29
+ AED = "AED".freeze
30
+ AFN = "AFN".freeze
31
+ ALL = "ALL".freeze
32
+ AMD = "AMD".freeze
33
+ ANG = "ANG".freeze
34
+ AOA = "AOA".freeze
35
+ ARS = "ARS".freeze
36
+ AUD = "AUD".freeze
37
+ AWG = "AWG".freeze
38
+ AZN = "AZN".freeze
39
+ BAM = "BAM".freeze
40
+ BBD = "BBD".freeze
41
+ BDT = "BDT".freeze
42
+ BGN = "BGN".freeze
43
+ BHD = "BHD".freeze
44
+ BIF = "BIF".freeze
45
+ BMD = "BMD".freeze
46
+ BND = "BND".freeze
47
+ BOB = "BOB".freeze
48
+ BOV = "BOV".freeze
49
+ BRL = "BRL".freeze
50
+ BSD = "BSD".freeze
51
+ BTN = "BTN".freeze
52
+ BWP = "BWP".freeze
53
+ BYN = "BYN".freeze
54
+ BYR = "BYR".freeze
55
+ BZD = "BZD".freeze
56
+ CAD = "CAD".freeze
57
+ CDF = "CDF".freeze
58
+ CHE = "CHE".freeze
59
+ CHF = "CHF".freeze
60
+ CHW = "CHW".freeze
61
+ CLF = "CLF".freeze
62
+ CLP = "CLP".freeze
63
+ CNY = "CNY".freeze
64
+ COP = "COP".freeze
65
+ COU = "COU".freeze
66
+ CRC = "CRC".freeze
67
+ CUC = "CUC".freeze
68
+ CUP = "CUP".freeze
69
+ CVE = "CVE".freeze
70
+ CZK = "CZK".freeze
71
+ DJF = "DJF".freeze
72
+ DKK = "DKK".freeze
73
+ DOP = "DOP".freeze
74
+ DZD = "DZD".freeze
75
+ EGP = "EGP".freeze
76
+ ERN = "ERN".freeze
77
+ ETB = "ETB".freeze
78
+ EUR = "EUR".freeze
79
+ FJD = "FJD".freeze
80
+ FKP = "FKP".freeze
81
+ GBP = "GBP".freeze
82
+ GEL = "GEL".freeze
83
+ GHS = "GHS".freeze
84
+ GIP = "GIP".freeze
85
+ GMD = "GMD".freeze
86
+ GNF = "GNF".freeze
87
+ GTQ = "GTQ".freeze
88
+ GYD = "GYD".freeze
89
+ HKD = "HKD".freeze
90
+ HNL = "HNL".freeze
91
+ HRK = "HRK".freeze
92
+ HTG = "HTG".freeze
93
+ HUF = "HUF".freeze
94
+ IDR = "IDR".freeze
95
+ ILS = "ILS".freeze
96
+ INR = "INR".freeze
97
+ IQD = "IQD".freeze
98
+ IRR = "IRR".freeze
99
+ ISK = "ISK".freeze
100
+ JMD = "JMD".freeze
101
+ JOD = "JOD".freeze
102
+ JPY = "JPY".freeze
103
+ KES = "KES".freeze
104
+ KGS = "KGS".freeze
105
+ KHR = "KHR".freeze
106
+ KMF = "KMF".freeze
107
+ KPW = "KPW".freeze
108
+ KRW = "KRW".freeze
109
+ KWD = "KWD".freeze
110
+ KYD = "KYD".freeze
111
+ KZT = "KZT".freeze
112
+ LAK = "LAK".freeze
113
+ LBP = "LBP".freeze
114
+ LKR = "LKR".freeze
115
+ LRD = "LRD".freeze
116
+ LSL = "LSL".freeze
117
+ LYD = "LYD".freeze
118
+ MAD = "MAD".freeze
119
+ MDL = "MDL".freeze
120
+ MGA = "MGA".freeze
121
+ MKD = "MKD".freeze
122
+ MMK = "MMK".freeze
123
+ MNT = "MNT".freeze
124
+ MOP = "MOP".freeze
125
+ MRO = "MRO".freeze
126
+ MUR = "MUR".freeze
127
+ MVR = "MVR".freeze
128
+ MWK = "MWK".freeze
129
+ MXN = "MXN".freeze
130
+ MXV = "MXV".freeze
131
+ MYR = "MYR".freeze
132
+ MZN = "MZN".freeze
133
+ NAD = "NAD".freeze
134
+ NGN = "NGN".freeze
135
+ NIO = "NIO".freeze
136
+ NOK = "NOK".freeze
137
+ NPR = "NPR".freeze
138
+ NZD = "NZD".freeze
139
+ OMR = "OMR".freeze
140
+ PAB = "PAB".freeze
141
+ PEN = "PEN".freeze
142
+ PGK = "PGK".freeze
143
+ PHP = "PHP".freeze
144
+ PKR = "PKR".freeze
145
+ PLN = "PLN".freeze
146
+ PYG = "PYG".freeze
147
+ QAR = "QAR".freeze
148
+ RON = "RON".freeze
149
+ RSD = "RSD".freeze
150
+ RUB = "RUB".freeze
151
+ RWF = "RWF".freeze
152
+ SAR = "SAR".freeze
153
+ SBD = "SBD".freeze
154
+ SCR = "SCR".freeze
155
+ SDG = "SDG".freeze
156
+ SEK = "SEK".freeze
157
+ SGD = "SGD".freeze
158
+ SHP = "SHP".freeze
159
+ SLL = "SLL".freeze
160
+ SOS = "SOS".freeze
161
+ SRD = "SRD".freeze
162
+ SSP = "SSP".freeze
163
+ STD = "STD".freeze
164
+ SYP = "SYP".freeze
165
+ SZL = "SZL".freeze
166
+ THB = "THB".freeze
167
+ TJS = "TJS".freeze
168
+ TMT = "TMT".freeze
169
+ TND = "TND".freeze
170
+ TOP = "TOP".freeze
171
+ TRY = "TRY".freeze
172
+ TTD = "TTD".freeze
173
+ TWD = "TWD".freeze
174
+ TZS = "TZS".freeze
175
+ UAH = "UAH".freeze
176
+ UGX = "UGX".freeze
177
+ USD = "USD".freeze
178
+ USN = "USN".freeze
179
+ UYI = "UYI".freeze
180
+ UYU = "UYU".freeze
181
+ UZS = "UZS".freeze
182
+ VEF = "VEF".freeze
183
+ VND = "VND".freeze
184
+ VUV = "VUV".freeze
185
+ WST = "WST".freeze
186
+ XAF = "XAF".freeze
187
+ XAG = "XAG".freeze
188
+ XAU = "XAU".freeze
189
+ XBA = "XBA".freeze
190
+ XBB = "XBB".freeze
191
+ XBC = "XBC".freeze
192
+ XBD = "XBD".freeze
193
+ XCD = "XCD".freeze
194
+ XDR = "XDR".freeze
195
+ XFU = "XFU".freeze
196
+ XOF = "XOF".freeze
197
+ XPD = "XPD".freeze
198
+ XPF = "XPF".freeze
199
+ XPT = "XPT".freeze
200
+ XSU = "XSU".freeze
201
+ XTS = "XTS".freeze
202
+ XUA = "XUA".freeze
203
+ XXX = "XXX".freeze
204
+ YER = "YER".freeze
205
+ ZAR = "ZAR".freeze
206
+ ZMW = "ZMW".freeze
207
+ end
208
+
209
+ end
@@ -0,0 +1,208 @@
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 ErrorModel
29
+ attr_accessor :source
30
+
31
+ attr_accessor :details
32
+
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'source' => :'source',
38
+ :'details' => :'details'
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.swagger_types
44
+ {
45
+ :'source' => :'String',
46
+ :'details' => :'String'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
57
+
58
+ if attributes.has_key?(:'source')
59
+ self.source = attributes[:'source']
60
+ end
61
+
62
+ if attributes.has_key?(:'details')
63
+ self.details = attributes[:'details']
64
+ end
65
+
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properies with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ return invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ return true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ source == o.source &&
87
+ details == o.details
88
+ end
89
+
90
+ # @see the `==` method
91
+ # @param [Object] Object to be compared
92
+ def eql?(o)
93
+ self == o
94
+ end
95
+
96
+ # Calculates hash code according to all attributes.
97
+ # @return [Fixnum] Hash code
98
+ def hash
99
+ [source, details].hash
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ self.class.swagger_types.each_pair do |key, type|
108
+ if type =~ /^Array<(.*)>/i
109
+ # check to ensure the input is an array given that the the attribute
110
+ # is documented as an array but the input is not
111
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
112
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
113
+ end
114
+ elsif !attributes[self.class.attribute_map[key]].nil?
115
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
117
+ end
118
+
119
+ self
120
+ end
121
+
122
+ # Deserializes the data based on type
123
+ # @param string type Data type
124
+ # @param string value Value to be deserialized
125
+ # @return [Object] Deserialized data
126
+ def _deserialize(type, value)
127
+ case type.to_sym
128
+ when :DateTime
129
+ DateTime.parse(value)
130
+ when :Date
131
+ Date.parse(value)
132
+ when :String
133
+ value.to_s
134
+ when :Integer
135
+ value.to_i
136
+ when :Float
137
+ value.to_f
138
+ when :BOOLEAN
139
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
140
+ true
141
+ else
142
+ false
143
+ end
144
+ when :Object
145
+ # generic object (usually a Hash), return directly
146
+ value
147
+ when /\AArray<(?<inner_type>.+)>\z/
148
+ inner_type = Regexp.last_match[:inner_type]
149
+ value.map { |v| _deserialize(inner_type, v) }
150
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
151
+ k_type = Regexp.last_match[:k_type]
152
+ v_type = Regexp.last_match[:v_type]
153
+ {}.tap do |hash|
154
+ value.each do |k, v|
155
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
156
+ end
157
+ end
158
+ else # model
159
+ temp_model = StorecoveApi.const_get(type).new
160
+ temp_model.build_from_hash(value)
161
+ end
162
+ end
163
+
164
+ # Returns the string representation of the object
165
+ # @return [String] String presentation of the object
166
+ def to_s
167
+ to_hash.to_s
168
+ end
169
+
170
+ # to_body is an alias to to_hash (backward compatibility)
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_body
173
+ to_hash
174
+ end
175
+
176
+ # Returns the object in the form of hash
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_hash
179
+ hash = {}
180
+ self.class.attribute_map.each_pair do |attr, param|
181
+ value = self.send(attr)
182
+ next if value.nil?
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ # Outputs non-array value in the form of hash
189
+ # For object, use to_hash. Otherwise, just return the value
190
+ # @param [Object] value Any valid value
191
+ # @return [Hash] Returns the value in the form of hash
192
+ def _to_hash(value)
193
+ if value.is_a?(Array)
194
+ value.compact.map{ |v| _to_hash(v) }
195
+ elsif value.is_a?(Hash)
196
+ {}.tap do |hash|
197
+ value.each { |k, v| hash[k] = _to_hash(v) }
198
+ end
199
+ elsif value.respond_to? :to_hash
200
+ value.to_hash
201
+ else
202
+ value
203
+ end
204
+ end
205
+
206
+ end
207
+
208
+ end