ultracart_api 3.2.12 → 3.3.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.
data/lib/ultracart_api.rb CHANGED
@@ -235,6 +235,8 @@ require 'ultracart_api/models/email_commseq_response'
235
235
  require 'ultracart_api/models/email_commseq_stat'
236
236
  require 'ultracart_api/models/email_commseq_stat_response'
237
237
  require 'ultracart_api/models/email_commseq_step'
238
+ require 'ultracart_api/models/email_commseq_step_log'
239
+ require 'ultracart_api/models/email_commseq_step_logs_response'
238
240
  require 'ultracart_api/models/email_commseqs_response'
239
241
  require 'ultracart_api/models/email_customer'
240
242
  require 'ultracart_api/models/email_customer_editor_url_response'
@@ -543,6 +545,8 @@ require 'ultracart_api/models/screen_recording_user_property'
543
545
  require 'ultracart_api/models/screenshots_response'
544
546
  require 'ultracart_api/models/self_config'
545
547
  require 'ultracart_api/models/simple_value'
548
+ require 'ultracart_api/models/single_sign_on_authorize_request'
549
+ require 'ultracart_api/models/single_sign_on_token_request'
546
550
  require 'ultracart_api/models/sovos_config'
547
551
  require 'ultracart_api/models/state_province'
548
552
  require 'ultracart_api/models/step_waiting'
@@ -611,6 +615,7 @@ require 'ultracart_api/api/integration_log_api'
611
615
  require 'ultracart_api/api/item_api'
612
616
  require 'ultracart_api/api/oauth_api'
613
617
  require 'ultracart_api/api/order_api'
618
+ require 'ultracart_api/api/sso_api'
614
619
  require 'ultracart_api/api/storefront_api'
615
620
  require 'ultracart_api/api/tax_api'
616
621
  require 'ultracart_api/api/user_api'
@@ -318,7 +318,7 @@ module UltracartClient
318
318
  end
319
319
  return data, status_code, headers
320
320
  end
321
- # Generate a packing slip for this order for the given distribution center.
321
+ # Generate a packing slip for this order across all distribution centers.
322
322
  # The packing slip PDF that is returned is base 64 encoded
323
323
  # @param order_id Order ID
324
324
  # @param [Hash] opts the optional parameters
@@ -328,7 +328,7 @@ module UltracartClient
328
328
  data
329
329
  end
330
330
 
331
- # Generate a packing slip for this order for the given distribution center.
331
+ # Generate a packing slip for this order across all distribution centers.
332
332
  # The packing slip PDF that is returned is base 64 encoded
333
333
  # @param order_id Order ID
334
334
  # @param [Hash] opts the optional parameters
