ultracart_api 4.1.200 → 4.1.202

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.
@@ -2725,7 +2725,7 @@ module UltracartClient
2725
2725
  end
2726
2726
 
2727
2727
  # End an experiment
2728
- # Ends a running experiment. With winner_variation_number the winner gets every visitor, including visitors already assigned to another variation, and a page experiment's winning content is promoted into the page by the completion job on its next run, which also emails the merchant. Without a winner a page experiment's id is cleared from its page body so the page shows variation 0, and a url experiment sends everyone to variation 0. Always needs sfvb_publish, and the approval of the person who signed in the CLI - an approved experiment.end request for this experiment and winner, which always needs a fresh authenticator code (see POST /sfvb/approvals).
2728
+ # Ends a running experiment. With winner_variation_number the winner gets every visitor, including visitors already assigned to another variation, and a page experiment's winning content is promoted into the page by the completion job on its next run, which also emails the merchant. Without a winner a page experiment's id is cleared from its page body so the page shows variation 0, and a url experiment sends everyone to variation 0. Always needs sfvb_publish, and the approval of the person who signed in the CLI - an approved experiment.end request for this experiment and winner. An end with a winner always needs a fresh authenticator code; an end without a winner can be covered by the person's approval session (see POST /sfvb/approvals).
2729
2729
  # @param storefront_oid [Integer]
2730
2730
  # @param experiment_oid [Integer]
2731
2731
  # @param [Hash] opts the optional parameters
@@ -2738,7 +2738,7 @@ module UltracartClient
2738
2738
  end
2739
2739
 
2740
2740
  # End an experiment
2741
- # Ends a running experiment. With winner_variation_number the winner gets every visitor, including visitors already assigned to another variation, and a page experiment's winning content is promoted into the page by the completion job on its next run, which also emails the merchant. Without a winner a page experiment's id is cleared from its page body so the page shows variation 0, and a url experiment sends everyone to variation 0. Always needs sfvb_publish, and the approval of the person who signed in the CLI - an approved experiment.end request for this experiment and winner, which always needs a fresh authenticator code (see POST /sfvb/approvals).
2741
+ # Ends a running experiment. With winner_variation_number the winner gets every visitor, including visitors already assigned to another variation, and a page experiment's winning content is promoted into the page by the completion job on its next run, which also emails the merchant. Without a winner a page experiment's id is cleared from its page body so the page shows variation 0, and a url experiment sends everyone to variation 0. Always needs sfvb_publish, and the approval of the person who signed in the CLI - an approved experiment.end request for this experiment and winner. An end with a winner always needs a fresh authenticator code; an end without a winner can be covered by the person's approval session (see POST /sfvb/approvals).
2742
2742
  # @param storefront_oid [Integer]
2743
2743
  # @param experiment_oid [Integer]
2744
2744
  # @param [Hash] opts the optional parameters
@@ -3355,6 +3355,138 @@ module UltracartClient
3355
3355
  return data, status_code, headers
3356
3356
  end
3357
3357
 
