ultracart_api 3.4.6 → 3.4.7

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ultracart_api.rb CHANGED
@@ -266,6 +266,9 @@ require 'ultracart_api/models/email_list_archive_response'
266
266
  require 'ultracart_api/models/email_list_customer'
267
267
  require 'ultracart_api/models/email_list_customers_response'
268
268
  require 'ultracart_api/models/email_list_response'
269
+ require 'ultracart_api/models/email_list_segment_folder'
270
+ require 'ultracart_api/models/email_list_segment_folder_response'
271
+ require 'ultracart_api/models/email_list_segment_folders_response'
269
272
  require 'ultracart_api/models/email_list_segment_membership'
270
273
  require 'ultracart_api/models/email_list_segment_used_by'
271
274
  require 'ultracart_api/models/email_list_subscribe_response'
@@ -863,6 +863,65 @@ module UltracartClient
863
863
  end
864
864
  return data, status_code, headers
865
865
  end
866
+ # Delete email ListSegmentFolder
867
+ # @param storefront_oid
868
+ # @param email_list_segment_folder_uuid
869
+ # @param [Hash] opts the optional parameters
870
+ # @return [BaseResponse]
871
+ def delete_email_list_segment_folder(storefront_oid, email_list_segment_folder_uuid, opts = {})
872
+ data, _status_code, _headers = delete_email_list_segment_folder_with_http_info(storefront_oid, email_list_segment_folder_uuid, opts)
873
+ data
874
+ end
875
+
876
+ # Delete email ListSegmentFolder
877
+ # @param storefront_oid
878
+ # @param email_list_segment_folder_uuid
879
+ # @param [Hash] opts the optional parameters
880
+ # @return [Array<(BaseResponse, Fixnum, Hash)>] BaseResponse data, response status code and response headers
881
+ def delete_email_list_segment_folder_with_http_info(storefront_oid, email_list_segment_folder_uuid, opts = {})
882
+ if @api_client.config.debugging
883
+ @api_client.config.logger.debug 'Calling API: StorefrontApi.delete_email_list_segment_folder ...'
884
+ end
885
+ # verify the required parameter 'storefront_oid' is set
886
+ if @api_client.config.client_side_validation && storefront_oid.nil?
887
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling StorefrontApi.delete_email_list_segment_folder"
888
+ end
889
+ # verify the required parameter 'email_list_segment_folder_uuid' is set
890
+ if @api_client.config.client_side_validation && email_list_segment_folder_uuid.nil?
891
+ fail ArgumentError, "Missing the required parameter 'email_list_segment_folder_uuid' when calling StorefrontApi.delete_email_list_segment_folder"
892
+ end
893
+ # resource path
894
+ local_var_path = '/storefront/{storefront_oid}/email/list_segment_folders/{email_list_segment_folder_uuid}'.sub('{' + 'storefront_oid' + '}', storefront_oid.to_s).sub('{' + 'email_list_segment_folder_uuid' + '}', email_list_segment_folder_uuid.to_s)
895
+
896
+ # query parameters
897
+ query_params = {}
898
+
899
+ # header parameters
900
+ header_params = {}
901
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
902
+ # HTTP header 'Accept' (if needed)
903
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
904
+ # HTTP header 'Content-Type'
905
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
906
+
907
+ # form parameters
908
+ form_params = {}
909
+
910
+ # http body (model)
911
+ post_body = nil
912
+ auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
913
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
914
+ :header_params => header_params,
915
+ :query_params => query_params,
916
+ :form_params => form_params,
917
+ :body => post_body,
918
+ :auth_names => auth_names,
919
+ :return_type => 'BaseResponse')
920
+ if @api_client.config.debugging
921
+ @api_client.config.logger.debug "API called: StorefrontApi#delete_email_list_segment_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
922
+ end
923
+ return data, status_code, headers
924
+ end
866
925
  # Delete email postcard
867
926
  # @param storefront_oid
868
927
  # @param commseq_postcard_uuid