@@ -0,0 +1,243 @@
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 'uri'
14
+
15
+ module UltracartClient
16
+ class SsoApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false)
24
+ api_config = Configuration.new
25
+ api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key
26
+ api_config.api_version = '2017-03-01'
27
+ api_config.verify_ssl = verify_ssl
28
+
29
+ api_client = ApiClient.new(api_config)
30
+ api_client.config.debugging = debugging
31
+
32
+ UltracartClient::SsoApi.new(api_client)
33
+ end
34
+
35
+ # Get single sign on session user
36
+ # This is the equivalent of logging out of the single sign on session
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [User]
39
+ def get_sso_session_user(opts = {})
40
+ data, _status_code, _headers = get_sso_session_user_with_http_info(opts)
41
+ data
42
+ end
43
+
44
+ # Get single sign on session user
45
+ # This is the equivalent of logging out of the single sign on session
46
+ # @param [Hash] opts the optional parameters
47
+ # @return [Array<(User, Fixnum, Hash)>] User data, response status code and response headers
48
+ def get_sso_session_user_with_http_info(opts = {})
49
+ if @api_client.config.debugging
50
+ @api_client.config.logger.debug 'Calling API: SsoApi.get_sso_session_user ...'
51
+ end
52
+ # resource path
53
+ local_var_path = '/sso/session/user'
54
+
55
+ # query parameters
56
+ query_params = {}
57
+
58
+ # header parameters
59
+ header_params = {}
60
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
61
+ # HTTP header 'Accept' (if needed)
62
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
63
+ # HTTP header 'Content-Type'
64
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
65
+
66
+ # form parameters
67
+ form_params = {}
68
+
69
+ # http body (model)
70
+ post_body = nil
71
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
72
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
73
+ :header_params => header_params,
74
+ :query_params => query_params,
75
+ :form_params => form_params,
76
+ :body => post_body,
77
+ :auth_names => auth_names,
78
+ :return_type => 'User')
79
+ if @api_client.config.debugging
80
+ @api_client.config.logger.debug "API called: SsoApi#get_sso_session_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
81
+ end
82
+ return data, status_code, headers
83
+ end
84
+ # Authorize a single sign on session
85
+ # Starts the process of authorizing a single sign on session.
86
+ # @param authorization_request Authorization request
87
+ # @param [Hash] opts the optional parameters
88
+ # @return [ItemsResponse]
89
+ def sso_authorize(authorization_request, opts = {})
90
+ data, _status_code, _headers = sso_authorize_with_http_info(authorization_request, opts)
91
+ data
92
+ end
93
+
94
+ # Authorize a single sign on session
95
+ # Starts the process of authorizing a single sign on session.
96
+ # @param authorization_request Authorization request
97
+ # @param [Hash] opts the optional parameters
98
+ # @return [Array<(ItemsResponse, Fixnum, Hash)>] ItemsResponse data, response status code and response headers
99
+ def sso_authorize_with_http_info(authorization_request, opts = {})
100
+ if @api_client.config.debugging
101
+ @api_client.config.logger.debug 'Calling API: SsoApi.sso_authorize ...'
102
+ end
103
+ # verify the required parameter 'authorization_request' is set
104
+ if @api_client.config.client_side_validation && authorization_request.nil?
105
+ fail ArgumentError, "Missing the required parameter 'authorization_request' when calling SsoApi.sso_authorize"
106
+ end
107
+ # resource path
108
+ local_var_path = '/sso/authorize'
109
+
110
+ # query parameters
111
+ query_params = {}
112
+
113
+ # header parameters
114
+ header_params = {}
115
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
116
+ # HTTP header 'Accept' (if needed)
117
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
118
+ # HTTP header 'Content-Type'
119
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
120
+
121
+ # form parameters
122
+ form_params = {}
123
+
124
+ # http body (model)
125
+ post_body = @api_client.object_to_http_body(authorization_request)
126
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
127
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
128
+ :header_params => header_params,
129
+ :query_params => query_params,
130
+ :form_params => form_params,
131
+ :body => post_body,
132
+ :auth_names => auth_names,
133
+ :return_type => 'ItemsResponse')
134
+ if @api_client.config.debugging
135
+ @api_client.config.logger.debug "API called: SsoApi#sso_authorize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
136
+ end
137
+ return data, status_code, headers
138
+ end
139
+ # Revoke single sign on session
140
+ # This is the equivalent of logging out of the single sign on session
141
+ # @param [Hash] opts the optional parameters
142
+ # @return [nil]
143
+ def sso_session_revoke(opts = {})
144
+ sso_session_revoke_with_http_info(opts)
145
+ nil
146
+ end
147
+
148
+ # Revoke single sign on session
149
+ # This is the equivalent of logging out of the single sign on session
150
+ # @param [Hash] opts the optional parameters
151
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
152
+ def sso_session_revoke_with_http_info(opts = {})
153
+ if @api_client.config.debugging
154
+ @api_client.config.logger.debug 'Calling API: SsoApi.sso_session_revoke ...'
155
+ end
156
+ # resource path
157
+ local_var_path = '/sso/session/revoke'
158
+
159
+ # query parameters
160
+ query_params = {}
161
+
162
+ # header parameters
163
+ header_params = {}
164
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
165
+ # HTTP header 'Accept' (if needed)
166
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
167
+ # HTTP header 'Content-Type'
168
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
169
+
170
+ # form parameters
171
+ form_params = {}
172
+
173
+ # http body (model)
174
+ post_body = nil
175
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
176
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
177
+ :header_params => header_params,
178
+ :query_params => query_params,
179
+ :form_params => form_params,
180
+ :body => post_body,
181
+ :auth_names => auth_names)
182
+ if @api_client.config.debugging
183
+ @api_client.config.logger.debug "API called: SsoApi#sso_session_revoke\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
184
+ end
185
+ return data, status_code, headers
186
+ end
187
+ # Exchange a single sign on code for a simple key token
188
+ # Called by your application after receiving the code back on the redirect URI to obtain a simple key token to make API calls with
189
+ # @param token_request Token request
190
+ # @param [Hash] opts the optional parameters
191
+ # @return [ItemsResponse]
192
+ def sso_token(token_request, opts = {})
193
+ data, _status_code, _headers = sso_token_with_http_info(token_request, opts)
194
+ data
195
+ end
196
+
197
+ # Exchange a single sign on code for a simple key token
198
+ # Called by your application after receiving the code back on the redirect URI to obtain a simple key token to make API calls with
199
+ # @param token_request Token request
200
+ # @param [Hash] opts the optional parameters
201
+ # @return [Array<(ItemsResponse, Fixnum, Hash)>] ItemsResponse data, response status code and response headers
202
+ def sso_token_with_http_info(token_request, opts = {})
203
+ if @api_client.config.debugging
204
+ @api_client.config.logger.debug 'Calling API: SsoApi.sso_token ...'
205
+ end
206
+ # verify the required parameter 'token_request' is set
207
+ if @api_client.config.client_side_validation && token_request.nil?
208
+ fail ArgumentError, "Missing the required parameter 'token_request' when calling SsoApi.sso_token"
209
+ end
210
+ # resource path
211
+ local_var_path = '/sso/token'
212
+
213
+ # query parameters
214
+ query_params = {}
215
+
216
+ # header parameters
217
+ header_params = {}
218
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
219
+ # HTTP header 'Accept' (if needed)
220
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
221
+ # HTTP header 'Content-Type'
222
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
223
+
224
+ # form parameters
225
+ form_params = {}
226
+
227
+ # http body (model)
228
+ post_body = @api_client.object_to_http_body(token_request)
229
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
230
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
231
+ :header_params => header_params,
232
+ :query_params => query_params,
233
+ :form_params => form_params,
234
+ :body => post_body,
235
+ :auth_names => auth_names,
236
+ :return_type => 'ItemsResponse')
237
+ if @api_client.config.debugging
238
+ @api_client.config.logger.debug "API called: SsoApi#sso_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
239
+ end
240
+ return data, status_code, headers
241
+ end
242
+ end
243
+ end
@@ -2596,6 +2596,71 @@ module UltracartClient
2596
2596
  end
