ultracart_api 4.1.205 → 4.1.207

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.
@@ -3258,6 +3258,76 @@ module UltracartClient
3258
3258
  return data, status_code, headers
3259
3259
  end
3260
3260
 
3261
+ # Get a campaign
3262
+ # One campaign, the same object as its list entry, with its emails and postcards in step order. A deleted campaign is returned with deleted true.
3263
+ # @param storefront_oid [Integer]
3264
+ # @param campaign_uuid [String]
3265
+ # @param [Hash] opts the optional parameters
3266
+ # @return [SfvbCampaign]
3267
+ def get_sfvb_campaign(storefront_oid, campaign_uuid, opts = {})
3268
+ data, _status_code, _headers = get_sfvb_campaign_with_http_info(storefront_oid, campaign_uuid, opts)
3269
+ data
3270
+ end
3271
+
3272
+ # Get a campaign
3273
+ # One campaign, the same object as its list entry, with its emails and postcards in step order. A deleted campaign is returned with deleted true.
3274
+ # @param storefront_oid [Integer]
3275
+ # @param campaign_uuid [String]
3276
+ # @param [Hash] opts the optional parameters
3277
+ # @return [Array<(SfvbCampaign, Integer, Hash)>] SfvbCampaign data, response status code and response headers
3278
+ def get_sfvb_campaign_with_http_info(storefront_oid, campaign_uuid, opts = {})
3279
+ if @api_client.config.debugging
3280
+ @api_client.config.logger.debug 'Calling API: SfvbApi.get_sfvb_campaign ...'
3281
+ end
3282
+ # verify the required parameter 'storefront_oid' is set
3283
+ if @api_client.config.client_side_validation && storefront_oid.nil?
3284
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling SfvbApi.get_sfvb_campaign"
3285
+ end
3286
+ # verify the required parameter 'campaign_uuid' is set
3287
+ if @api_client.config.client_side_validation && campaign_uuid.nil?
3288
+ fail ArgumentError, "Missing the required parameter 'campaign_uuid' when calling SfvbApi.get_sfvb_campaign"
3289
+ end
3290
+ # resource path
3291
+ local_var_path = '/sfvb/storefronts/{storefront_oid}/campaigns/{campaign_uuid}'.sub('{' + 'storefront_oid' + '}', CGI.escape(storefront_oid.to_s)).sub('{' + 'campaign_uuid' + '}', CGI.escape(campaign_uuid.to_s))
3292
+
3293
+ # query parameters
3294
+ query_params = opts[:query_params] || {}
3295
+
3296
+ # header parameters
3297
+ header_params = opts[:header_params] || {}
3298
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
3299
+ # HTTP header 'Accept' (if needed)
3300
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
3301
+
3302
+ # form parameters
3303
+ form_params = opts[:form_params] || {}
3304
+
3305
+ # http body (model)
3306
+ post_body = opts[:debug_body]
3307
+
3308
+ # return_type
3309
+ return_type = opts[:debug_return_type] || 'SfvbCampaign'
3310
+
3311
+ # auth_names
3312
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
3313
+
3314
+ new_options = opts.merge(
3315
+ :operation => :"SfvbApi.get_sfvb_campaign",
3316
+ :header_params => header_params,
3317
+ :query_params => query_params,
3318
+ :form_params => form_params,
3319
+ :body => post_body,
3320
+ :auth_names => auth_names,
3321
+ :return_type => return_type
3322
+ )
3323
+
3324
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
3325
+ if @api_client.config.debugging
3326
+ @api_client.config.logger.debug "API called: SfvbApi#get_sfvb_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3327
+ end
3328
+ return data, status_code, headers
3329
+ end
3330
+
3261
3331
  # Element types used by a container
3262
3332
  # @param compile_request [SfvbCompileRequest] CJSON to inspect
3263
3333
  # @param [Hash] opts the optional parameters
@@ -4136,6 +4206,76 @@ module UltracartClient
4136
4206
  return data, status_code, headers
4137
4207
  end
4138
4208
 