@@ -3564,6 +3623,118 @@ module UltracartClient
3564
3623
  end
3565
3624
  return data, status_code, headers
3566
3625
  end
3626
+ # Get email campaign folder
3627
+ # @param storefront_oid
3628
+ # @param email_list_segment_folder_uuid
3629
+ # @param [Hash] opts the optional parameters
3630
+ # @return [EmailListSegmentFolderResponse]
3631
+ def get_email_list_segment_folder(storefront_oid, email_list_segment_folder_uuid, opts = {})
3632
+ data, _status_code, _headers = get_email_list_segment_folder_with_http_info(storefront_oid, email_list_segment_folder_uuid, opts)
3633
+ data
3634
+ end
3635
+
3636
+ # Get email campaign folder
3637
+ # @param storefront_oid
3638
+ # @param email_list_segment_folder_uuid
3639
+ # @param [Hash] opts the optional parameters
3640
+ # @return [Array<(EmailListSegmentFolderResponse, Fixnum, Hash)>] EmailListSegmentFolderResponse data, response status code and response headers
3641
+ def get_email_list_segment_folder_with_http_info(storefront_oid, email_list_segment_folder_uuid, opts = {})
3642
+ if @api_client.config.debugging
3643
+ @api_client.config.logger.debug 'Calling API: StorefrontApi.get_email_list_segment_folder ...'
3644
+ end
3645
+ # verify the required parameter 'storefront_oid' is set
3646
+ if @api_client.config.client_side_validation && storefront_oid.nil?
3647
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling StorefrontApi.get_email_list_segment_folder"
3648
+ end
3649
+ # verify the required parameter 'email_list_segment_folder_uuid' is set
3650
+ if @api_client.config.client_side_validation && email_list_segment_folder_uuid.nil?
3651
+ fail ArgumentError, "Missing the required parameter 'email_list_segment_folder_uuid' when calling StorefrontApi.get_email_list_segment_folder"
3652
+ end
3653
+ # resource path
3654
+ local_var_path = '/storefront/{storefront_oid}/email/list_segment_folders/{email_list_segment_folder_uuid}'.sub('{' + 'storefront_oid' + '}', storefront_oid.to_s).sub('{' + 'email_list_segment_folder_uuid' + '}', email_list_segment_folder_uuid.to_s)
3655
+
3656
+ # query parameters
3657
+ query_params = {}
3658
+
3659
+ # header parameters
3660
+ header_params = {}
3661
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
3662
+ # HTTP header 'Accept' (if needed)
3663
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
3664
+ # HTTP header 'Content-Type'
3665
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
3666
+
3667
+ # form parameters
3668
+ form_params = {}
3669
+
3670
+ # http body (model)
3671
+ post_body = nil
3672
+ auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
3673
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
3674
+ :header_params => header_params,
3675
+ :query_params => query_params,
3676
+ :form_params => form_params,
3677
+ :body => post_body,
3678
+ :auth_names => auth_names,
3679
+ :return_type => 'EmailListSegmentFolderResponse')
3680
+ if @api_client.config.debugging
3681
+ @api_client.config.logger.debug "API called: StorefrontApi#get_email_list_segment_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3682
+ end
3683
+ return data, status_code, headers
3684
+ end
3685
+ # Get email campaign folders
3686
+ # @param storefront_oid
3687
+ # @param [Hash] opts the optional parameters
3688
+ # @return [EmailListSegmentFoldersResponse]
3689
+ def get_email_list_segment_folders(storefront_oid, opts = {})
3690
+ data, _status_code, _headers = get_email_list_segment_folders_with_http_info(storefront_oid, opts)
3691
+ data
3692
+ end
3693
+
3694
+ # Get email campaign folders
3695
+ # @param storefront_oid
3696
+ # @param [Hash] opts the optional parameters
3697
+ # @return [Array<(EmailListSegmentFoldersResponse, Fixnum, Hash)>] EmailListSegmentFoldersResponse data, response status code and response headers
3698
+ def get_email_list_segment_folders_with_http_info(storefront_oid, opts = {})
3699
+ if @api_client.config.debugging
3700
+ @api_client.config.logger.debug 'Calling API: StorefrontApi.get_email_list_segment_folders ...'
3701
+ end
3702
+ # verify the required parameter 'storefront_oid' is set
3703
+ if @api_client.config.client_side_validation && storefront_oid.nil?
3704
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling StorefrontApi.get_email_list_segment_folders"
3705
+ end
3706
+ # resource path
3707
+ local_var_path = '/storefront/{storefront_oid}/email/list_segment_folders'.sub('{' + 'storefront_oid' + '}', storefront_oid.to_s)
3708
+
3709
+ # query parameters
3710
+ query_params = {}
3711
+
3712
+ # header parameters
3713
+ header_params = {}
3714
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
3715
+ # HTTP header 'Accept' (if needed)
3716
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
3717
+ # HTTP header 'Content-Type'
3718
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
3719
+
3720
+ # form parameters
3721
+ form_params = {}
3722
+
3723
+ # http body (model)
3724
+ post_body = nil
3725
+ auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
3726
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
3727
+ :header_params => header_params,
3728
+ :query_params => query_params,
3729
+ :form_params => form_params,
3730
+ :body => post_body,
3731
+ :auth_names => auth_names,
3732
+ :return_type => 'EmailListSegmentFoldersResponse')
3733
+ if @api_client.config.debugging
3734
+ @api_client.config.logger.debug "API called: StorefrontApi#get_email_list_segment_folders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3735
+ end
3736
+ return data, status_code, headers
3737
+ end
3567
3738
  # Get email lists