2597
2597
  return data, status_code, headers
2598
2598
  end
2599
+ # Get email dispatch logs
2600
+ # @param storefront_oid
2601
+ # @param commseq_uuid
2602
+ # @param commseq_step_uuid
2603
+ # @param [Hash] opts the optional parameters
2604
+ # @return [EmailCommseqStepLogsResponse]
2605
+ def get_email_dispatch_logs(storefront_oid, commseq_uuid, commseq_step_uuid, opts = {})
2606
+ data, _status_code, _headers = get_email_dispatch_logs_with_http_info(storefront_oid, commseq_uuid, commseq_step_uuid, opts)
2607
+ data
2608
+ end
2609
+
2610
+ # Get email dispatch logs
2611
+ # @param storefront_oid
2612
+ # @param commseq_uuid
2613
+ # @param commseq_step_uuid
2614
+ # @param [Hash] opts the optional parameters
2615
+ # @return [Array<(EmailCommseqStepLogsResponse, Fixnum, Hash)>] EmailCommseqStepLogsResponse data, response status code and response headers
2616
+ def get_email_dispatch_logs_with_http_info(storefront_oid, commseq_uuid, commseq_step_uuid, opts = {})
2617
+ if @api_client.config.debugging
2618
+ @api_client.config.logger.debug 'Calling API: StorefrontApi.get_email_dispatch_logs ...'
2619
+ end
2620
+ # verify the required parameter 'storefront_oid' is set
2621
+ if @api_client.config.client_side_validation && storefront_oid.nil?
2622
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling StorefrontApi.get_email_dispatch_logs"
2623
+ end
2624
+ # verify the required parameter 'commseq_uuid' is set
2625
+ if @api_client.config.client_side_validation && commseq_uuid.nil?
2626
+ fail ArgumentError, "Missing the required parameter 'commseq_uuid' when calling StorefrontApi.get_email_dispatch_logs"
2627
+ end
2628
+ # verify the required parameter 'commseq_step_uuid' is set
2629
+ if @api_client.config.client_side_validation && commseq_step_uuid.nil?
2630
+ fail ArgumentError, "Missing the required parameter 'commseq_step_uuid' when calling StorefrontApi.get_email_dispatch_logs"
2631
+ end
2632
+ # resource path
2633
+ local_var_path = '/storefront/{storefront_oid}/email/commseqs/{commseq_uuid}/steps/{commseq_step_uuid}/logs'.sub('{' + 'storefront_oid' + '}', storefront_oid.to_s).sub('{' + 'commseq_uuid' + '}', commseq_uuid.to_s).sub('{' + 'commseq_step_uuid' + '}', commseq_step_uuid.to_s)
2634
+
2635
+ # query parameters
2636
+ query_params = {}
2637
+
2638
+ # header parameters
2639
+ header_params = {}
2640
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
2641
+ # HTTP header 'Accept' (if needed)
2642
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2643
+ # HTTP header 'Content-Type'
2644
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
2645
+
2646
+ # form parameters
2647
+ form_params = {}
2648
+
2649
+ # http body (model)
2650
+ post_body = nil
2651
+ auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
2652
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
2653
+ :header_params => header_params,
2654
+ :query_params => query_params,
2655
+ :form_params => form_params,
2656
+ :body => post_body,
2657
+ :auth_names => auth_names,
2658
+ :return_type => 'EmailCommseqStepLogsResponse')
2659
+ if @api_client.config.debugging
2660
+ @api_client.config.logger.debug "API called: StorefrontApi#get_email_dispatch_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2661
+ end
2662
+ return data, status_code, headers
2663
+ end
2599
2664
  # Get email email