3358
+ # Replay events
3359
+ # The signed-in person's events after the cursor, oldest first. Events are kept 72 hours; an older cursor returns resync_required, and then the caller re-lists what it was waiting on. Events about one sign-in's requests, such as approvals, are only returned to that sign-in. limit is 1 to 500, default 100.
3360
+ # @param [Hash] opts the optional parameters
3361
+ # @option opts [String] :after Return events after this event_id. Leave it out for every event kept.
3362
+ # @option opts [Integer] :storefront_oid Only events about this storefront, plus merchant-level ones.
3363
+ # @option opts [Integer] :limit At most this many events, 1 to 500.
3364
+ # @return [SfvbEventsResponse]
3365
+ def get_sfvb_events(opts = {})
3366
+ data, _status_code, _headers = get_sfvb_events_with_http_info(opts)
3367
+ data
3368
+ end
3369
+
3370
+ # Replay events
3371
+ # The signed-in person's events after the cursor, oldest first. Events are kept 72 hours; an older cursor returns resync_required, and then the caller re-lists what it was waiting on. Events about one sign-in's requests, such as approvals, are only returned to that sign-in. limit is 1 to 500, default 100.
3372
+ # @param [Hash] opts the optional parameters
3373
+ # @option opts [String] :after Return events after this event_id. Leave it out for every event kept.
3374
+ # @option opts [Integer] :storefront_oid Only events about this storefront, plus merchant-level ones.
3375
+ # @option opts [Integer] :limit At most this many events, 1 to 500.
3376
+ # @return [Array<(SfvbEventsResponse, Integer, Hash)>] SfvbEventsResponse data, response status code and response headers
3377
+ def get_sfvb_events_with_http_info(opts = {})
3378
+ if @api_client.config.debugging
3379
+ @api_client.config.logger.debug 'Calling API: SfvbApi.get_sfvb_events ...'
3380
+ end
3381
+ # resource path
3382
+ local_var_path = '/sfvb/events'
3383
+
3384
+ # query parameters
3385
+ query_params = opts[:query_params] || {}
3386
+ query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
3387
+ query_params[:'storefront_oid'] = opts[:'storefront_oid'] if !opts[:'storefront_oid'].nil?
3388
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
3389
+
3390
+ # header parameters
3391
+ header_params = opts[:header_params] || {}
3392
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
3393
+ # HTTP header 'Accept' (if needed)
3394
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
3395
+
3396
+ # form parameters
3397
+ form_params = opts[:form_params] || {}
3398
+
3399
+ # http body (model)
3400
+ post_body = opts[:debug_body]
3401
+
3402
+ # return_type
3403
+ return_type = opts[:debug_return_type] || 'SfvbEventsResponse'
3404
+
3405
+ # auth_names
3406
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
3407
+
3408
+ new_options = opts.merge(
3409
+ :operation => :"SfvbApi.get_sfvb_events",
3410
+ :header_params => header_params,
3411
+ :query_params => query_params,
3412
+ :form_params => form_params,
3413
+ :body => post_body,
3414
+ :auth_names => auth_names,
3415
+ :return_type => return_type
3416
+ )
3417
+
3418
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
3419
+ if @api_client.config.debugging
3420
+ @api_client.config.logger.debug "API called: SfvbApi#get_sfvb_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3421
+ end
3422
+ return data, status_code, headers
3423
+ end
3424
+
3425
+ # Open the event stream
3426
+ # Returns a websocket URL and a single-use token, valid for 5 minutes, for the signed-in person's event stream. Events are thin hints, type and ids only, and the stream is at most once. Re-read the object before acting, and after every reconnect replay from the last event_id with GET events. Send ping messages to keep the connection open, and reconnect with a new token before two hours. Requires a token that resolves to a user, so use the device authorization flow.
3427
+ # @param [Hash] opts the optional parameters
3428
+ # @option opts [SfvbEventsAuthRequest] :events_auth_request Optional storefront filter
3429
+ # @return [SfvbEventsAuthResponse]
3430
+ def get_sfvb_events_authorization(opts = {})
3431
+ data, _status_code, _headers = get_sfvb_events_authorization_with_http_info(opts)
3432
+ data
3433
+ end
3434
+
3435
+ # Open the event stream
3436
+ # Returns a websocket URL and a single-use token, valid for 5 minutes, for the signed-in person&#39;s event stream. Events are thin hints, type and ids only, and the stream is at most once. Re-read the object before acting, and after every reconnect replay from the last event_id with GET events. Send ping messages to keep the connection open, and reconnect with a new token before two hours. Requires a token that resolves to a user, so use the device authorization flow.
3437
+ # @param [Hash] opts the optional parameters
3438
+ # @option opts [SfvbEventsAuthRequest] :events_auth_request Optional storefront filter
3439
+ # @return [Array<(SfvbEventsAuthResponse, Integer, Hash)>] SfvbEventsAuthResponse data, response status code and response headers
3440
+ def get_sfvb_events_authorization_with_http_info(opts = {})
3441
+ if @api_client.config.debugging
3442
+ @api_client.config.logger.debug 'Calling API: SfvbApi.get_sfvb_events_authorization ...'
3443
+ end
3444
+ # resource path
3445
+ local_var_path = '/sfvb/events/auth'
3446
+
3447
+ # query parameters
3448
+ query_params = opts[:query_params] || {}
3449
+
3450
+ # header parameters
3451
+ header_params = opts[:header_params] || {}
3452
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
3453
+ # HTTP header 'Accept' (if needed)
3454
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
3455
+ # HTTP header 'Content-Type'
3456
+ content_type = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
3457
+ if !content_type.nil?
3458
+ header_params['Content-Type'] = content_type
3459
+ end
3460
+
3461
+ # form parameters
3462
+ form_params = opts[:form_params] || {}
3463
+
3464
+ # http body (model)
3465
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'events_auth_request'])
3466
+
3467
+ # return_type
3468
+ return_type = opts[:debug_return_type] || 'SfvbEventsAuthResponse'
3469
+
3470
+ # auth_names
3471
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
3472
+
3473
+ new_options = opts.merge(
3474
+ :operation => :"SfvbApi.get_sfvb_events_authorization",
3475
+ :header_params => header_params,
3476
+ :query_params => query_params,
3477
+ :form_params => form_params,
3478
+ :body => post_body,
3479
+ :auth_names => auth_names,
3480
+ :return_type => return_type
3481
+ )
3482
+
3483
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
3484
+ if @api_client.config.debugging
3485
+ @api_client.config.logger.debug "API called: SfvbApi#get_sfvb_events_authorization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3486
+ end
3487
+ return data, status_code, headers
3488
+ end
3489
+
3358
3490
  # Read one experiment and its statistics