3568
3739
  # @param storefront_oid
3569
3740
  # @param [Hash] opts the optional parameters
@@ -6267,6 +6438,65 @@ module UltracartClient
6267
6438
  end
6268
6439
  return data, status_code, headers
6269
6440
  end
6441
+ # Insert email campaign folder
6442
+ # @param storefront_oid
6443
+ # @param email_list_segment_folder Email campaign folder
6444
+ # @param [Hash] opts the optional parameters
6445
+ # @return [EmailListSegmentFolderResponse]
6446
+ def insert_email_list_segment_folder(storefront_oid, email_list_segment_folder, opts = {})
6447
+ data, _status_code, _headers = insert_email_list_segment_folder_with_http_info(storefront_oid, email_list_segment_folder, opts)
6448
+ data
6449
+ end
6450
+
6451
+ # Insert email campaign folder
6452
+ # @param storefront_oid
6453
+ # @param email_list_segment_folder Email campaign folder
6454
+ # @param [Hash] opts the optional parameters
6455
+ # @return [Array<(EmailListSegmentFolderResponse, Fixnum, Hash)>] EmailListSegmentFolderResponse data, response status code and response headers
6456
+ def insert_email_list_segment_folder_with_http_info(storefront_oid, email_list_segment_folder, opts = {})
6457
+ if @api_client.config.debugging
6458
+ @api_client.config.logger.debug 'Calling API: StorefrontApi.insert_email_list_segment_folder ...'
6459
+ end
6460
+ # verify the required parameter 'storefront_oid' is set
6461
+ if @api_client.config.client_side_validation && storefront_oid.nil?
6462
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling StorefrontApi.insert_email_list_segment_folder"
6463
+ end
6464
+ # verify the required parameter 'email_list_segment_folder' is set
6465
+ if @api_client.config.client_side_validation && email_list_segment_folder.nil?
6466
+ fail ArgumentError, "Missing the required parameter 'email_list_segment_folder' when calling StorefrontApi.insert_email_list_segment_folder"
6467
+ end
6468
+ # resource path
6469
+ local_var_path = '/storefront/{storefront_oid}/email/list_segment_folders'.sub('{' + 'storefront_oid' + '}', storefront_oid.to_s)
6470
+
6471
+ # query parameters
6472
+ query_params = {}
6473
+
6474
+ # header parameters
6475
+ header_params = {}
6476
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
6477
+ # HTTP header 'Accept' (if needed)
6478
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
6479
+ # HTTP header 'Content-Type'
6480
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
6481
+
6482
+ # form parameters
6483
+ form_params = {}
6484
+
6485
+ # http body (model)
6486
+ post_body = @api_client.object_to_http_body(email_list_segment_folder)
6487
+ auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
6488
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
6489
+ :header_params => header_params,
6490
+ :query_params => query_params,
6491
+ :form_params => form_params,
6492
+ :body => post_body,
6493
+ :auth_names => auth_names,
6494
+ :return_type => 'EmailListSegmentFolderResponse')
6495
+ if @api_client.config.debugging
6496
+ @api_client.config.logger.debug "API called: StorefrontApi#insert_email_list_segment_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
6497
+ end
6498
+ return data, status_code, headers
6499
+ end
6270
6500
  # Insert email postcard