2600
2665
  # @param storefront_oid
2601
2666
  # @param commseq_email_uuid
@@ -82,6 +82,9 @@ module UltracartClient
82
82
 
83
83
  attr_accessor :free_shipping_with_subtotal
84
84
 
85
+ # Hide coupon from customer during checkout. Often used when coupons are automatic discounting mechanisms.
86
+ attr_accessor :hide_from_customer
87
+
85
88
  # Merchant code of coupon up to 20 characters.
86
89
  attr_accessor :merchant_code
87
90
 
@@ -180,6 +183,7 @@ module UltracartClient
180
183
  :'free_shipping_specific_items' => :'free_shipping_specific_items',
181
184
  :'free_shipping_with_items_purchase' => :'free_shipping_with_items_purchase',
182
185
  :'free_shipping_with_subtotal' => :'free_shipping_with_subtotal',
186
+ :'hide_from_customer' => :'hide_from_customer',
183
187
  :'merchant_code' => :'merchant_code',
184
188
  :'merchant_notes' => :'merchant_notes',
185
189
  :'multiple_amounts_off_items' => :'multiple_amounts_off_items',
@@ -244,6 +248,7 @@ module UltracartClient
244
248
  :'free_shipping_specific_items' => :'CouponFreeShippingSpecificItems',
245
249
  :'free_shipping_with_items_purchase' => :'CouponFreeShippingWithItemsPurchase',
246
250
  :'free_shipping_with_subtotal' => :'CouponFreeShippingWithSubtotal',
251
+ :'hide_from_customer' => :'BOOLEAN',
247
252
  :'merchant_code' => :'String',
248
253
  :'merchant_notes' => :'String',
249
254
  :'multiple_amounts_off_items' => :'CouponMultipleAmountsOffItems',
@@ -403,6 +408,10 @@ module UltracartClient
403
408
  self.free_shipping_with_subtotal = attributes[:'free_shipping_with_subtotal']
404
409
  end
405
410
 
411
+ if attributes.has_key?(:'hide_from_customer')
412
+ self.hide_from_customer = attributes[:'hide_from_customer']
413
+ end
414
+
406
415
  if attributes.has_key?(:'merchant_code')