3359
3491
  # The experiment, its variations and their statistics, and with daily=true each variation's daily rows. p95_sessions_needed is estimated only after 1000 sessions, and sessions_needed_computed_dts says when. For a url experiment, router_url is the address visitors must enter through.
3360
3492
  # @param storefront_oid [Integer]
@@ -4595,7 +4727,7 @@ module UltracartClient
4595
4727
  end
4596
4728
 
4597
4729
  # List the paths that answered 404
4598
- # The paths shoppers asked for that answered 404, most hits first or by last_seen. Paths only, never query strings. Bots are left out unless include_bots. Token-like path segments show as {token} unless include_tokens. limit is 1 to 100, default 50.
4730
+ # The paths shoppers asked for that answered 404, most hits first or by last_seen. Paths only, never query strings. Bots are left out unless include_bots. Token-like path segments show as {token} unless include_tokens. A path stays listed after a redirect rule catches it, with redirected_to set. redirected=false lists only paths no rule catches yet, and redirected=true only those one does. limit is 1 to 100, default 50.
4599
4731
  # @param storefront_oid [Integer]
4600
4732
  # @param [Hash] opts the optional parameters
4601
4733
  # @option opts [String] :since
@@ -4604,6 +4736,7 @@ module UltracartClient
4604
4736
  # @option opts [Boolean] :include_tokens
4605
4737
  # @option opts [String] :q
4606
4738
  # @option opts [Integer] :limit
4739
+ # @option opts [Boolean] :redirected
4607
4740
  # @return [SfvbNotFoundResponse]
4608
4741
  def get_sfvb_not_found(storefront_oid, opts = {})
4609
4742
  data, _status_code, _headers = get_sfvb_not_found_with_http_info(storefront_oid, opts)
@@ -4611,7 +4744,7 @@ module UltracartClient
4611
4744
  end
4612
4745
 
4613
4746
  # List the paths that answered 404
4614
- # The paths shoppers asked for that answered 404, most hits first or by last_seen. Paths only, never query strings. Bots are left out unless include_bots. Token-like path segments show as {token} unless include_tokens. limit is 1 to 100, default 50.
4747
+ # The paths shoppers asked for that answered 404, most hits first or by last_seen. Paths only, never query strings. Bots are left out unless include_bots. Token-like path segments show as {token} unless include_tokens. A path stays listed after a redirect rule catches it, with redirected_to set. redirected&#x3D;false lists only paths no rule catches yet, and redirected&#x3D;true only those one does. limit is 1 to 100, default 50.
4615
4748
  # @param storefront_oid [Integer]