4209
+ # Get a flow
4210
+ # One flow, the same object as its list entry, with its emails and postcards in step order. A deleted flow is returned with deleted true.
4211
+ # @param storefront_oid [Integer]
4212
+ # @param flow_uuid [String]
4213
+ # @param [Hash] opts the optional parameters
4214
+ # @return [SfvbFlow]
4215
+ def get_sfvb_flow(storefront_oid, flow_uuid, opts = {})
4216
+ data, _status_code, _headers = get_sfvb_flow_with_http_info(storefront_oid, flow_uuid, opts)
4217
+ data
4218
+ end
4219
+
4220
+ # Get a flow
4221
+ # One flow, the same object as its list entry, with its emails and postcards in step order. A deleted flow is returned with deleted true.
4222
+ # @param storefront_oid [Integer]
4223
+ # @param flow_uuid [String]
4224
+ # @param [Hash] opts the optional parameters
4225
+ # @return [Array<(SfvbFlow, Integer, Hash)>] SfvbFlow data, response status code and response headers
4226
+ def get_sfvb_flow_with_http_info(storefront_oid, flow_uuid, opts = {})
4227
+ if @api_client.config.debugging
4228
+ @api_client.config.logger.debug 'Calling API: SfvbApi.get_sfvb_flow ...'
4229
+ end
4230
+ # verify the required parameter 'storefront_oid' is set
4231
+ if @api_client.config.client_side_validation && storefront_oid.nil?
4232
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling SfvbApi.get_sfvb_flow"
4233
+ end
4234
+ # verify the required parameter 'flow_uuid' is set
4235
+ if @api_client.config.client_side_validation && flow_uuid.nil?
4236
+ fail ArgumentError, "Missing the required parameter 'flow_uuid' when calling SfvbApi.get_sfvb_flow"
4237
+ end
4238
+ # resource path
4239
+ local_var_path = '/sfvb/storefronts/{storefront_oid}/flows/{flow_uuid}'.sub('{' + 'storefront_oid' + '}', CGI.escape(storefront_oid.to_s)).sub('{' + 'flow_uuid' + '}', CGI.escape(flow_uuid.to_s))
4240
+
4241
+ # query parameters
4242
+ query_params = opts[:query_params] || {}
4243
+
4244
+ # header parameters
4245
+ header_params = opts[:header_params] || {}
4246
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
4247
+ # HTTP header 'Accept' (if needed)
4248
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
4249
+
4250
+ # form parameters
4251
+ form_params = opts[:form_params] || {}
4252
+
4253
+ # http body (model)
4254
+ post_body = opts[:debug_body]
4255
+
4256
+ # return_type
4257
+ return_type = opts[:debug_return_type] || 'SfvbFlow'
4258
+
4259
+ # auth_names
4260
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
4261
+
4262
+ new_options = opts.merge(
4263
+ :operation => :"SfvbApi.get_sfvb_flow",
4264
+ :header_params => header_params,
4265
+ :query_params => query_params,
4266
+ :form_params => form_params,
4267
+ :body => post_body,
4268
+ :auth_names => auth_names,
4269
+ :return_type => return_type
4270
+ )
4271
+
4272
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
4273
+ if @api_client.config.debugging
4274
+ @api_client.config.logger.debug "API called: SfvbApi#get_sfvb_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
4275
+ end
4276
+ return data, status_code, headers
4277
+ end
4278
+
4139
4279
  # Read the storefront's translation glossary
4140
4280
  # The storefront's glossary, plain markdown with terms not to translate, required translations, tone and words to avoid. Read it before translating anything. Empty when none has been saved. Each storefront has its own, because a storefront is often its own brand.
4141
4281
  # @param storefront_oid [Integer]
@@ -7921,6 +8061,82 @@ module UltracartClient
7921
8061
  return data, status_code, headers
7922
8062
  end
7923
8063
 
