ultracart_api 4.1.259 → 4.1.261

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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -2
  3. data/docs/FraudApi.md +2 -2
  4. data/docs/OrderApi.md +191 -0
  5. data/docs/OrderCancelRequest.md +22 -0
  6. data/docs/OrderProcessPaymentRequest.md +3 -1
  7. data/docs/SfvbApi.md +224 -0
  8. data/docs/SfvbApprovalCreateRequest.md +2 -0
  9. data/docs/SfvbItemTranslation.md +28 -0
  10. data/docs/SfvbItemTranslationBatchRequest.md +20 -0
  11. data/docs/SfvbItemTranslationBatchResponse.md +46 -0
  12. data/docs/SfvbItemTranslationBatchRow.md +28 -0
  13. data/docs/SfvbItemTranslationBatchRowResult.md +34 -0
  14. data/docs/SfvbItemTranslationField.md +22 -0
  15. data/docs/SfvbItemTranslationWriteRequest.md +26 -0
  16. data/docs/SfvbItemTranslationsResponse.md +26 -0
  17. data/lib/ultracart_api/api/fraud_api.rb +4 -4
  18. data/lib/ultracart_api/api/order_api.rb +139 -0
  19. data/lib/ultracart_api/api/sfvb_api.rb +308 -0
  20. data/lib/ultracart_api/models/order_cancel_request.rb +240 -0
  21. data/lib/ultracart_api/models/order_process_payment_request.rb +14 -4
  22. data/lib/ultracart_api/models/sfvb_approval_create_request.rb +15 -3
  23. data/lib/ultracart_api/models/sfvb_item_translation.rb +316 -0
  24. data/lib/ultracart_api/models/sfvb_item_translation_batch_request.rb +232 -0
  25. data/lib/ultracart_api/models/sfvb_item_translation_batch_response.rb +366 -0
  26. data/lib/ultracart_api/models/sfvb_item_translation_batch_row.rb +304 -0
  27. data/lib/ultracart_api/models/sfvb_item_translation_batch_row_result.rb +346 -0
  28. data/lib/ultracart_api/models/sfvb_item_translation_field.rb +276 -0
  29. data/lib/ultracart_api/models/sfvb_item_translation_write_request.rb +294 -0
  30. data/lib/ultracart_api/models/sfvb_item_translations_response.rb +264 -0
  31. data/lib/ultracart_api/version.rb +1 -1
  32. data/lib/ultracart_api.rb +9 -0
  33. metadata +20 -2