4616
4749
  # @param [Hash] opts the optional parameters
4617
4750
  # @option opts [String] :since
@@ -4620,6 +4753,7 @@ module UltracartClient
4620
4753
  # @option opts [Boolean] :include_tokens
4621
4754
  # @option opts [String] :q
4622
4755
  # @option opts [Integer] :limit
4756
+ # @option opts [Boolean] :redirected
4623
4757
  # @return [Array<(SfvbNotFoundResponse, Integer, Hash)>] SfvbNotFoundResponse data, response status code and response headers
4624
4758
  def get_sfvb_not_found_with_http_info(storefront_oid, opts = {})
4625
4759
  if @api_client.config.debugging
@@ -4640,6 +4774,7 @@ module UltracartClient
4640
4774
  query_params[:'include_tokens'] = opts[:'include_tokens'] if !opts[:'include_tokens'].nil?
4641
4775
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
4642
4776
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
4777
+ query_params[:'redirected'] = opts[:'redirected'] if !opts[:'redirected'].nil?
4643
4778
 
4644
4779
  # header parameters
4645
4780
  header_params = opts[:header_params] || {}
@@ -8552,7 +8687,7 @@ module UltracartClient
8552
8687
  end
8553
8688
 
8554
8689
  # Change one built-in message
8555
- # Sets one message in any number of languages. ENG replaces the English, which drops its machine translations so they regenerate. Any other language becomes a hand translation. Languages not named are left alone; empty text is refused. Shoppers see it at once. Always needs sfvb_publish.
8690
+ # Sets one message in any number of languages. ENG replaces the English, which drops its machine translations so they regenerate. Any other language becomes a hand translation. Languages not named are left alone. Empty text removes that language's translation so machine translation fills it again (not allowed for ENG); it is the undo for an imported message, which can't be reset. Shoppers see it at once. Always needs sfvb_publish.
8556
8691
  # @param storefront_oid [Integer]
8557
8692
  # @param key [String]
8558
8693
  # @param if_match [String] hash_sha256 from the last read. Required; 428 when absent, 412 when stale.
@@ -8566,7 +8701,7 @@ module UltracartClient
8566
8701
  end
8567
8702
 
8568
8703
  # Change one built-in message
8569
- # Sets one message in any number of languages. ENG replaces the English, which drops its machine translations so they regenerate. Any other language becomes a hand translation. Languages not named are left alone; empty text is refused. Shoppers see it at once. Always needs sfvb_publish.
8704
+ # Sets one message in any number of languages. ENG replaces the English, which drops its machine translations so they regenerate. Any other language becomes a hand translation. Languages not named are left alone. Empty text removes that language&#39;s translation so machine translation fills it again (not allowed for ENG); it is the undo for an imported message, which can&#39;t be reset. Shoppers see it at once. Always needs sfvb_publish.
8570
8705
  # @param storefront_oid [Integer]
8571
8706
  # @param key [String]
8572
8707
  # @param if_match [String] hash_sha256 from the last read. Required; 428 when absent, 412 when stale.
@@ -8885,6 +9020,87 @@ module UltracartClient
8885
9020
  return data, status_code, headers
8886
9021
  end
8887
9022
 