8064
+ # List the storefront's campaigns
8065
+ # One page of campaigns, newest first, each with its emails and postcards in step order, without their container JSON. search matches the campaign name. Deleted campaigns are left out unless include_deleted is true. live is true unless the status sends nothing (draft or archived), so a change to one of its emails reaches customers at once.
8066
+ # @param storefront_oid [Integer]
8067
+ # @param [Hash] opts the optional parameters
8068
+ # @option opts [String] :search Text to search for in the name
8069
+ # @option opts [Integer] :page Page number, starting at 1
8070
+ # @option opts [Integer] :page_size Campaigns per page, 1 to 100, default 50
8071
+ # @option opts [Boolean] :include_deleted Include deleted campaigns
8072
+ # @return [SfvbCampaignsResponse]
8073
+ def list_sfvb_campaigns(storefront_oid, opts = {})
8074
+ data, _status_code, _headers = list_sfvb_campaigns_with_http_info(storefront_oid, opts)
8075
+ data
8076
+ end
8077
+
8078
+ # List the storefront&#39;s campaigns
8079
+ # One page of campaigns, newest first, each with its emails and postcards in step order, without their container JSON. search matches the campaign name. Deleted campaigns are left out unless include_deleted is true. live is true unless the status sends nothing (draft or archived), so a change to one of its emails reaches customers at once.
8080
+ # @param storefront_oid [Integer]
8081
+ # @param [Hash] opts the optional parameters
8082
+ # @option opts [String] :search Text to search for in the name
8083
+ # @option opts [Integer] :page Page number, starting at 1
8084
+ # @option opts [Integer] :page_size Campaigns per page, 1 to 100, default 50
8085
+ # @option opts [Boolean] :include_deleted Include deleted campaigns
8086
+ # @return [Array<(SfvbCampaignsResponse, Integer, Hash)>] SfvbCampaignsResponse data, response status code and response headers
8087
+ def list_sfvb_campaigns_with_http_info(storefront_oid, opts = {})
8088
+ if @api_client.config.debugging
8089
+ @api_client.config.logger.debug 'Calling API: SfvbApi.list_sfvb_campaigns ...'
8090
+ end
8091
+ # verify the required parameter 'storefront_oid' is set
8092
+ if @api_client.config.client_side_validation && storefront_oid.nil?
8093
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling SfvbApi.list_sfvb_campaigns"
8094
+ end
8095
+ # resource path
8096
+ local_var_path = '/sfvb/storefronts/{storefront_oid}/campaigns'.sub('{' + 'storefront_oid' + '}', CGI.escape(storefront_oid.to_s))
8097
+
8098
+ # query parameters
8099
+ query_params = opts[:query_params] || {}
8100
+ query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
8101
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
8102
+ query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
8103
+ query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil?
8104
+
8105
+ # header parameters
8106
+ header_params = opts[:header_params] || {}
8107
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
8108
+ # HTTP header 'Accept' (if needed)
8109
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
8110
+
8111
+ # form parameters
8112
+ form_params = opts[:form_params] || {}
8113
+
8114
+ # http body (model)
8115
+ post_body = opts[:debug_body]
8116
+
8117
+ # return_type
8118
+ return_type = opts[:debug_return_type] || 'SfvbCampaignsResponse'
8119
+
8120
+ # auth_names
8121
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
8122
+
8123
+ new_options = opts.merge(
8124
+ :operation => :"SfvbApi.list_sfvb_campaigns",
8125
+ :header_params => header_params,
8126
+ :query_params => query_params,
8127
+ :form_params => form_params,
8128
+ :body => post_body,
8129
+ :auth_names => auth_names,
8130
+ :return_type => return_type
8131
+ )
8132
+
8133
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
8134
+ if @api_client.config.debugging
8135
+ @api_client.config.logger.debug "API called: SfvbApi#list_sfvb_campaigns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
8136
+ end
8137
+ return data, status_code, headers
8138
+ end
8139
+
7924
8140
  # Version history for a container stored outside the file system
7925
8141
  # Addressed the same way as the container itself, so owner_type also says how owner_object_id is read and itemid lists the history of the item container that merchant item id names.
7926
8142
  # @param storefront_oid [Integer]
@@ -8268,6 +8484,82 @@ module UltracartClient
8268
8484
  return data, status_code, headers
8269
8485
  end
8270
8486
 