6271
6501
  # @param storefront_oid
6272
6502
  # @param email_commseq_postcard Email postcard
@@ -8128,6 +8358,71 @@ module UltracartClient
8128
8358
  end
8129
8359
  return data, status_code, headers
8130
8360
  end
8361
+ # Update email campaign folder
8362
+ # @param storefront_oid
8363
+ # @param email_list_segment_folder_uuid
8364
+ # @param email_list_segment_folder Email campaign folder
8365
+ # @param [Hash] opts the optional parameters
8366
+ # @return [EmailListSegmentFolderResponse]
8367
+ def update_email_list_segment_folder(storefront_oid, email_list_segment_folder_uuid, email_list_segment_folder, opts = {})
8368
+ data, _status_code, _headers = update_email_list_segment_folder_with_http_info(storefront_oid, email_list_segment_folder_uuid, email_list_segment_folder, opts)
8369
+ data
8370
+ end
8371
+
8372
+ # Update email campaign folder
8373
+ # @param storefront_oid
8374
+ # @param email_list_segment_folder_uuid
8375
+ # @param email_list_segment_folder Email campaign folder
8376
+ # @param [Hash] opts the optional parameters
8377
+ # @return [Array<(EmailListSegmentFolderResponse, Fixnum, Hash)>] EmailListSegmentFolderResponse data, response status code and response headers
8378
+ def update_email_list_segment_folder_with_http_info(storefront_oid, email_list_segment_folder_uuid, email_list_segment_folder, opts = {})
8379
+ if @api_client.config.debugging
8380
+ @api_client.config.logger.debug 'Calling API: StorefrontApi.update_email_list_segment_folder ...'
8381
+ end
8382
+ # verify the required parameter 'storefront_oid' is set
8383
+ if @api_client.config.client_side_validation && storefront_oid.nil?
8384
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling StorefrontApi.update_email_list_segment_folder"
8385
+ end
8386
+ # verify the required parameter 'email_list_segment_folder_uuid' is set
8387
+ if @api_client.config.client_side_validation && email_list_segment_folder_uuid.nil?
8388
+ fail ArgumentError, "Missing the required parameter 'email_list_segment_folder_uuid' when calling StorefrontApi.update_email_list_segment_folder"
8389
+ end
8390
+ # verify the required parameter 'email_list_segment_folder' is set
8391
+ if @api_client.config.client_side_validation && email_list_segment_folder.nil?
8392
+ fail ArgumentError, "Missing the required parameter 'email_list_segment_folder' when calling StorefrontApi.update_email_list_segment_folder"
8393
+ end
8394
+ # resource path
8395
+ local_var_path = '/storefront/{storefront_oid}/email/list_segment_folders/{email_list_segment_folder_uuid}'.sub('{' + 'storefront_oid' + '}', storefront_oid.to_s).sub('{' + 'email_list_segment_folder_uuid' + '}', email_list_segment_folder_uuid.to_s)
8396
+
8397
+ # query parameters
8398
+ query_params = {}
8399
+
8400
+ # header parameters
8401
+ header_params = {}
8402
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
8403
+ # HTTP header 'Accept' (if needed)
8404
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
8405
+ # HTTP header 'Content-Type'
8406
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
8407
+
8408
+ # form parameters
8409
+ form_params = {}
8410
+
8411
+ # http body (model)
8412
+ post_body = @api_client.object_to_http_body(email_list_segment_folder)
8413
+ auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
8414
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
8415
+ :header_params => header_params,
8416
+ :query_params => query_params,
8417
+ :form_params => form_params,
8418
+ :body => post_body,
8419
+ :auth_names => auth_names,
8420
+ :return_type => 'EmailListSegmentFolderResponse')
8421
+ if @api_client.config.debugging
8422
+ @api_client.config.logger.debug "API called: StorefrontApi#update_email_list_segment_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
8423
+ end
8424
+ return data, status_code, headers
8425
+ end
8131
8426
  # Update email plan