9023
+ # Change an item image's description
9024
+ # Changes the description (alt text) of one image already attached to the item, in place. The image is not touched. Name it by merchant_item_multimedia_oid, or by exactly one of code or default; gallery images often have no code. An empty description clears it, so the render falls back again. Send the description_sha256 you read as current_sha256 so a change made since is not overwritten. A description written here takes the place of the machine description, and image recognition never overwrites it.
9025
+ # @param storefront_oid [Integer]
9026
+ # @param item_multimedia_description_request [SfvbItemMultimediaDescriptionRequest] The image and its new description
9027
+ # @param [Hash] opts the optional parameters
9028
+ # @option opts [String] :merchant_item_id
9029
+ # @option opts [Integer] :merchant_item_oid
9030
+ # @return [SfvbItemResponse]
9031
+ def put_sfvb_item_multimedia_description(storefront_oid, item_multimedia_description_request, opts = {})
9032
+ data, _status_code, _headers = put_sfvb_item_multimedia_description_with_http_info(storefront_oid, item_multimedia_description_request, opts)
9033
+ data
9034
+ end
9035
+
9036
+ # Change an item image&#39;s description
9037
+ # Changes the description (alt text) of one image already attached to the item, in place. The image is not touched. Name it by merchant_item_multimedia_oid, or by exactly one of code or default; gallery images often have no code. An empty description clears it, so the render falls back again. Send the description_sha256 you read as current_sha256 so a change made since is not overwritten. A description written here takes the place of the machine description, and image recognition never overwrites it.
9038
+ # @param storefront_oid [Integer]
9039
+ # @param item_multimedia_description_request [SfvbItemMultimediaDescriptionRequest] The image and its new description
9040
+ # @param [Hash] opts the optional parameters
9041
+ # @option opts [String] :merchant_item_id
9042
+ # @option opts [Integer] :merchant_item_oid
9043
+ # @return [Array<(SfvbItemResponse, Integer, Hash)>] SfvbItemResponse data, response status code and response headers
9044
+ def put_sfvb_item_multimedia_description_with_http_info(storefront_oid, item_multimedia_description_request, opts = {})
9045
+ if @api_client.config.debugging
9046
+ @api_client.config.logger.debug 'Calling API: SfvbApi.put_sfvb_item_multimedia_description ...'
9047
+ end
9048
+ # verify the required parameter 'storefront_oid' is set
9049
+ if @api_client.config.client_side_validation && storefront_oid.nil?
9050
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling SfvbApi.put_sfvb_item_multimedia_description"
9051
+ end
9052
+ # verify the required parameter 'item_multimedia_description_request' is set
9053
+ if @api_client.config.client_side_validation && item_multimedia_description_request.nil?
9054
+ fail ArgumentError, "Missing the required parameter 'item_multimedia_description_request' when calling SfvbApi.put_sfvb_item_multimedia_description"
9055
+ end
9056
+ # resource path
9057
+ local_var_path = '/sfvb/storefronts/{storefront_oid}/items/multimedia/description'.sub('{' + 'storefront_oid' + '}', CGI.escape(storefront_oid.to_s))
9058
+
9059
+ # query parameters
9060
+ query_params = opts[:query_params] || {}
9061
+ query_params[:'merchant_item_id'] = opts[:'merchant_item_id'] if !opts[:'merchant_item_id'].nil?
9062
+ query_params[:'merchant_item_oid'] = opts[:'merchant_item_oid'] if !opts[:'merchant_item_oid'].nil?
9063
+
9064
+ # header parameters
9065
+ header_params = opts[:header_params] || {}
9066
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
9067
+ # HTTP header 'Accept' (if needed)
9068
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
9069
+ # HTTP header 'Content-Type'
9070
+ content_type = @api_client.select_header_content_type(['application/json'])
9071
+ if !content_type.nil?
9072
+ header_params['Content-Type'] = content_type
9073
+ end
9074
+
9075
+ # form parameters
9076
+ form_params = opts[:form_params] || {}
9077
+
9078
+ # http body (model)
9079
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(item_multimedia_description_request)
9080
+
9081
+ # return_type
9082
+ return_type = opts[:debug_return_type] || 'SfvbItemResponse'
9083
+
9084
+ # auth_names
9085
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
9086
+
9087
+ new_options = opts.merge(
9088
+ :operation => :"SfvbApi.put_sfvb_item_multimedia_description",
9089
+ :header_params => header_params,
9090
+ :query_params => query_params,
9091
+ :form_params => form_params,
9092
+ :body => post_body,
9093
+ :auth_names => auth_names,
9094
+ :return_type => return_type
9095
+ )
9096
+
9097
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
9098
+ if @api_client.config.debugging
9099
+ @api_client.config.logger.debug "API called: SfvbApi#put_sfvb_item_multimedia_description\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
9100
+ end
9101
+ return data, status_code, headers
9102
+ end
9103
+
8888
9104
  # Change what an item charges
