trustcomponent 0.0.1.beta.0
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.
- checksums.yaml +7 -0
- data/LICENSE.md +21 -0
- data/README.md +78 -0
- data/lib/trustcomponent/captcha.rb +24 -0
- data/lib/trustcomponent/client.rb +44 -0
- data/lib/trustcomponent/errors.rb +58 -0
- data/lib/trustcomponent/http_middleware.rb +83 -0
- data/lib/trustcomponent.rb +15 -0
- data/lib/trustcomponent_generated/api/analytics_server_events_api.rb +90 -0
- data/lib/trustcomponent_generated/api/analytics_websites_api.rb +527 -0
- data/lib/trustcomponent_generated/api/captcha_verifications_api.rb +88 -0
- data/lib/trustcomponent_generated/api/monitoring_heartbeats_api.rb +89 -0
- data/lib/trustcomponent_generated/api/platform_events_api.rb +106 -0
- data/lib/trustcomponent_generated/api/tax_validation_schedules_api.rb +147 -0
- data/lib/trustcomponent_generated/api/tax_validation_validation_results_api.rb +83 -0
- data/lib/trustcomponent_generated/api/tax_validation_validations_api.rb +156 -0
- data/lib/trustcomponent_generated/api_client.rb +441 -0
- data/lib/trustcomponent_generated/api_error.rb +58 -0
- data/lib/trustcomponent_generated/api_model_base.rb +88 -0
- data/lib/trustcomponent_generated/configuration.rb +400 -0
- data/lib/trustcomponent_generated/models/analytics_event_category_enum.rb +52 -0
- data/lib/trustcomponent_generated/models/analytics_realtime.rb +251 -0
- data/lib/trustcomponent_generated/models/analytics_realtime_page.rb +193 -0
- data/lib/trustcomponent_generated/models/analytics_realtime_point.rb +193 -0
- data/lib/trustcomponent_generated/models/analytics_server_event_batch_create_params.rb +295 -0
- data/lib/trustcomponent_generated/models/analytics_server_event_batch_event_commerce_create_params.rb +366 -0
- data/lib/trustcomponent_generated/models/analytics_server_event_batch_event_commerce_product_create_params.rb +298 -0
- data/lib/trustcomponent_generated/models/analytics_server_event_batch_event_create_params.rb +508 -0
- data/lib/trustcomponent_generated/models/analytics_server_event_batch_event_error_create_params.rb +269 -0
- data/lib/trustcomponent_generated/models/analytics_server_event_batch_event_refund_create_params.rb +211 -0
- data/lib/trustcomponent_generated/models/analytics_server_event_batch_result.rb +194 -0
- data/lib/trustcomponent_generated/models/analytics_server_event_batch_result_drop_reason_enum.rb +52 -0
- data/lib/trustcomponent_generated/models/analytics_server_event_batch_result_dropped.rb +213 -0
- data/lib/trustcomponent_generated/models/analytics_stats_breakdown.rb +351 -0
- data/lib/trustcomponent_generated/models/analytics_stats_breakdown_row.rb +201 -0
- data/lib/trustcomponent_generated/models/analytics_stats_breakdown_row_page.rb +226 -0
- data/lib/trustcomponent_generated/models/analytics_stats_conversions.rb +249 -0
- data/lib/trustcomponent_generated/models/analytics_stats_conversions_goal.rb +260 -0
- data/lib/trustcomponent_generated/models/analytics_stats_conversions_goal_revenue.rb +193 -0
- data/lib/trustcomponent_generated/models/analytics_stats_dimension_enum.rb +69 -0
- data/lib/trustcomponent_generated/models/analytics_stats_filter_match_mode_enum.rb +40 -0
- data/lib/trustcomponent_generated/models/analytics_stats_filter_operator_enum.rb +45 -0
- data/lib/trustcomponent_generated/models/analytics_stats_granularity_enum.rb +40 -0
- data/lib/trustcomponent_generated/models/analytics_stats_overview.rb +282 -0
- data/lib/trustcomponent_generated/models/analytics_stats_timeseries.rb +270 -0
- data/lib/trustcomponent_generated/models/analytics_stats_timeseries_point.rb +192 -0
- data/lib/trustcomponent_generated/models/analytics_stats_totals.rb +307 -0
- data/lib/trustcomponent_generated/models/analytics_website.rb +249 -0
- data/lib/trustcomponent_generated/models/analytics_websites_page.rb +249 -0
- data/lib/trustcomponent_generated/models/captcha_verification_result.rb +350 -0
- data/lib/trustcomponent_generated/models/platform_event.rb +439 -0
- data/lib/trustcomponent_generated/models/platform_event_actor.rb +218 -0
- data/lib/trustcomponent_generated/models/platform_event_actor_automation.rb +214 -0
- data/lib/trustcomponent_generated/models/platform_event_actor_automation_kind_enum.rb +41 -0
- data/lib/trustcomponent_generated/models/platform_event_actor_type_enum.rb +43 -0
- data/lib/trustcomponent_generated/models/platform_event_change.rb +263 -0
- data/lib/trustcomponent_generated/models/platform_event_change_operation_enum.rb +43 -0
- data/lib/trustcomponent_generated/models/platform_event_origin.rb +263 -0
- data/lib/trustcomponent_generated/models/platform_event_ref.rb +204 -0
- data/lib/trustcomponent_generated/models/platform_event_source_enum.rb +44 -0
- data/lib/trustcomponent_generated/models/platform_events_page.rb +314 -0
- data/lib/trustcomponent_generated/models/tax_validation_match_status_enum.rb +44 -0
- data/lib/trustcomponent_generated/models/tax_validation_provider_enum.rb +46 -0
- data/lib/trustcomponent_generated/models/tax_validation_provider_status_enum.rb +51 -0
- data/lib/trustcomponent_generated/models/tax_validation_schedule.rb +423 -0
- data/lib/trustcomponent_generated/models/tax_validation_schedule_create_params.rb +321 -0
- data/lib/trustcomponent_generated/models/tax_validation_tax_address.rb +188 -0
- data/lib/trustcomponent_generated/models/tax_validation_tax_identifier_scheme_enum.rb +49 -0
- data/lib/trustcomponent_generated/models/tax_validation_validation.rb +372 -0
- data/lib/trustcomponent_generated/models/tax_validation_validation_address_match.rb +290 -0
- data/lib/trustcomponent_generated/models/tax_validation_validation_batch_create_params.rb +176 -0
- data/lib/trustcomponent_generated/models/tax_validation_validation_create_params.rb +292 -0
- data/lib/trustcomponent_generated/models/tax_validation_validation_frequency_enum.rb +41 -0
- data/lib/trustcomponent_generated/models/tax_validation_validation_input.rb +322 -0
- data/lib/trustcomponent_generated/models/tax_validation_validation_match.rb +238 -0
- data/lib/trustcomponent_generated/models/tax_validation_validation_mode_enum.rb +40 -0
- data/lib/trustcomponent_generated/models/tax_validation_validation_outcome_enum.rb +44 -0
- data/lib/trustcomponent_generated/models/tax_validation_validation_request_status_enum.rb +44 -0
- data/lib/trustcomponent_generated/models/tax_validation_validation_response_data.rb +177 -0
- data/lib/trustcomponent_generated/models/tax_validation_validation_result.rb +459 -0
- data/lib/trustcomponent_generated/models/tax_validation_validation_schedule_attach_params.rb +225 -0
- data/lib/trustcomponent_generated/models/tax_validation_verification_method_enum.rb +40 -0
- data/lib/trustcomponent_generated/modules.rb +51 -0
- data/lib/trustcomponent_generated/version.rb +15 -0
- data/lib/trustcomponent_generated.rb +110 -0
- metadata +190 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#TrustComponent API
|
|
3
|
+
|
|
4
|
+
#The public API of every TrustComponent module, authenticated with an API key (`ak_…`). Each operation carries its own version in its path.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.0.1-beta.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.24.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module TrustComponent::Generated
|
|
17
|
+
# Sent with the `purchase` event; it replaces a browser purchase with the same order id and keeps the browser's product lines when it sends none itself, a second server purchase with the same order id is dropped
|
|
18
|
+
class AnalyticsServerEventBatchEventCommerceCreateParams < ApiModelBase
|
|
19
|
+
# Order id of the shop, unique per website
|
|
20
|
+
attr_accessor :order_id
|
|
21
|
+
|
|
22
|
+
# Order total the customer paid, in the minor unit of the currency (cents for EUR), including tax and shipping, after discounts. 0 to 1000000000000; an event outside this range is dropped as malformed
|
|
23
|
+
attr_accessor :amount_minor
|
|
24
|
+
|
|
25
|
+
# Tax contained in amountMinor, as the shop booked it, in the minor unit of the currency. 0 to 1000000000000; an event outside this range is dropped as malformed. Stored with the order as reported; amountMinor stays the total paid and is never derived from it
|
|
26
|
+
attr_accessor :tax_minor
|
|
27
|
+
|
|
28
|
+
# Shipping cost contained in amountMinor, as the shop booked it, in the minor unit of the currency. 0 to 1000000000000; an event outside this range is dropped as malformed
|
|
29
|
+
attr_accessor :shipping_minor
|
|
30
|
+
|
|
31
|
+
# Discount already taken off amountMinor, as a positive number in the minor unit of the currency. 0 to 1000000000000; an event outside this range is dropped as malformed
|
|
32
|
+
attr_accessor :discount_minor
|
|
33
|
+
|
|
34
|
+
# Coupon or voucher code the customer redeemed with the order
|
|
35
|
+
attr_accessor :coupon
|
|
36
|
+
|
|
37
|
+
# ISO 4217 currency code
|
|
38
|
+
attr_accessor :currency
|
|
39
|
+
|
|
40
|
+
# Number of items in the order; the sum of the product quantities when left out and products are sent
|
|
41
|
+
attr_accessor :item_count
|
|
42
|
+
|
|
43
|
+
# Lines of the order, for revenue per product
|
|
44
|
+
attr_accessor :products
|
|
45
|
+
|
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
47
|
+
def self.attribute_map
|
|
48
|
+
{
|
|
49
|
+
:'order_id' => :'orderId',
|
|
50
|
+
:'amount_minor' => :'amountMinor',
|
|
51
|
+
:'tax_minor' => :'taxMinor',
|
|
52
|
+
:'shipping_minor' => :'shippingMinor',
|
|
53
|
+
:'discount_minor' => :'discountMinor',
|
|
54
|
+
:'coupon' => :'coupon',
|
|
55
|
+
:'currency' => :'currency',
|
|
56
|
+
:'item_count' => :'itemCount',
|
|
57
|
+
:'products' => :'products'
|
|
58
|
+
}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Returns attribute mapping this model knows about
|
|
62
|
+
def self.acceptable_attribute_map
|
|
63
|
+
attribute_map
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Returns all the JSON keys this model knows about
|
|
67
|
+
def self.acceptable_attributes
|
|
68
|
+
acceptable_attribute_map.values
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Attribute type mapping.
|
|
72
|
+
def self.openapi_types
|
|
73
|
+
{
|
|
74
|
+
:'order_id' => :'String',
|
|
75
|
+
:'amount_minor' => :'Integer',
|
|
76
|
+
:'tax_minor' => :'Integer',
|
|
77
|
+
:'shipping_minor' => :'Integer',
|
|
78
|
+
:'discount_minor' => :'Integer',
|
|
79
|
+
:'coupon' => :'String',
|
|
80
|
+
:'currency' => :'String',
|
|
81
|
+
:'item_count' => :'Integer',
|
|
82
|
+
:'products' => :'Array<AnalyticsServerEventBatchEventCommerceProductCreateParams>'
|
|
83
|
+
}
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# List of attributes with nullable: true
|
|
87
|
+
def self.openapi_nullable
|
|
88
|
+
Set.new([
|
|
89
|
+
])
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Initializes the object
|
|
93
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
94
|
+
def initialize(attributes = {})
|
|
95
|
+
if (!attributes.is_a?(Hash))
|
|
96
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TrustComponent::Generated::AnalyticsServerEventBatchEventCommerceCreateParams` initialize method"
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
100
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
101
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
102
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
103
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TrustComponent::Generated::AnalyticsServerEventBatchEventCommerceCreateParams`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
104
|
+
end
|
|
105
|
+
h[k.to_sym] = v
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'order_id')
|
|
109
|
+
self.order_id = attributes[:'order_id']
|
|
110
|
+
else
|
|
111
|
+
self.order_id = nil
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'amount_minor')
|
|
115
|
+
self.amount_minor = attributes[:'amount_minor']
|
|
116
|
+
else
|
|
117
|
+
self.amount_minor = nil
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if attributes.key?(:'tax_minor')
|
|
121
|
+
self.tax_minor = attributes[:'tax_minor']
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if attributes.key?(:'shipping_minor')
|
|
125
|
+
self.shipping_minor = attributes[:'shipping_minor']
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if attributes.key?(:'discount_minor')
|
|
129
|
+
self.discount_minor = attributes[:'discount_minor']
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if attributes.key?(:'coupon')
|
|
133
|
+
self.coupon = attributes[:'coupon']
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if attributes.key?(:'currency')
|
|
137
|
+
self.currency = attributes[:'currency']
|
|
138
|
+
else
|
|
139
|
+
self.currency = nil
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if attributes.key?(:'item_count')
|
|
143
|
+
self.item_count = attributes[:'item_count']
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if attributes.key?(:'products')
|
|
147
|
+
if (value = attributes[:'products']).is_a?(Array)
|
|
148
|
+
self.products = value
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
154
|
+
# @return Array for valid properties with the reasons
|
|
155
|
+
def list_invalid_properties
|
|
156
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
157
|
+
invalid_properties = Array.new
|
|
158
|
+
if @order_id.nil?
|
|
159
|
+
invalid_properties.push('invalid value for "order_id", order_id cannot be nil.')
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if @order_id.to_s.length > 100
|
|
163
|
+
invalid_properties.push('invalid value for "order_id", the character length must be smaller than or equal to 100.')
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
if @amount_minor.nil?
|
|
167
|
+
invalid_properties.push('invalid value for "amount_minor", amount_minor cannot be nil.')
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
if !@coupon.nil? && @coupon.to_s.length > 100
|
|
171
|
+
invalid_properties.push('invalid value for "coupon", the character length must be smaller than or equal to 100.')
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
if @currency.nil?
|
|
175
|
+
invalid_properties.push('invalid value for "currency", currency cannot be nil.')
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
if @currency.to_s.length > 3
|
|
179
|
+
invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.')
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
if @currency.to_s.length < 3
|
|
183
|
+
invalid_properties.push('invalid value for "currency", the character length must be greater than or equal to 3.')
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
if !@item_count.nil? && @item_count < 0
|
|
187
|
+
invalid_properties.push('invalid value for "item_count", must be greater than or equal to 0.')
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
if !@products.nil? && @products.length > 50
|
|
191
|
+
invalid_properties.push('invalid value for "products", number of items must be less than or equal to 50.')
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
invalid_properties
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Check to see if the all the properties in the model are valid
|
|
198
|
+
# @return true if the model is valid
|
|
199
|
+
def valid?
|
|
200
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
201
|
+
return false if @order_id.nil?
|
|
202
|
+
return false if @order_id.to_s.length > 100
|
|
203
|
+
return false if @amount_minor.nil?
|
|
204
|
+
return false if !@coupon.nil? && @coupon.to_s.length > 100
|
|
205
|
+
return false if @currency.nil?
|
|
206
|
+
return false if @currency.to_s.length > 3
|
|
207
|
+
return false if @currency.to_s.length < 3
|
|
208
|
+
return false if !@item_count.nil? && @item_count < 0
|
|
209
|
+
return false if !@products.nil? && @products.length > 50
|
|
210
|
+
true
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Custom attribute writer method with validation
|
|
214
|
+
# @param [Object] order_id Value to be assigned
|
|
215
|
+
def order_id=(order_id)
|
|
216
|
+
if order_id.nil?
|
|
217
|
+
fail ArgumentError, 'order_id cannot be nil'
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
if order_id.to_s.length > 100
|
|
221
|
+
fail ArgumentError, 'invalid value for "order_id", the character length must be smaller than or equal to 100.'
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
@order_id = order_id
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Custom attribute writer method with validation
|
|
228
|
+
# @param [Object] amount_minor Value to be assigned
|
|
229
|
+
def amount_minor=(amount_minor)
|
|
230
|
+
if amount_minor.nil?
|
|
231
|
+
fail ArgumentError, 'amount_minor cannot be nil'
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
@amount_minor = amount_minor
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Custom attribute writer method with validation
|
|
238
|
+
# @param [Object] coupon Value to be assigned
|
|
239
|
+
def coupon=(coupon)
|
|
240
|
+
if coupon.nil?
|
|
241
|
+
fail ArgumentError, 'coupon cannot be nil'
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
if coupon.to_s.length > 100
|
|
245
|
+
fail ArgumentError, 'invalid value for "coupon", the character length must be smaller than or equal to 100.'
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
@coupon = coupon
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Custom attribute writer method with validation
|
|
252
|
+
# @param [Object] currency Value to be assigned
|
|
253
|
+
def currency=(currency)
|
|
254
|
+
if currency.nil?
|
|
255
|
+
fail ArgumentError, 'currency cannot be nil'
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
if currency.to_s.length > 3
|
|
259
|
+
fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.'
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
if currency.to_s.length < 3
|
|
263
|
+
fail ArgumentError, 'invalid value for "currency", the character length must be greater than or equal to 3.'
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
@currency = currency
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# Custom attribute writer method with validation
|
|
270
|
+
# @param [Object] item_count Value to be assigned
|
|
271
|
+
def item_count=(item_count)
|
|
272
|
+
if item_count.nil?
|
|
273
|
+
fail ArgumentError, 'item_count cannot be nil'
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
if item_count < 0
|
|
277
|
+
fail ArgumentError, 'invalid value for "item_count", must be greater than or equal to 0.'
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
@item_count = item_count
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
# Custom attribute writer method with validation
|
|
284
|
+
# @param [Object] products Value to be assigned
|
|
285
|
+
def products=(products)
|
|
286
|
+
if products.nil?
|
|
287
|
+
fail ArgumentError, 'products cannot be nil'
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
if products.length > 50
|
|
291
|
+
fail ArgumentError, 'invalid value for "products", number of items must be less than or equal to 50.'
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
@products = products
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
# Checks equality by comparing each attribute.
|
|
298
|
+
# @param [Object] Object to be compared
|
|
299
|
+
def ==(o)
|
|
300
|
+
return true if self.equal?(o)
|
|
301
|
+
self.class == o.class &&
|
|
302
|
+
order_id == o.order_id &&
|
|
303
|
+
amount_minor == o.amount_minor &&
|
|
304
|
+
tax_minor == o.tax_minor &&
|
|
305
|
+
shipping_minor == o.shipping_minor &&
|
|
306
|
+
discount_minor == o.discount_minor &&
|
|
307
|
+
coupon == o.coupon &&
|
|
308
|
+
currency == o.currency &&
|
|
309
|
+
item_count == o.item_count &&
|
|
310
|
+
products == o.products
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
# @see the `==` method
|
|
314
|
+
# @param [Object] Object to be compared
|
|
315
|
+
def eql?(o)
|
|
316
|
+
self == o
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
# Calculates hash code according to all attributes.
|
|
320
|
+
# @return [Integer] Hash code
|
|
321
|
+
def hash
|
|
322
|
+
[order_id, amount_minor, tax_minor, shipping_minor, discount_minor, coupon, currency, item_count, products].hash
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
# Builds the object from hash
|
|
326
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
327
|
+
# @return [Object] Returns the model itself
|
|
328
|
+
def self.build_from_hash(attributes)
|
|
329
|
+
return nil unless attributes.is_a?(Hash)
|
|
330
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
331
|
+
transformed_hash = {}
|
|
332
|
+
openapi_types.each_pair do |key, type|
|
|
333
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
334
|
+
transformed_hash["#{key}"] = nil
|
|
335
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
336
|
+
# check to ensure the input is an array given that the attribute
|
|
337
|
+
# is documented as an array but the input is not
|
|
338
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
339
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
340
|
+
end
|
|
341
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
342
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
343
|
+
end
|
|
344
|
+
end
|
|
345
|
+
new(transformed_hash)
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
# Returns the object in the form of hash
|
|
349
|
+
# @return [Hash] Returns the object in the form of hash
|
|
350
|
+
def to_hash
|
|
351
|
+
hash = {}
|
|
352
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
353
|
+
value = self.send(attr)
|
|
354
|
+
if value.nil?
|
|
355
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
356
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
hash[param] = _to_hash(value)
|
|
360
|
+
end
|
|
361
|
+
hash
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
end
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#TrustComponent API
|
|
3
|
+
|
|
4
|
+
#The public API of every TrustComponent module, authenticated with an API key (`ak_…`). Each operation carries its own version in its path.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.0.1-beta.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.24.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module TrustComponent::Generated
|
|
17
|
+
# One line of an order
|
|
18
|
+
class AnalyticsServerEventBatchEventCommerceProductCreateParams < ApiModelBase
|
|
19
|
+
# Product id or SKU of the shop
|
|
20
|
+
attr_accessor :product_id
|
|
21
|
+
|
|
22
|
+
# Product name as the shop shows it
|
|
23
|
+
attr_accessor :name
|
|
24
|
+
|
|
25
|
+
# Product category
|
|
26
|
+
attr_accessor :category
|
|
27
|
+
|
|
28
|
+
# Number of units, 1 when left out, at most 1000000
|
|
29
|
+
attr_accessor :quantity
|
|
30
|
+
|
|
31
|
+
# Price of one unit in the minor unit of the order currency, at most 1000000000000
|
|
32
|
+
attr_accessor :unit_price_minor
|
|
33
|
+
|
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
35
|
+
def self.attribute_map
|
|
36
|
+
{
|
|
37
|
+
:'product_id' => :'productId',
|
|
38
|
+
:'name' => :'name',
|
|
39
|
+
:'category' => :'category',
|
|
40
|
+
:'quantity' => :'quantity',
|
|
41
|
+
:'unit_price_minor' => :'unitPriceMinor'
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Returns attribute mapping this model knows about
|
|
46
|
+
def self.acceptable_attribute_map
|
|
47
|
+
attribute_map
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Returns all the JSON keys this model knows about
|
|
51
|
+
def self.acceptable_attributes
|
|
52
|
+
acceptable_attribute_map.values
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Attribute type mapping.
|
|
56
|
+
def self.openapi_types
|
|
57
|
+
{
|
|
58
|
+
:'product_id' => :'String',
|
|
59
|
+
:'name' => :'String',
|
|
60
|
+
:'category' => :'String',
|
|
61
|
+
:'quantity' => :'Integer',
|
|
62
|
+
:'unit_price_minor' => :'Integer'
|
|
63
|
+
}
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# List of attributes with nullable: true
|
|
67
|
+
def self.openapi_nullable
|
|
68
|
+
Set.new([
|
|
69
|
+
])
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Initializes the object
|
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
74
|
+
def initialize(attributes = {})
|
|
75
|
+
if (!attributes.is_a?(Hash))
|
|
76
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TrustComponent::Generated::AnalyticsServerEventBatchEventCommerceProductCreateParams` initialize method"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
80
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
81
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
82
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
83
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TrustComponent::Generated::AnalyticsServerEventBatchEventCommerceProductCreateParams`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
84
|
+
end
|
|
85
|
+
h[k.to_sym] = v
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if attributes.key?(:'product_id')
|
|
89
|
+
self.product_id = attributes[:'product_id']
|
|
90
|
+
else
|
|
91
|
+
self.product_id = nil
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'name')
|
|
95
|
+
self.name = attributes[:'name']
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:'category')
|
|
99
|
+
self.category = attributes[:'category']
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if attributes.key?(:'quantity')
|
|
103
|
+
self.quantity = attributes[:'quantity']
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if attributes.key?(:'unit_price_minor')
|
|
107
|
+
self.unit_price_minor = attributes[:'unit_price_minor']
|
|
108
|
+
else
|
|
109
|
+
self.unit_price_minor = nil
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
114
|
+
# @return Array for valid properties with the reasons
|
|
115
|
+
def list_invalid_properties
|
|
116
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
117
|
+
invalid_properties = Array.new
|
|
118
|
+
if @product_id.nil?
|
|
119
|
+
invalid_properties.push('invalid value for "product_id", product_id cannot be nil.')
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if @product_id.to_s.length > 100
|
|
123
|
+
invalid_properties.push('invalid value for "product_id", the character length must be smaller than or equal to 100.')
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if !@name.nil? && @name.to_s.length > 200
|
|
127
|
+
invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 200.')
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if !@category.nil? && @category.to_s.length > 100
|
|
131
|
+
invalid_properties.push('invalid value for "category", the character length must be smaller than or equal to 100.')
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if !@quantity.nil? && @quantity < 1
|
|
135
|
+
invalid_properties.push('invalid value for "quantity", must be greater than or equal to 1.')
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if @unit_price_minor.nil?
|
|
139
|
+
invalid_properties.push('invalid value for "unit_price_minor", unit_price_minor cannot be nil.')
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if @unit_price_minor < 0
|
|
143
|
+
invalid_properties.push('invalid value for "unit_price_minor", must be greater than or equal to 0.')
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
invalid_properties
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Check to see if the all the properties in the model are valid
|
|
150
|
+
# @return true if the model is valid
|
|
151
|
+
def valid?
|
|
152
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
153
|
+
return false if @product_id.nil?
|
|
154
|
+
return false if @product_id.to_s.length > 100
|
|
155
|
+
return false if !@name.nil? && @name.to_s.length > 200
|
|
156
|
+
return false if !@category.nil? && @category.to_s.length > 100
|
|
157
|
+
return false if !@quantity.nil? && @quantity < 1
|
|
158
|
+
return false if @unit_price_minor.nil?
|
|
159
|
+
return false if @unit_price_minor < 0
|
|
160
|
+
true
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Custom attribute writer method with validation
|
|
164
|
+
# @param [Object] product_id Value to be assigned
|
|
165
|
+
def product_id=(product_id)
|
|
166
|
+
if product_id.nil?
|
|
167
|
+
fail ArgumentError, 'product_id cannot be nil'
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
if product_id.to_s.length > 100
|
|
171
|
+
fail ArgumentError, 'invalid value for "product_id", the character length must be smaller than or equal to 100.'
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
@product_id = product_id
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Custom attribute writer method with validation
|
|
178
|
+
# @param [Object] name Value to be assigned
|
|
179
|
+
def name=(name)
|
|
180
|
+
if name.nil?
|
|
181
|
+
fail ArgumentError, 'name cannot be nil'
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
if name.to_s.length > 200
|
|
185
|
+
fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 200.'
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
@name = name
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Custom attribute writer method with validation
|
|
192
|
+
# @param [Object] category Value to be assigned
|
|
193
|
+
def category=(category)
|
|
194
|
+
if category.nil?
|
|
195
|
+
fail ArgumentError, 'category cannot be nil'
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
if category.to_s.length > 100
|
|
199
|
+
fail ArgumentError, 'invalid value for "category", the character length must be smaller than or equal to 100.'
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
@category = category
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Custom attribute writer method with validation
|
|
206
|
+
# @param [Object] quantity Value to be assigned
|
|
207
|
+
def quantity=(quantity)
|
|
208
|
+
if quantity.nil?
|
|
209
|
+
fail ArgumentError, 'quantity cannot be nil'
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
if quantity < 1
|
|
213
|
+
fail ArgumentError, 'invalid value for "quantity", must be greater than or equal to 1.'
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
@quantity = quantity
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Custom attribute writer method with validation
|
|
220
|
+
# @param [Object] unit_price_minor Value to be assigned
|
|
221
|
+
def unit_price_minor=(unit_price_minor)
|
|
222
|
+
if unit_price_minor.nil?
|
|
223
|
+
fail ArgumentError, 'unit_price_minor cannot be nil'
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
if unit_price_minor < 0
|
|
227
|
+
fail ArgumentError, 'invalid value for "unit_price_minor", must be greater than or equal to 0.'
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
@unit_price_minor = unit_price_minor
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# Checks equality by comparing each attribute.
|
|
234
|
+
# @param [Object] Object to be compared
|
|
235
|
+
def ==(o)
|
|
236
|
+
return true if self.equal?(o)
|
|
237
|
+
self.class == o.class &&
|
|
238
|
+
product_id == o.product_id &&
|
|
239
|
+
name == o.name &&
|
|
240
|
+
category == o.category &&
|
|
241
|
+
quantity == o.quantity &&
|
|
242
|
+
unit_price_minor == o.unit_price_minor
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# @see the `==` method
|
|
246
|
+
# @param [Object] Object to be compared
|
|
247
|
+
def eql?(o)
|
|
248
|
+
self == o
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Calculates hash code according to all attributes.
|
|
252
|
+
# @return [Integer] Hash code
|
|
253
|
+
def hash
|
|
254
|
+
[product_id, name, category, quantity, unit_price_minor].hash
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
# Builds the object from hash
|
|
258
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
259
|
+
# @return [Object] Returns the model itself
|
|
260
|
+
def self.build_from_hash(attributes)
|
|
261
|
+
return nil unless attributes.is_a?(Hash)
|
|
262
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
263
|
+
transformed_hash = {}
|
|
264
|
+
openapi_types.each_pair do |key, type|
|
|
265
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
266
|
+
transformed_hash["#{key}"] = nil
|
|
267
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
268
|
+
# check to ensure the input is an array given that the attribute
|
|
269
|
+
# is documented as an array but the input is not
|
|
270
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
271
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
272
|
+
end
|
|
273
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
274
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
new(transformed_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
|
+
end
|
|
297
|
+
|
|
298
|
+
end
|