407
416
  self.merchant_code = attributes[:'merchant_code']
408
417
  end
@@ -660,6 +669,7 @@ module UltracartClient
660
669
  free_shipping_specific_items == o.free_shipping_specific_items &&
661
670
  free_shipping_with_items_purchase == o.free_shipping_with_items_purchase &&
662
671
  free_shipping_with_subtotal == o.free_shipping_with_subtotal &&
672
+ hide_from_customer == o.hide_from_customer &&
663
673
  merchant_code == o.merchant_code &&
664
674
  merchant_notes == o.merchant_notes &&
665
675
  multiple_amounts_off_items == o.multiple_amounts_off_items &&
@@ -699,7 +709,7 @@ module UltracartClient
699
709
  # Calculates hash code according to all attributes.
700
710
  # @return [Fixnum] Hash code
701
711
  def hash
702
- [affiliate_oid, allow_multiple_one_time_codes, amount_off_items, amount_off_shipping, amount_off_shipping_with_items_purchase, amount_off_subtotal, amount_off_subtotal_and_free_shipping, amount_off_subtotal_and_shipping, amount_off_subtotal_with_block_purchase, amount_off_subtotal_with_items_purchase, amount_off_subtotal_with_purchase, automatically_apply_coupon_codes, buy_one_get_one, calculated_description, can_be_used_with_other_coupons, coupon_oid, coupon_type, description, discount_item_with_item_purchase, discount_items, expiration_dts, free_item_and_shipping_with_subtotal, free_item_with_item_purchase, free_item_with_subtotal, free_items_with_item_purchase, free_items_with_mixmatch_purchase, free_shipping, free_shipping_specific_items, free_shipping_with_items_purchase, free_shipping_with_subtotal, merchant_code, merchant_notes, multiple_amounts_off_items, no_discount, percent_off_item_with_items_quantity_purchase, percent_off_items, percent_off_items_and_free_shipping, percent_off_items_with_items_purchase, percent_off_msrp_items, percent_off_retail_price_items, percent_off_shipping, percent_off_subtotal, percent_off_subtotal_and_free_shipping, percent_off_subtotal_limit, percent_off_subtotal_with_items_purchase, percent_off_subtotal_with_subtotal, quickbooks_code, restrict_by_postal_codes, restrict_by_screen_branding_theme_codes, restrict_by_storefronts, start_dts, super_coupon, tiered_amount_off_item, tiered_amount_off_subtotal, tiered_percent_off_items, tiered_percent_off_shipping, tiered_percent_off_subtotal, usable_by].hash
712
+ [affiliate_oid, allow_multiple_one_time_codes, amount_off_items, amount_off_shipping, amount_off_shipping_with_items_purchase, amount_off_subtotal, amount_off_subtotal_and_free_shipping, amount_off_subtotal_and_shipping, amount_off_subtotal_with_block_purchase, amount_off_subtotal_with_items_purchase, amount_off_subtotal_with_purchase, automatically_apply_coupon_codes, buy_one_get_one, calculated_description, can_be_used_with_other_coupons, coupon_oid, coupon_type, description, discount_item_with_item_purchase, discount_items, expiration_dts, free_item_and_shipping_with_subtotal, free_item_with_item_purchase, free_item_with_subtotal, free_items_with_item_purchase, free_items_with_mixmatch_purchase, free_shipping, free_shipping_specific_items, free_shipping_with_items_purchase, free_shipping_with_subtotal, hide_from_customer, merchant_code, merchant_notes, multiple_amounts_off_items, no_discount, percent_off_item_with_items_quantity_purchase, percent_off_items, percent_off_items_and_free_shipping, percent_off_items_with_items_purchase, percent_off_msrp_items, percent_off_retail_price_items, percent_off_shipping, percent_off_subtotal, percent_off_subtotal_and_free_shipping, percent_off_subtotal_limit, percent_off_subtotal_with_items_purchase, percent_off_subtotal_with_subtotal, quickbooks_code, restrict_by_postal_codes, restrict_by_screen_branding_theme_codes, restrict_by_storefronts, start_dts, super_coupon, tiered_amount_off_item, tiered_amount_off_subtotal, tiered_percent_off_items, tiered_percent_off_shipping, tiered_percent_off_subtotal, usable_by].hash
703
713
  end