8487
+ # List the storefront's flows
8488
+ # One page of flows, newest first, each with its trigger and its emails and postcards in step order, without their container JSON. search matches the flow name. Deleted flows are left out unless include_deleted is true. live is true unless the status sends nothing (draft or inactive); a paused flow still holds enrolled customers, so it counts as live.
8489
+ # @param storefront_oid [Integer]
8490
+ # @param [Hash] opts the optional parameters
8491
+ # @option opts [String] :search Text to search for in the name
8492
+ # @option opts [Integer] :page Page number, starting at 1
8493
+ # @option opts [Integer] :page_size Flows per page, 1 to 100, default 50
8494
+ # @option opts [Boolean] :include_deleted Include deleted flows
8495
+ # @return [SfvbFlowsResponse]
8496
+ def list_sfvb_flows(storefront_oid, opts = {})
8497
+ data, _status_code, _headers = list_sfvb_flows_with_http_info(storefront_oid, opts)
8498
+ data
8499
+ end
8500
+
8501
+ # List the storefront&#39;s flows
8502
+ # One page of flows, newest first, each with its trigger and its emails and postcards in step order, without their container JSON. search matches the flow name. Deleted flows are left out unless include_deleted is true. live is true unless the status sends nothing (draft or inactive); a paused flow still holds enrolled customers, so it counts as live.
8503
+ # @param storefront_oid [Integer]
8504
+ # @param [Hash] opts the optional parameters
8505
+ # @option opts [String] :search Text to search for in the name
8506
+ # @option opts [Integer] :page Page number, starting at 1
8507
+ # @option opts [Integer] :page_size Flows per page, 1 to 100, default 50
8508
+ # @option opts [Boolean] :include_deleted Include deleted flows
8509
+ # @return [Array<(SfvbFlowsResponse, Integer, Hash)>] SfvbFlowsResponse data, response status code and response headers
8510
+ def list_sfvb_flows_with_http_info(storefront_oid, opts = {})
8511
+ if @api_client.config.debugging
8512
+ @api_client.config.logger.debug 'Calling API: SfvbApi.list_sfvb_flows ...'
8513
+ end
8514
+ # verify the required parameter 'storefront_oid' is set
8515
+ if @api_client.config.client_side_validation && storefront_oid.nil?
8516
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling SfvbApi.list_sfvb_flows"
8517
+ end
8518
+ # resource path
8519
+ local_var_path = '/sfvb/storefronts/{storefront_oid}/flows'.sub('{' + 'storefront_oid' + '}', CGI.escape(storefront_oid.to_s))
8520
+
8521
+ # query parameters
8522
+ query_params = opts[:query_params] || {}
8523
+ query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
8524
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
8525
+ query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
8526
+ query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil?
8527
+
8528
+ # header parameters
8529
+ header_params = opts[:header_params] || {}
8530
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
8531
+ # HTTP header 'Accept' (if needed)
8532
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
8533
+
8534
+ # form parameters
8535
+ form_params = opts[:form_params] || {}
8536
+
8537
+ # http body (model)
8538
+ post_body = opts[:debug_body]
8539
+
8540
+ # return_type
8541
+ return_type = opts[:debug_return_type] || 'SfvbFlowsResponse'
8542
+
8543
+ # auth_names
8544
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
8545
+
8546
+ new_options = opts.merge(
8547
+ :operation => :"SfvbApi.list_sfvb_flows",
8548
+ :header_params => header_params,
8549
+ :query_params => query_params,
8550
+ :form_params => form_params,
8551
+ :body => post_body,
8552
+ :auth_names => auth_names,
8553
+ :return_type => return_type
8554
+ )
8555
+
8556
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
8557
+ if @api_client.config.debugging
8558
+ @api_client.config.logger.debug "API called: SfvbApi#list_sfvb_flows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
8559
+ end
8560
+ return data, status_code, headers
8561
+ end
8562
+
8271
8563
  # List built-in messages
8272
8564
  # The system text templates render by key, such as checkout labels, for one theme (the active theme unless theme_oid is given). Each message has its English, whether it was edited, and each enabled language's text with its source (hand, machine, pending or none). A message appears the first time a page renders it. q matches the key or the English. overridden keeps messages with an edited English or a hand translation. Paged by offset and limit (default 200, at most 500).
8273
8565
  # @param storefront_oid [Integer]