8132
8427
  # @param storefront_oid
8133
8428
  # @param settings plan request
@@ -26,6 +26,9 @@ module UltracartClient
26
26
  # Email list UUID
27
27
  attr_accessor :email_list_uuid
28
28
 
29
+ # List/Segment folder UUID
30
+ attr_accessor :esp_list_segment_folder_uuid
31
+
29
32
  # Count of members in this list
30
33
  attr_accessor :member_count
31
34
 
@@ -54,6 +57,7 @@ module UltracartClient
54
57
  :'created_dts' => :'created_dts',
55
58
  :'deleted' => :'deleted',
56
59
  :'email_list_uuid' => :'email_list_uuid',
60
+ :'esp_list_segment_folder_uuid' => :'esp_list_segment_folder_uuid',
57
61
  :'member_count' => :'member_count',
58
62
  :'merchant_id' => :'merchant_id',
59
63
  :'name' => :'name',
@@ -71,6 +75,7 @@ module UltracartClient
71
75
  :'created_dts' => :'String',
72
76
  :'deleted' => :'BOOLEAN',
73
77
  :'email_list_uuid' => :'String',
78
+ :'esp_list_segment_folder_uuid' => :'String',
74
79
  :'member_count' => :'Integer',
75
80
  :'merchant_id' => :'String',
76
81
  :'name' => :'String',
@@ -105,6 +110,10 @@ module UltracartClient
105
110
  self.email_list_uuid = attributes[:'email_list_uuid']
106
111
  end
107
112
 
113
+ if attributes.has_key?(:'esp_list_segment_folder_uuid')
114
+ self.esp_list_segment_folder_uuid = attributes[:'esp_list_segment_folder_uuid']
115
+ end
116
+
108
117
  if attributes.has_key?(:'member_count')
109
118
  self.member_count = attributes[:'member_count']
110
119
  end
@@ -173,6 +182,7 @@ module UltracartClient
173
182
  created_dts == o.created_dts &&
174
183
  deleted == o.deleted &&
175
184
  email_list_uuid == o.email_list_uuid &&
185
+ esp_list_segment_folder_uuid == o.esp_list_segment_folder_uuid &&
176
186
  member_count == o.member_count &&
177
187
  merchant_id == o.merchant_id &&
178
188
  name == o.name &&
@@ -191,7 +201,7 @@ module UltracartClient
191
201
  # Calculates hash code according to all attributes.
192
202
  # @return [Fixnum] Hash code
193
203
  def hash
194
- [allow_csv_download, created_dts, deleted, email_list_uuid, member_count, merchant_id, name, public_description, public_list, storefront_oid, used_by].hash
204
+ [allow_csv_download, created_dts, deleted, email_list_uuid, esp_list_segment_folder_uuid, member_count, merchant_id, name, public_description, public_list, storefront_oid, used_by].hash
195
205
  end
196
206
 
197
207
  # Builds the object from hash