@@ -0,0 +1,240 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class OrderCancelRequest
18
+ # Flag to prevent a order shipping during a refund process
19
+ attr_accessor :lock_self_ship_orders
20
+
21
+ # Reason stored on the order when it is rejected without a refund (Accounts Receivable, Pre-order, Quote or Hold), the same as the reject reason in the UI.
22
+ attr_accessor :reject_reason
23
+
24
+ # Skip refund and move order to Held Orders department
25
+ attr_accessor :skip_refund_and_hold
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'lock_self_ship_orders' => :'lock_self_ship_orders',
31
+ :'reject_reason' => :'reject_reason',
32
+ :'skip_refund_and_hold' => :'skip_refund_and_hold'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'lock_self_ship_orders' => :'Boolean',
45
+ :'reject_reason' => :'String',
46
+ :'skip_refund_and_hold' => :'Boolean'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::OrderCancelRequest` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::OrderCancelRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'lock_self_ship_orders')
72
+ self.lock_self_ship_orders = attributes[:'lock_self_ship_orders']
73
+ end
74
+
75
+ if attributes.key?(:'reject_reason')
76
+ self.reject_reason = attributes[:'reject_reason']
77
+ end
78
+
79
+ if attributes.key?(:'skip_refund_and_hold')
80
+ self.skip_refund_and_hold = attributes[:'skip_refund_and_hold']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ lock_self_ship_orders == o.lock_self_ship_orders &&
103
+ reject_reason == o.reject_reason &&
104
+ skip_refund_and_hold == o.skip_refund_and_hold
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [lock_self_ship_orders, reject_reason, skip_refund_and_hold].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ new.build_from_hash(attributes)
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ attributes = attributes.transform_keys(&:to_sym)
132
+ self.class.openapi_types.each_pair do |key, type|
133
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
134
+ self.send("#{key}=", nil)
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :Time
156
+ Time.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :Boolean
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ # models (e.g. Pet) or oneOf
187
+ klass = UltracartClient.const_get(type)
188
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ if value.nil?
211
+ is_nullable = self.class.openapi_nullable.include?(attr)
212
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
213
+ end
214
+
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+
238
+ end
239
+
240
+ end
@@ -21,11 +21,15 @@ module UltracartClient
21
21
  # Card verification number token from hosted fields used during credit card transaction processing (optional)
22
22
  attr_accessor :card_verification_number_token
23
23
 
24
+ # Rotating transaction gateway code to process the payment through (optional). Must be an active rotating transaction gateway on the account. The charge is attempted on that gateway only, without cascading to other gateways, the same as choosing a gateway on the Accounts Receivable Process Payment screen.
25
+ attr_accessor :rotating_transaction_gateway_code
26
+
24
27
  # Attribute mapping from ruby-style variable name to JSON key.
25
28
  def self.attribute_map
26
29
  {
27
30
  :'amount' => :'amount',
28
- :'card_verification_number_token' => :'card_verification_number_token'
31
+ :'card_verification_number_token' => :'card_verification_number_token',
32
+ :'rotating_transaction_gateway_code' => :'rotating_transaction_gateway_code'
29
33
  }
30
34
  end
31
35
 
@@ -38,7 +42,8 @@ module UltracartClient
38
42
  def self.openapi_types
39
43
  {
40
44
  :'amount' => :'Float',
41
- :'card_verification_number_token' => :'String'
45
+ :'card_verification_number_token' => :'String',
46
+ :'rotating_transaction_gateway_code' => :'String'
42
47
  }
43
48
  end
44
49
 
@@ -70,6 +75,10 @@ module UltracartClient
70
75
  if attributes.key?(:'card_verification_number_token')
71
76
  self.card_verification_number_token = attributes[:'card_verification_number_token']
72
77
  end
78
+
79
+ if attributes.key?(:'rotating_transaction_gateway_code')
80
+ self.rotating_transaction_gateway_code = attributes[:'rotating_transaction_gateway_code']
81
+ end
73
82
  end
74
83
 
75
84
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -91,7 +100,8 @@ module UltracartClient
91
100
  return true if self.equal?(o)
92
101
  self.class == o.class &&
93
102
  amount == o.amount &&
94
- card_verification_number_token == o.card_verification_number_token
103
+ card_verification_number_token == o.card_verification_number_token &&
104
+ rotating_transaction_gateway_code == o.rotating_transaction_gateway_code
95
105
  end
96
106
 
97
107
  # @see the `==` method
@@ -103,7 +113,7 @@ module UltracartClient
103
113
  # Calculates hash code according to all attributes.
104
114
  # @return [Integer] Hash code
105
115
  def hash
106
- [amount, card_verification_number_token].hash
116
+ [amount, card_verification_number_token, rotating_transaction_gateway_code].hash
107
117
  end
108
118
 
109
119
  # Builds the object from hash
@@ -46,6 +46,9 @@ module UltracartClient
46
46
 
47
47
  attr_accessor :item_pricing
48
48
 
49
+ # For item.translation_batch, exactly the rows the batch will send - the dry run's change rows, each with merchant_item_oid, field, language, text and current_sha256. UltraCart keeps only their hash.
50
+ attr_accessor :item_translation_rows
51
+
49
52
  attr_accessor :item_variations
50
53
 
51
54
  attr_accessor :params
@@ -106,6 +109,7 @@ module UltracartClient
106
109
  :'item_preorder' => :'item_preorder',
107
110
  :'item_preorder_children' => :'item_preorder_children',
108
111
  :'item_pricing' => :'item_pricing',
112
+ :'item_translation_rows' => :'item_translation_rows',
109
113
  :'item_variations' => :'item_variations',
110
114
  :'params' => :'params',
111
115
  :'postcard_test_mail' => :'postcard_test_mail',
@@ -140,6 +144,7 @@ module UltracartClient
140
144
  :'item_preorder' => :'SfvbItemPreorderRequest',
141
145
  :'item_preorder_children' => :'SfvbItemPreorderChildrenRequest',
142
146
  :'item_pricing' => :'SfvbItemPricingRequest',
147
+ :'item_translation_rows' => :'Array<SfvbItemTranslationBatchRow>',
143
148
  :'item_variations' => :'SfvbItemVariationsRequest',
144
149
  :'params' => :'SfvbApprovalParams',
145
150
  :'postcard_test_mail' => :'SfvbCommsTestPostcardRequest',
@@ -230,6 +235,12 @@ module UltracartClient
230
235
  self.item_pricing = attributes[:'item_pricing']
231
236
  end
232
237
 
238
+ if attributes.key?(:'item_translation_rows')
239
+ if (value = attributes[:'item_translation_rows']).is_a?(Array)
240
+ self.item_translation_rows = value
241
+ end
242
+ end
243
+
233
244
  if attributes.key?(:'item_variations')
234
245
  self.item_variations = attributes[:'item_variations']
235
246
  end
@@ -283,7 +294,7 @@ module UltracartClient
283
294
  # Check to see if the all the properties in the model are valid
284
295
  # @return true if the model is valid
285
296
  def valid?
286
- action_validator = EnumAttributeValidator.new('String', ["file.delete", "blog_post.delete", "file.put_script", "file.put_template", "redirect.delete_batch", "experiment.start", "experiment.end", "upsell.enable", "item.attribute_batch", "item.pricing", "item.preorder", "item.variations", "item.default_page", "twilio_account.delete", "sending_domain.delete", "sequence_step.delete", "sequence_step.move", "sequence_step.enable_postcard", "segment.update", "smart_attribution.change", "smart_attribution.delete", "tracking_provider.change", "tracking_provider.clear", "tracking_html.put", "affiliate_network.change", "affiliate_network.delete", "site_seo.change", "transactional_email.update", "comms_settings.update", "comms_list.import", "postcard.test_mail", "flow.backfill", "page.move", "storefront_cache.flush", "cli.location"])
297
+ action_validator = EnumAttributeValidator.new('String', ["file.delete", "blog_post.delete", "file.put_script", "file.put_template", "redirect.delete_batch", "experiment.start", "experiment.end", "upsell.enable", "item.attribute_batch", "item.pricing", "item.preorder", "item.variations", "item.default_page", "item.translation_batch", "twilio_account.delete", "sending_domain.delete", "sequence_step.delete", "sequence_step.move", "sequence_step.enable_postcard", "segment.update", "smart_attribution.change", "smart_attribution.delete", "tracking_provider.change", "tracking_provider.clear", "tracking_html.put", "affiliate_network.change", "affiliate_network.delete", "site_seo.change", "transactional_email.update", "comms_settings.update", "comms_list.import", "postcard.test_mail", "flow.backfill", "page.move", "storefront_cache.flush", "cli.location"])
287
298
  return false unless action_validator.valid?(@action)
288
299
  true
289
300
  end
@@ -291,7 +302,7 @@ module UltracartClient
291
302
  # Custom attribute writer method checking allowed values (enum).
292
303
  # @param [Object] action Object to be assigned
293
304
  def action=(action)
294
- validator = EnumAttributeValidator.new('String', ["file.delete", "blog_post.delete", "file.put_script", "file.put_template", "redirect.delete_batch", "experiment.start", "experiment.end", "upsell.enable", "item.attribute_batch", "item.pricing", "item.preorder", "item.variations", "item.default_page", "twilio_account.delete", "sending_domain.delete", "sequence_step.delete", "sequence_step.move", "sequence_step.enable_postcard", "segment.update", "smart_attribution.change", "smart_attribution.delete", "tracking_provider.change", "tracking_provider.clear", "tracking_html.put", "affiliate_network.change", "affiliate_network.delete", "site_seo.change", "transactional_email.update", "comms_settings.update", "comms_list.import", "postcard.test_mail", "flow.backfill", "page.move", "storefront_cache.flush", "cli.location"])
305
+ validator = EnumAttributeValidator.new('String', ["file.delete", "blog_post.delete", "file.put_script", "file.put_template", "redirect.delete_batch", "experiment.start", "experiment.end", "upsell.enable", "item.attribute_batch", "item.pricing", "item.preorder", "item.variations", "item.default_page", "item.translation_batch", "twilio_account.delete", "sending_domain.delete", "sequence_step.delete", "sequence_step.move", "sequence_step.enable_postcard", "segment.update", "smart_attribution.change", "smart_attribution.delete", "tracking_provider.change", "tracking_provider.clear", "tracking_html.put", "affiliate_network.change", "affiliate_network.delete", "site_seo.change", "transactional_email.update", "comms_settings.update", "comms_list.import", "postcard.test_mail", "flow.backfill", "page.move", "storefront_cache.flush", "cli.location"])
295
306
  unless validator.valid?(action)
296
307
  fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
297
308
  end
@@ -316,6 +327,7 @@ module UltracartClient
316
327
  item_preorder == o.item_preorder &&
317
328
  item_preorder_children == o.item_preorder_children &&
318
329
  item_pricing == o.item_pricing &&
330
+ item_translation_rows == o.item_translation_rows &&
319
331
  item_variations == o.item_variations &&
320
332
  params == o.params &&
321
333
  postcard_test_mail == o.postcard_test_mail &&
@@ -337,7 +349,7 @@ module UltracartClient
337
349
  # Calculates hash code according to all attributes.
338
350
  # @return [Integer] Hash code
339
351
  def hash
340
- [action, affiliate_network, comms_list_import, comms_settings, content, delegate_email, experiment_start, flow_backfill, item_attribute_rows, item_default_page_rows, item_preorder, item_preorder_children, item_pricing, item_variations, params, postcard_test_mail, reason, redirect_rows, segment_update, site_seo, smart_attribution, tracking_provider, transactional_email].hash
352
+ [action, affiliate_network, comms_list_import, comms_settings, content, delegate_email, experiment_start, flow_backfill, item_attribute_rows, item_default_page_rows, item_preorder, item_preorder_children, item_pricing, item_translation_rows, item_variations, params, postcard_test_mail, reason, redirect_rows, segment_update, site_seo, smart_attribution, tracking_provider, transactional_email].hash
341
353
  end
342
354
 
343
355
  # Builds the object from hash
@@ -0,0 +1,316 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class SfvbItemTranslation
18
+ # What the item editor's translation dialog shows, which a save there copies to shoppers.
19
+ attr_accessor :editor_source
20
+
21
+ # The text the item editor's translation dialog shows.
22
+ attr_accessor :editor_text
23
+
24
+ # True when either store holds a hand translation. A batch skips this field and language.
25
+ attr_accessor :hand_protected
26
+
27
+ # The three-letter language code, such as CHI or JPN.
28
+ attr_accessor :language
29
+
30
+ # Where shoppers' text comes from now.
31
+ attr_accessor :source
32
+
33
+ # The text shoppers see in this language. Absent when pending or none.
34
+ attr_accessor :text
35
+
36
+ class EnumAttributeValidator
37
+ attr_reader :datatype
38
+ attr_reader :allowable_values
39
+
40
+ def initialize(datatype, allowable_values)
41
+ @allowable_values = allowable_values.map do |value|
42
+ case datatype.to_s
43
+ when /Integer/i
44
+ value.to_i
45
+ when /Float/i
46
+ value.to_f
47
+ else
48
+ value
49
+ end
50
+ end
51
+ end
52
+
53
+ def valid?(value)
54
+ !value || allowable_values.include?(value)
55
+ end
56
+ end
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'editor_source' => :'editor_source',
62
+ :'editor_text' => :'editor_text',
63
+ :'hand_protected' => :'hand_protected',
64
+ :'language' => :'language',
65
+ :'source' => :'source',
66
+ :'text' => :'text'
67
+ }
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'editor_source' => :'String',
79
+ :'editor_text' => :'String',
80
+ :'hand_protected' => :'Boolean',
81
+ :'language' => :'String',
82
+ :'source' => :'String',
83
+ :'text' => :'String'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbItemTranslation` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!self.class.attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbItemTranslation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'editor_source')
109
+ self.editor_source = attributes[:'editor_source']
110
+ end
111
+
112
+ if attributes.key?(:'editor_text')
113
+ self.editor_text = attributes[:'editor_text']
114
+ end
115
+
116
+ if attributes.key?(:'hand_protected')
117
+ self.hand_protected = attributes[:'hand_protected']
118
+ end
119
+
120
+ if attributes.key?(:'language')
121
+ self.language = attributes[:'language']
122
+ end
123
+
124
+ if attributes.key?(:'source')
125
+ self.source = attributes[:'source']
126
+ end
127
+
128
+ if attributes.key?(:'text')
129
+ self.text = attributes[:'text']
130
+ end
131
+ end
132
+
133
+ # Show invalid properties with the reasons. Usually used together with valid?
134
+ # @return Array for valid properties with the reasons
135
+ def list_invalid_properties
136
+ invalid_properties = Array.new
137
+ invalid_properties
138
+ end
139
+
140
+ # Check to see if the all the properties in the model are valid
141
+ # @return true if the model is valid
142
+ def valid?
143
+ editor_source_validator = EnumAttributeValidator.new('String', ["hand", "machine", "none"])
144
+ return false unless editor_source_validator.valid?(@editor_source)
145
+ source_validator = EnumAttributeValidator.new('String', ["hand", "machine", "pending", "none"])
146
+ return false unless source_validator.valid?(@source)
147
+ true
148
+ end
149
+
150
+ # Custom attribute writer method checking allowed values (enum).
151
+ # @param [Object] editor_source Object to be assigned
152
+ def editor_source=(editor_source)
153
+ validator = EnumAttributeValidator.new('String', ["hand", "machine", "none"])
154
+ unless validator.valid?(editor_source)
155
+ fail ArgumentError, "invalid value for \"editor_source\", must be one of #{validator.allowable_values}."
156
+ end
157
+ @editor_source = editor_source
158
+ end
159
+
160
+ # Custom attribute writer method checking allowed values (enum).
161
+ # @param [Object] source Object to be assigned
162
+ def source=(source)
163
+ validator = EnumAttributeValidator.new('String', ["hand", "machine", "pending", "none"])
164
+ unless validator.valid?(source)
165
+ fail ArgumentError, "invalid value for \"source\", must be one of #{validator.allowable_values}."
166
+ end
167
+ @source = source
168
+ end
169
+
170
+ # Checks equality by comparing each attribute.
171
+ # @param [Object] Object to be compared
172
+ def ==(o)
173
+ return true if self.equal?(o)
174
+ self.class == o.class &&
175
+ editor_source == o.editor_source &&
176
+ editor_text == o.editor_text &&
177
+ hand_protected == o.hand_protected &&
178
+ language == o.language &&
179
+ source == o.source &&
180
+ text == o.text
181
+ end
182
+
183
+ # @see the `==` method
184
+ # @param [Object] Object to be compared
185
+ def eql?(o)
186
+ self == o
187
+ end
188
+
189
+ # Calculates hash code according to all attributes.
190
+ # @return [Integer] Hash code
191
+ def hash
192
+ [editor_source, editor_text, hand_protected, language, source, text].hash
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def self.build_from_hash(attributes)
199
+ new.build_from_hash(attributes)
200
+ end
201
+
202
+ # Builds the object from hash
203
+ # @param [Hash] attributes Model attributes in the form of hash
204
+ # @return [Object] Returns the model itself
205
+ def build_from_hash(attributes)
206
+ return nil unless attributes.is_a?(Hash)
207
+ attributes = attributes.transform_keys(&:to_sym)
208
+ self.class.openapi_types.each_pair do |key, type|
209
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
210
+ self.send("#{key}=", nil)
211
+ elsif type =~ /\AArray<(.*)>/i
212
+ # check to ensure the input is an array given that the attribute
213
+ # is documented as an array but the input is not
214
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
215
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
216
+ end
217
+ elsif !attributes[self.class.attribute_map[key]].nil?
218
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
219
+ end
220
+ end
221
+
222
+ self
223
+ end
224
+
225
+ # Deserializes the data based on type
226
+ # @param string type Data type
227
+ # @param string value Value to be deserialized
228
+ # @return [Object] Deserialized data
229
+ def _deserialize(type, value)
230
+ case type.to_sym
231
+ when :Time
232
+ Time.parse(value)
233
+ when :Date
234
+ Date.parse(value)
235
+ when :String
236
+ value.to_s
237
+ when :Integer
238
+ value.to_i
239
+ when :Float
240
+ value.to_f
241
+ when :Boolean
242
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
243
+ true
244
+ else
245
+ false
246
+ end
247
+ when :Object
248
+ # generic object (usually a Hash), return directly
249
+ value
250
+ when /\AArray<(?<inner_type>.+)>\z/
251
+ inner_type = Regexp.last_match[:inner_type]
252
+ value.map { |v| _deserialize(inner_type, v) }
253
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
254
+ k_type = Regexp.last_match[:k_type]
255
+ v_type = Regexp.last_match[:v_type]
256
+ {}.tap do |hash|
257
+ value.each do |k, v|
258
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
259
+ end
260
+ end
261
+ else # model
262
+ # models (e.g. Pet) or oneOf
263
+ klass = UltracartClient.const_get(type)
264
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
265
+ end
266
+ end
267
+
268
+ # Returns the string representation of the object
269
+ # @return [String] String presentation of the object
270
+ def to_s
271
+ to_hash.to_s
272
+ end
273
+
274
+ # to_body is an alias to to_hash (backward compatibility)
275
+ # @return [Hash] Returns the object in the form of hash
276
+ def to_body
277
+ to_hash
278
+ end
279
+
280
+ # Returns the object in the form of hash
281
+ # @return [Hash] Returns the object in the form of hash
282
+ def to_hash
283
+ hash = {}
284
+ self.class.attribute_map.each_pair do |attr, param|
285
+ value = self.send(attr)
286
+ if value.nil?
287
+ is_nullable = self.class.openapi_nullable.include?(attr)
288
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
289
+ end
290
+
291
+ hash[param] = _to_hash(value)
292
+ end
293
+ hash
294
+ end
295
+
296
+ # Outputs non-array value in the form of hash
297
+ # For object, use to_hash. Otherwise, just return the value
298
+ # @param [Object] value Any valid value
299
+ # @return [Hash] Returns the value in the form of hash
300
+ def _to_hash(value)
301
+ if value.is_a?(Array)
302
+ value.compact.map { |v| _to_hash(v) }
303
+ elsif value.is_a?(Hash)
304
+ {}.tap do |hash|
305
+ value.each { |k, v| hash[k] = _to_hash(v) }
306
+ end
307
+ elsif value.respond_to? :to_hash
308
+ value.to_hash
309
+ else
310
+ value
311
+ end
312
+ end
313
+
314
+ end
315
+
316
+ end