704
714
 
705
715
  # Builds the object from hash
@@ -0,0 +1,205 @@
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 EmailCommseqStepLog
17
+ # Email
18
+ attr_accessor :email
19
+
20
+ # Log text
21
+ attr_accessor :log
22
+
23
+ # Log date/time
24
+ attr_accessor :log_dts
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'email' => :'email',
30
+ :'log' => :'log',
31
+ :'log_dts' => :'log_dts'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.swagger_types
37
+ {
38
+ :'email' => :'String',
39
+ :'log' => :'String',
40
+ :'log_dts' => :'String'
41
+ }
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ return unless attributes.is_a?(Hash)
48
+
49
+ # convert string to symbol for hash key
50
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
51
+
52
+ if attributes.has_key?(:'email')
53
+ self.email = attributes[:'email']
54
+ end
55
+
56
+ if attributes.has_key?(:'log')
57
+ self.log = attributes[:'log']
58
+ end
59
+
60
+ if attributes.has_key?(:'log_dts')
61
+ self.log_dts = attributes[:'log_dts']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ email == o.email &&
84
+ log == o.log &&
85
+ log_dts == o.log_dts
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Fixnum] Hash code
96
+ def hash
97
+ [email, log, log_dts].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ self.class.swagger_types.each_pair do |key, type|
106
+ if type =~ /\AArray<(.*)>/i
107
+ # check to ensure the input is an array given that the attribute
108
+ # is documented as an array but the input is not
109
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
110
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
111
+ end
112
+ elsif !attributes[self.class.attribute_map[key]].nil?
113
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
115
+ end
116
+
117
+ self
118
+ end
119
+
120
+ # Deserializes the data based on type
121
+ # @param string type Data type
122
+ # @param string value Value to be deserialized
123
+ # @return [Object] Deserialized data
124
+ def _deserialize(type, value)
125
+ case type.to_sym
126
+ when :DateTime
127
+ DateTime.parse(value)
128
+ when :Date
129
+ Date.parse(value)
130
+ when :String
131
+ value.to_s
132
+ when :Integer
133
+ value.to_i
134
+ when :Float
135
+ value.to_f
136
+ when :BOOLEAN
137
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
+ true
139
+ else
140
+ false
141
+ end
142
+ when :Object
143
+ # generic object (usually a Hash), return directly
144
+ value
145
+ when /\AArray<(?<inner_type>.+)>\z/
146
+ inner_type = Regexp.last_match[:inner_type]
147
+ value.map { |v| _deserialize(inner_type, v) }
148
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
+ k_type = Regexp.last_match[:k_type]
150
+ v_type = Regexp.last_match[:v_type]
151
+ {}.tap do |hash|
152
+ value.each do |k, v|
153
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
+ end
155
+ end
156
+ else # model
157
+ temp_model = UltracartClient.const_get(type).new
158
+ temp_model.build_from_hash(value)
159
+ end
160
+ end
161
+
162
+ # Returns the string representation of the object
163
+ # @return [String] String presentation of the object
164
+ def to_s
165
+ to_hash.to_s
166
+ end
167
+
168
+ # to_body is an alias to to_hash (backward compatibility)
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_body
171
+ to_hash
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ next if value.nil?
181
+ hash[param] = _to_hash(value)
182
+ end
183
+ hash
184
+ end
185
+
186
+ # Outputs non-array value in the form of hash
187
+ # For object, use to_hash. Otherwise, just return the value
188
+ # @param [Object] value Any valid value
189
+ # @return [Hash] Returns the value in the form of hash
190
+ def _to_hash(value)
191
+ if value.is_a?(Array)
192
+ value.compact.map { |v| _to_hash(v) }
193
+ elsif value.is_a?(Hash)
194
+ {}.tap do |hash|
195
+ value.each { |k, v| hash[k] = _to_hash(v) }
196
+ end
197
+ elsif value.respond_to? :to_hash
198
+ value.to_hash
199
+ else
200
+ value
201
+ end
202
+ end
203
+
204
+ end
205
+ end