@@ -0,0 +1,240 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class EmailListSegmentFolder
17
+ # Email list segment folder UUID
18
+ attr_accessor :esp_list_segment_folder_uuid
19
+
20
+ # Merchant ID
21
+ attr_accessor :merchant_id
22
+
23
+ # Name of email campaign folder
24
+ attr_accessor :name
25
+
26
+ # Storefront oid
27
+ attr_accessor :storefront_oid
28
+
29
+ # System generated folder
30
+ attr_accessor :system_generated
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'esp_list_segment_folder_uuid' => :'esp_list_segment_folder_uuid',
36
+ :'merchant_id' => :'merchant_id',
37
+ :'name' => :'name',
38
+ :'storefront_oid' => :'storefront_oid',
39
+ :'system_generated' => :'system_generated'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'esp_list_segment_folder_uuid' => :'String',
47
+ :'merchant_id' => :'String',
48
+ :'name' => :'String',
49
+ :'storefront_oid' => :'Integer',
50
+ :'system_generated' => :'BOOLEAN'
51
+ }
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ return unless attributes.is_a?(Hash)
58
+
59
+ # convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
61
+
62
+ if attributes.has_key?(:'esp_list_segment_folder_uuid')
63
+ self.esp_list_segment_folder_uuid = attributes[:'esp_list_segment_folder_uuid']
64
+ end
65
+
66
+ if attributes.has_key?(:'merchant_id')
67
+ self.merchant_id = attributes[:'merchant_id']
68
+ end
69
+
70
+ if attributes.has_key?(:'name')
71
+ self.name = attributes[:'name']
72
+ end
73
+
74
+ if attributes.has_key?(:'storefront_oid')
75
+ self.storefront_oid = attributes[:'storefront_oid']
76
+ end
77
+
78
+ if attributes.has_key?(:'system_generated')
79
+ self.system_generated = attributes[:'system_generated']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ if !@name.nil? && @name.to_s.length > 250
88
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 250.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return false if !@name.nil? && @name.to_s.length > 250
98
+ true
99
+ end
100
+
101
+ # Custom attribute writer method with validation
102
+ # @param [Object] name Value to be assigned
103
+ def name=(name)
104
+ if !name.nil? && name.to_s.length > 250
105
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 250.'
106
+ end
107
+
108
+ @name = name
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ esp_list_segment_folder_uuid == o.esp_list_segment_folder_uuid &&
117
+ merchant_id == o.merchant_id &&
118
+ name == o.name &&
119
+ storefront_oid == o.storefront_oid &&
120
+ system_generated == o.system_generated
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Fixnum] Hash code
131
+ def hash
132
+ [esp_list_segment_folder_uuid, merchant_id, name, storefront_oid, system_generated].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ self.class.swagger_types.each_pair do |key, type|
141
+ if type =~ /\AArray<(.*)>/i
142
+ # check to ensure the input is an array given that the attribute
143
+ # is documented as an array but the input is not
144
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
145
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
146
+ end
147
+ elsif !attributes[self.class.attribute_map[key]].nil?
148
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
149
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
150
+ end
151
+
152
+ self
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param string type Data type
157
+ # @param string value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def _deserialize(type, value)
160
+ case type.to_sym
161
+ when :DateTime
162
+ DateTime.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :BOOLEAN
172
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ temp_model = UltracartClient.const_get(type).new
193
+ temp_model.build_from_hash(value)
194
+ end
195
+ end
196
+
197
+ # Returns the string representation of the object
198
+ # @return [String] String presentation of the object
199
+ def to_s
200
+ to_hash.to_s
201
+ end
202
+
203
+ # to_body is an alias to to_hash (backward compatibility)
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_body
206
+ to_hash
207
+ end
208
+
209
+ # Returns the object in the form of hash
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_hash
212
+ hash = {}
213
+ self.class.attribute_map.each_pair do |attr, param|
214
+ value = self.send(attr)
215
+ next if value.nil?
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+
239
+ end
240
+ end