8889
9105
  # Partial - a field left out is untouched. A sale needs sale_cost, sale_start and sale_end together, the end after the start; clear_sale removes it. msrp must be more than 0 (0 only when the price is 0); clear_msrp removes it. volume_discounts replaces the retail quantity breaks. Shoppers pay the new price at once, so this needs sfvb_publish, If-Match with the pricing hash_sha256, and the approval of the person who signed in the CLI - an approved item.pricing request for this item and exactly this change. A change that sets every field to what it already is returns the pricing unchanged and uses no approval.
8890
9106
  # @param storefront_oid [Integer]
@@ -27,7 +27,7 @@ module UltracartClient
27
27
  # Container name, where the owner has more than one container.
28
28
  attr_accessor :container_name
29
29
 
30
- # When this snapshot was taken.
30
+ # When this snapshot was taken, ISO 8601 UTC.
31
31
  attr_accessor :created_dts
32
32
 
33
33
  # True for the value currently stored.
@@ -0,0 +1,270 @@
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 SfvbEvent
18
+ # When it happened, ISO 8601.
19
+ attr_accessor :event_dts
20
+
21
+ # Time-ordered id. Pass the last one seen as after to replay what came since.
22
+ attr_accessor :event_id
23
+
24
+ # The id of what changed, such as the approval_id.
25
+ attr_accessor :object_id
26
+
27
+ # What changed, such as approval.
28
+ attr_accessor :object_type
29
+
30
+ # The storefront it concerns. Empty for merchant-level objects.
31
+ attr_accessor :storefront_oid
32
+
33
+ # approval.decided (approved, denied, cancelled or refused by the script review) or approval.ready (the review finished and the person can decide).
34
+ attr_accessor :type
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'event_dts' => :'event_dts',
40
+ :'event_id' => :'event_id',
41
+ :'object_id' => :'object_id',
42
+ :'object_type' => :'object_type',
43
+ :'storefront_oid' => :'storefront_oid',
44
+ :'type' => :'type'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'event_dts' => :'String',
57
+ :'event_id' => :'String',
58
+ :'object_id' => :'String',
59
+ :'object_type' => :'String',
60
+ :'storefront_oid' => :'Integer',
61
+ :'type' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbEvent` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'event_dts')
87
+ self.event_dts = attributes[:'event_dts']
88
+ end
89
+
90
+ if attributes.key?(:'event_id')
91
+ self.event_id = attributes[:'event_id']
92
+ end
93
+
94
+ if attributes.key?(:'object_id')
95
+ self.object_id = attributes[:'object_id']
96
+ end
97
+
98
+ if attributes.key?(:'object_type')
99
+ self.object_type = attributes[:'object_type']
100
+ end
101
+
102
+ if attributes.key?(:'storefront_oid')
103
+ self.storefront_oid = attributes[:'storefront_oid']
104
+ end
105
+
106
+ if attributes.key?(:'type')
107
+ self.type = attributes[:'type']
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ invalid_properties = Array.new
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ true
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ event_dts == o.event_dts &&
130
+ event_id == o.event_id &&
131
+ object_id == o.object_id &&
132
+ object_type == o.object_type &&
133
+ storefront_oid == o.storefront_oid &&
134
+ type == o.type
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [event_dts, event_id, object_id, object_type, storefront_oid, type].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ new.build_from_hash(attributes)
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def build_from_hash(attributes)
160
+ return nil unless attributes.is_a?(Hash)
161
+ attributes = attributes.transform_keys(&:to_sym)
162
+ self.class.openapi_types.each_pair do |key, type|
163
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
164
+ self.send("#{key}=", nil)
165
+ elsif type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ end
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :Time
186
+ Time.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :Boolean
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ # models (e.g. Pet) or oneOf
217
+ klass = UltracartClient.const_get(type)
218
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
219
+ end
220
+ end
221
+
222
+ # Returns the string representation of the object
223
+ # @return [String] String presentation of the object
224
+ def to_s
225
+ to_hash.to_s
226
+ end
227
+
228
+ # to_body is an alias to to_hash (backward compatibility)
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_body
231
+ to_hash
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = self.send(attr)
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end
267
+
268
+ end
269
+
270
+ end