@@ -0,0 +1,324 @@
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 SfvbCampaign
18
+ # The campaign uuid.
19
+ attr_accessor :campaign_uuid
20
+
21
+ # The communication sequence the steps belong to.
22
+ attr_accessor :communication_sequence_uuid
23
+
24
+ # When the campaign was created (ISO 8601, UTC).
25
+ attr_accessor :created_dts
26
+
27
+ # True when the campaign was deleted.
28
+ attr_accessor :deleted
29
+
30
+ # Its emails, in step order.
31
+ attr_accessor :emails
32
+
33
+ # True when the emails and postcards reach customers now, so a change to one shows at once. False only in a status that sends nothing.
34
+ attr_accessor :live
35
+
36
+ # The campaign name.
37
+ attr_accessor :name
38
+
39
+ # Its postcards, in step order.
40
+ attr_accessor :postcards
41
+
42
+ # When the campaign is scheduled to send (ISO 8601, UTC), when it is.
43
+ attr_accessor :scheduled_dts
44
+
45
+ # The status, such as draft, scheduled, sending, sent or archived.
46
+ attr_accessor :status
47
+
48
+ # When the status last changed (ISO 8601, UTC).
49
+ attr_accessor :status_dts
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'campaign_uuid' => :'campaign_uuid',
55
+ :'communication_sequence_uuid' => :'communication_sequence_uuid',
56
+ :'created_dts' => :'created_dts',
57
+ :'deleted' => :'deleted',
58
+ :'emails' => :'emails',
59
+ :'live' => :'live',
60
+ :'name' => :'name',
61
+ :'postcards' => :'postcards',
62
+ :'scheduled_dts' => :'scheduled_dts',
63
+ :'status' => :'status',
64
+ :'status_dts' => :'status_dts'
65
+ }
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'campaign_uuid' => :'String',
77
+ :'communication_sequence_uuid' => :'String',
78
+ :'created_dts' => :'String',
79
+ :'deleted' => :'Boolean',
80
+ :'emails' => :'Array<SfvbCommsEmail>',
81
+ :'live' => :'Boolean',
82
+ :'name' => :'String',
83
+ :'postcards' => :'Array<SfvbCommsPostcard>',
84
+ :'scheduled_dts' => :'String',
85
+ :'status' => :'String',
86
+ :'status_dts' => :'String'
87
+ }
88
+ end
89
+
90
+ # List of attributes with nullable: true
91
+ def self.openapi_nullable
92
+ Set.new([
93
+ ])
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ if (!attributes.is_a?(Hash))
100
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbCampaign` initialize method"
101
+ end
102
+
103
+ # check to see if the attribute exists and convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h|
105
+ if (!self.class.attribute_map.key?(k.to_sym))
106
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
107
+ end
108
+ h[k.to_sym] = v
109
+ }
110
+
111
+ if attributes.key?(:'campaign_uuid')
112
+ self.campaign_uuid = attributes[:'campaign_uuid']
113
+ end
114
+
115
+ if attributes.key?(:'communication_sequence_uuid')
116
+ self.communication_sequence_uuid = attributes[:'communication_sequence_uuid']
117
+ end
118
+
119
+ if attributes.key?(:'created_dts')
120
+ self.created_dts = attributes[:'created_dts']
121
+ end
122
+
123
+ if attributes.key?(:'deleted')
124
+ self.deleted = attributes[:'deleted']
125
+ end
126
+
127
+ if attributes.key?(:'emails')
128
+ if (value = attributes[:'emails']).is_a?(Array)
129
+ self.emails = value
130
+ end
131
+ end
132
+
133
+ if attributes.key?(:'live')
134
+ self.live = attributes[:'live']
135
+ end
136
+
137
+ if attributes.key?(:'name')
138
+ self.name = attributes[:'name']
139
+ end
140
+
141
+ if attributes.key?(:'postcards')
142
+ if (value = attributes[:'postcards']).is_a?(Array)
143
+ self.postcards = value
144
+ end
145
+ end
146
+
147
+ if attributes.key?(:'scheduled_dts')
148
+ self.scheduled_dts = attributes[:'scheduled_dts']
149
+ end
150
+
151
+ if attributes.key?(:'status')
152
+ self.status = attributes[:'status']
153
+ end
154
+
155
+ if attributes.key?(:'status_dts')
156
+ self.status_dts = attributes[:'status_dts']
157
+ end
158
+ end
159
+
160
+ # Show invalid properties with the reasons. Usually used together with valid?
161
+ # @return Array for valid properties with the reasons
162
+ def list_invalid_properties
163
+ invalid_properties = Array.new
164
+ invalid_properties
165
+ end
166
+
167
+ # Check to see if the all the properties in the model are valid
168
+ # @return true if the model is valid
169
+ def valid?
170
+ true
171
+ end
172
+
173
+ # Checks equality by comparing each attribute.
174
+ # @param [Object] Object to be compared
175
+ def ==(o)
176
+ return true if self.equal?(o)
177
+ self.class == o.class &&
178
+ campaign_uuid == o.campaign_uuid &&
179
+ communication_sequence_uuid == o.communication_sequence_uuid &&
180
+ created_dts == o.created_dts &&
181
+ deleted == o.deleted &&
182
+ emails == o.emails &&
183
+ live == o.live &&
184
+ name == o.name &&
185
+ postcards == o.postcards &&
186
+ scheduled_dts == o.scheduled_dts &&
187
+ status == o.status &&
188
+ status_dts == o.status_dts
189
+ end
190
+
191
+ # @see the `==` method
192
+ # @param [Object] Object to be compared
193
+ def eql?(o)
194
+ self == o
195
+ end
196
+
197
+ # Calculates hash code according to all attributes.
198
+ # @return [Integer] Hash code
199
+ def hash
200
+ [campaign_uuid, communication_sequence_uuid, created_dts, deleted, emails, live, name, postcards, scheduled_dts, status, status_dts].hash
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def self.build_from_hash(attributes)
207
+ new.build_from_hash(attributes)
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def build_from_hash(attributes)
214
+ return nil unless attributes.is_a?(Hash)
215
+ attributes = attributes.transform_keys(&:to_sym)
216
+ self.class.openapi_types.each_pair do |key, type|
217
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
218
+ self.send("#{key}=", nil)
219
+ elsif type =~ /\AArray<(.*)>/i
220
+ # check to ensure the input is an array given that the attribute
221
+ # is documented as an array but the input is not
222
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
223
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
224
+ end
225
+ elsif !attributes[self.class.attribute_map[key]].nil?
226
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
227
+ end
228
+ end
229
+
230
+ self
231
+ end
232
+
233
+ # Deserializes the data based on type
234
+ # @param string type Data type
235
+ # @param string value Value to be deserialized
236
+ # @return [Object] Deserialized data
237
+ def _deserialize(type, value)
238
+ case type.to_sym
239
+ when :Time
240
+ Time.parse(value)
241
+ when :Date
242
+ Date.parse(value)
243
+ when :String
244
+ value.to_s
245
+ when :Integer
246
+ value.to_i
247
+ when :Float
248
+ value.to_f
249
+ when :Boolean
250
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
251
+ true
252
+ else
253
+ false
254
+ end
255
+ when :Object
256
+ # generic object (usually a Hash), return directly
257
+ value
258
+ when /\AArray<(?<inner_type>.+)>\z/
259
+ inner_type = Regexp.last_match[:inner_type]
260
+ value.map { |v| _deserialize(inner_type, v) }
261
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
262
+ k_type = Regexp.last_match[:k_type]
263
+ v_type = Regexp.last_match[:v_type]
264
+ {}.tap do |hash|
265
+ value.each do |k, v|
266
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
267
+ end
268
+ end
269
+ else # model
270
+ # models (e.g. Pet) or oneOf
271
+ klass = UltracartClient.const_get(type)
272
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
273
+ end
274
+ end
275
+
276
+ # Returns the string representation of the object
277
+ # @return [String] String presentation of the object
278
+ def to_s
279
+ to_hash.to_s
280
+ end
281
+
282
+ # to_body is an alias to to_hash (backward compatibility)
283
+ # @return [Hash] Returns the object in the form of hash
284
+ def to_body
285
+ to_hash
286
+ end
287
+
288
+ # Returns the object in the form of hash
289
+ # @return [Hash] Returns the object in the form of hash
290
+ def to_hash
291
+ hash = {}
292
+ self.class.attribute_map.each_pair do |attr, param|
293
+ value = self.send(attr)
294
+ if value.nil?
295
+ is_nullable = self.class.openapi_nullable.include?(attr)
296
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
297
+ end
298
+
299
+ hash[param] = _to_hash(value)
300
+ end
301
+ hash
302
+ end
303
+
304
+ # Outputs non-array value in the form of hash
305
+ # For object, use to_hash. Otherwise, just return the value
306
+ # @param [Object] value Any valid value
307
+ # @return [Hash] Returns the value in the form of hash
308
+ def _to_hash(value)
309
+ if value.is_a?(Array)
310
+ value.compact.map { |v| _to_hash(v) }
311
+ elsif value.is_a?(Hash)
312
+ {}.tap do |hash|
313
+ value.each { |k, v| hash[k] = _to_hash(v) }
314
+ end
315
+ elsif value.respond_to? :to_hash
316
+ value.to_hash
317
+ else
318
+ value
319
+ end
320
+ end
321
+
322
+ end
323
+
324
+ end