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
@@ -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
|
|
@@ -74,7 +75,7 @@ module StorecoveApi
|
|
74
75
|
end
|
75
76
|
|
76
77
|
# Show invalid properties with the reasons. Usually used together with valid?
|
77
|
-
# @return Array for valid
|
78
|
+
# @return Array for valid properties with the reasons
|
78
79
|
def list_invalid_properties
|
79
80
|
invalid_properties = Array.new
|
80
81
|
if !@code.nil? && @code.to_s.length < 1
|
@@ -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
|
|
@@ -55,7 +56,7 @@ module StorecoveApi
|
|
55
56
|
end
|
56
57
|
|
57
58
|
# Show invalid properties with the reasons. Usually used together with valid?
|
58
|
-
# @return Array for valid
|
59
|
+
# @return Array for valid properties with the reasons
|
59
60
|
def list_invalid_properties
|
60
61
|
invalid_properties = Array.new
|
61
62
|
if @party.nil?
|
@@ -0,0 +1,219 @@
|
|
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
|
+
# The accounting details for the invoice.
|
17
|
+
class AccountingDetails
|
18
|
+
# The the code of the general ledger account for this invoice.
|
19
|
+
attr_accessor :code
|
20
|
+
|
21
|
+
# A textual descroption of the code.
|
22
|
+
attr_accessor :name
|
23
|
+
|
24
|
+
# The name of the list for the code, e.g. \"RGS\".
|
25
|
+
attr_accessor :list
|
26
|
+
|
27
|
+
# The version of the list for the code, e.g. \"1.1\".
|
28
|
+
attr_accessor :list_version
|
29
|
+
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'code' => :'code',
|
35
|
+
:'name' => :'name',
|
36
|
+
:'list' => :'list',
|
37
|
+
:'list_version' => :'list_version'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.swagger_types
|
43
|
+
{
|
44
|
+
:'code' => :'String',
|
45
|
+
:'name' => :'String',
|
46
|
+
:'list' => :'String',
|
47
|
+
:'list_version' => :'String'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
return unless attributes.is_a?(Hash)
|
55
|
+
|
56
|
+
# convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
58
|
+
|
59
|
+
if attributes.has_key?(:'code')
|
60
|
+
self.code = attributes[:'code']
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes.has_key?(:'name')
|
64
|
+
self.name = attributes[:'name']
|
65
|
+
end
|
66
|
+
|
67
|
+
if attributes.has_key?(:'list')
|
68
|
+
self.list = attributes[:'list']
|
69
|
+
end
|
70
|
+
|
71
|
+
if attributes.has_key?(:'list_version')
|
72
|
+
self.list_version = attributes[:'list_version']
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
78
|
+
# @return Array for valid properties with the reasons
|
79
|
+
def list_invalid_properties
|
80
|
+
invalid_properties = Array.new
|
81
|
+
return invalid_properties
|
82
|
+
end
|
83
|
+
|
84
|
+
# Check to see if the all the properties in the model are valid
|
85
|
+
# @return true if the model is valid
|
86
|
+
def valid?
|
87
|
+
return true
|
88
|
+
end
|
89
|
+
|
90
|
+
# Checks equality by comparing each attribute.
|
91
|
+
# @param [Object] Object to be compared
|
92
|
+
def ==(o)
|
93
|
+
return true if self.equal?(o)
|
94
|
+
self.class == o.class &&
|
95
|
+
code == o.code &&
|
96
|
+
name == o.name &&
|
97
|
+
list == o.list &&
|
98
|
+
list_version == o.list_version
|
99
|
+
end
|
100
|
+
|
101
|
+
# @see the `==` method
|
102
|
+
# @param [Object] Object to be compared
|
103
|
+
def eql?(o)
|
104
|
+
self == o
|
105
|
+
end
|
106
|
+
|
107
|
+
# Calculates hash code according to all attributes.
|
108
|
+
# @return [Fixnum] Hash code
|
109
|
+
def hash
|
110
|
+
[code, name, list, list_version].hash
|
111
|
+
end
|
112
|
+
|
113
|
+
# Builds the object from hash
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
+
# @return [Object] Returns the model itself
|
116
|
+
def build_from_hash(attributes)
|
117
|
+
return nil unless attributes.is_a?(Hash)
|
118
|
+
self.class.swagger_types.each_pair do |key, type|
|
119
|
+
if type =~ /\AArray<(.*)>/i
|
120
|
+
# check to ensure the input is an array given that the the attribute
|
121
|
+
# is documented as an array but the input is not
|
122
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
123
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
124
|
+
end
|
125
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
126
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
127
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
128
|
+
end
|
129
|
+
|
130
|
+
self
|
131
|
+
end
|
132
|
+
|
133
|
+
# Deserializes the data based on type
|
134
|
+
# @param string type Data type
|
135
|
+
# @param string value Value to be deserialized
|
136
|
+
# @return [Object] Deserialized data
|
137
|
+
def _deserialize(type, value)
|
138
|
+
case type.to_sym
|
139
|
+
when :DateTime
|
140
|
+
DateTime.parse(value)
|
141
|
+
when :Date
|
142
|
+
Date.parse(value)
|
143
|
+
when :String
|
144
|
+
value.to_s
|
145
|
+
when :Integer
|
146
|
+
value.to_i
|
147
|
+
when :Float
|
148
|
+
value.to_f
|
149
|
+
when :BOOLEAN
|
150
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
151
|
+
true
|
152
|
+
else
|
153
|
+
false
|
154
|
+
end
|
155
|
+
when :Object
|
156
|
+
# generic object (usually a Hash), return directly
|
157
|
+
value
|
158
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
159
|
+
inner_type = Regexp.last_match[:inner_type]
|
160
|
+
value.map { |v| _deserialize(inner_type, v) }
|
161
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
162
|
+
k_type = Regexp.last_match[:k_type]
|
163
|
+
v_type = Regexp.last_match[:v_type]
|
164
|
+
{}.tap do |hash|
|
165
|
+
value.each do |k, v|
|
166
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
else # model
|
170
|
+
temp_model = StorecoveApi.const_get(type).new
|
171
|
+
temp_model.build_from_hash(value)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# Returns the string representation of the object
|
176
|
+
# @return [String] String presentation of the object
|
177
|
+
def to_s
|
178
|
+
to_hash.to_s
|
179
|
+
end
|
180
|
+
|
181
|
+
# to_body is an alias to to_hash (backward compatibility)
|
182
|
+
# @return [Hash] Returns the object in the form of hash
|
183
|
+
def to_body
|
184
|
+
to_hash
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns the object in the form of hash
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_hash
|
190
|
+
hash = {}
|
191
|
+
self.class.attribute_map.each_pair do |attr, param|
|
192
|
+
value = self.send(attr)
|
193
|
+
next if value.nil?
|
194
|
+
hash[param] = _to_hash(value)
|
195
|
+
end
|
196
|
+
hash
|
197
|
+
end
|
198
|
+
|
199
|
+
# Outputs non-array value in the form of hash
|
200
|
+
# For object, use to_hash. Otherwise, just return the value
|
201
|
+
# @param [Object] value Any valid value
|
202
|
+
# @return [Hash] Returns the value in the form of hash
|
203
|
+
def _to_hash(value)
|
204
|
+
if value.is_a?(Array)
|
205
|
+
value.compact.map{ |v| _to_hash(v) }
|
206
|
+
elsif value.is_a?(Hash)
|
207
|
+
{}.tap do |hash|
|
208
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
209
|
+
end
|
210
|
+
elsif value.respond_to? :to_hash
|
211
|
+
value.to_hash
|
212
|
+
else
|
213
|
+
value
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
@@ -0,0 +1,219 @@
|
|
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
|
+
# The accounting details for the invoice line.
|
17
|
+
class AccountingDetails1
|
18
|
+
# The the code of the general ledger account for this invoice line.
|
19
|
+
attr_accessor :code
|
20
|
+
|
21
|
+
# A textual descroption of the code.
|
22
|
+
attr_accessor :name
|
23
|
+
|
24
|
+
# The name of the list for the code, e.g. \"RGS\".
|
25
|
+
attr_accessor :list
|
26
|
+
|
27
|
+
# The version of the list for the code, e.g. \"1.1\".
|
28
|
+
attr_accessor :list_version
|
29
|
+
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'code' => :'code',
|
35
|
+
:'name' => :'name',
|
36
|
+
:'list' => :'list',
|
37
|
+
:'list_version' => :'list_version'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.swagger_types
|
43
|
+
{
|
44
|
+
:'code' => :'String',
|
45
|
+
:'name' => :'String',
|
46
|
+
:'list' => :'String',
|
47
|
+
:'list_version' => :'String'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
return unless attributes.is_a?(Hash)
|
55
|
+
|
56
|
+
# convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
58
|
+
|
59
|
+
if attributes.has_key?(:'code')
|
60
|
+
self.code = attributes[:'code']
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes.has_key?(:'name')
|
64
|
+
self.name = attributes[:'name']
|
65
|
+
end
|
66
|
+
|
67
|
+
if attributes.has_key?(:'list')
|
68
|
+
self.list = attributes[:'list']
|
69
|
+
end
|
70
|
+
|
71
|
+
if attributes.has_key?(:'list_version')
|
72
|
+
self.list_version = attributes[:'list_version']
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
78
|
+
# @return Array for valid properties with the reasons
|
79
|
+
def list_invalid_properties
|
80
|
+
invalid_properties = Array.new
|
81
|
+
return invalid_properties
|
82
|
+
end
|
83
|
+
|
84
|
+
# Check to see if the all the properties in the model are valid
|
85
|
+
# @return true if the model is valid
|
86
|
+
def valid?
|
87
|
+
return true
|
88
|
+
end
|
89
|
+
|
90
|
+
# Checks equality by comparing each attribute.
|
91
|
+
# @param [Object] Object to be compared
|
92
|
+
def ==(o)
|
93
|
+
return true if self.equal?(o)
|
94
|
+
self.class == o.class &&
|
95
|
+
code == o.code &&
|
96
|
+
name == o.name &&
|
97
|
+
list == o.list &&
|
98
|
+
list_version == o.list_version
|
99
|
+
end
|
100
|
+
|
101
|
+
# @see the `==` method
|
102
|
+
# @param [Object] Object to be compared
|
103
|
+
def eql?(o)
|
104
|
+
self == o
|
105
|
+
end
|
106
|
+
|
107
|
+
# Calculates hash code according to all attributes.
|
108
|
+
# @return [Fixnum] Hash code
|
109
|
+
def hash
|
110
|
+
[code, name, list, list_version].hash
|
111
|
+
end
|
112
|
+
|
113
|
+
# Builds the object from hash
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
+
# @return [Object] Returns the model itself
|
116
|
+
def build_from_hash(attributes)
|
117
|
+
return nil unless attributes.is_a?(Hash)
|
118
|
+
self.class.swagger_types.each_pair do |key, type|
|
119
|
+
if type =~ /\AArray<(.*)>/i
|
120
|
+
# check to ensure the input is an array given that the the attribute
|
121
|
+
# is documented as an array but the input is not
|
122
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
123
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
124
|
+
end
|
125
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
126
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
127
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
128
|
+
end
|
129
|
+
|
130
|
+
self
|
131
|
+
end
|
132
|
+
|
133
|
+
# Deserializes the data based on type
|
134
|
+
# @param string type Data type
|
135
|
+
# @param string value Value to be deserialized
|
136
|
+
# @return [Object] Deserialized data
|
137
|
+
def _deserialize(type, value)
|
138
|
+
case type.to_sym
|
139
|
+
when :DateTime
|
140
|
+
DateTime.parse(value)
|
141
|
+
when :Date
|
142
|
+
Date.parse(value)
|
143
|
+
when :String
|
144
|
+
value.to_s
|
145
|
+
when :Integer
|
146
|
+
value.to_i
|
147
|
+
when :Float
|
148
|
+
value.to_f
|
149
|
+
when :BOOLEAN
|
150
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
151
|
+
true
|
152
|
+
else
|
153
|
+
false
|
154
|
+
end
|
155
|
+
when :Object
|
156
|
+
# generic object (usually a Hash), return directly
|
157
|
+
value
|
158
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
159
|
+
inner_type = Regexp.last_match[:inner_type]
|
160
|
+
value.map { |v| _deserialize(inner_type, v) }
|
161
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
162
|
+
k_type = Regexp.last_match[:k_type]
|
163
|
+
v_type = Regexp.last_match[:v_type]
|
164
|
+
{}.tap do |hash|
|
165
|
+
value.each do |k, v|
|
166
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
else # model
|
170
|
+
temp_model = StorecoveApi.const_get(type).new
|
171
|
+
temp_model.build_from_hash(value)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# Returns the string representation of the object
|
176
|
+
# @return [String] String presentation of the object
|
177
|
+
def to_s
|
178
|
+
to_hash.to_s
|
179
|
+
end
|
180
|
+
|
181
|
+
# to_body is an alias to to_hash (backward compatibility)
|
182
|
+
# @return [Hash] Returns the object in the form of hash
|
183
|
+
def to_body
|
184
|
+
to_hash
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns the object in the form of hash
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_hash
|
190
|
+
hash = {}
|
191
|
+
self.class.attribute_map.each_pair do |attr, param|
|
192
|
+
value = self.send(attr)
|
193
|
+
next if value.nil?
|
194
|
+
hash[param] = _to_hash(value)
|
195
|
+
end
|
196
|
+
hash
|
197
|
+
end
|
198
|
+
|
199
|
+
# Outputs non-array value in the form of hash
|
200
|
+
# For object, use to_hash. Otherwise, just return the value
|
201
|
+
# @param [Object] value Any valid value
|
202
|
+
# @return [Hash] Returns the value in the form of hash
|
203
|
+
def _to_hash(value)
|
204
|
+
if value.is_a?(Array)
|
205
|
+
value.compact.map{ |v| _to_hash(v) }
|
206
|
+
elsif value.is_a?(Hash)
|
207
|
+
{}.tap do |hash|
|
208
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
209
|
+
end
|
210
|
+
elsif value.respond_to? :to_hash
|
211
|
+
value.to_hash
|
212
|
+
else
|
213
|
+
value
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|