ultracart_api 3.6.21 → 3.6.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -4
- data/docs/StorefrontApi.md +243 -0
- data/docs/Twilio.md +11 -0
- data/docs/TwilioResponse.md +13 -0
- data/docs/TwiliosResponse.md +12 -0
- data/lib/ultracart_api/api/storefront_api.rb +265 -0
- data/lib/ultracart_api/models/twilio.rb +213 -0
- data/lib/ultracart_api/models/twilio_response.rb +230 -0
- data/lib/ultracart_api/models/twilios_response.rb +223 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +3 -0
- metadata +8 -2
@@ -563,6 +563,59 @@ module UltracartClient
|
|
563
563
|
end
|
564
564
|
return data, status_code, headers
|
565
565
|
end
|
566
|
+
# Create Twilio account
|
567
|
+
# @param twilio Twilio
|
568
|
+
# @param [Hash] opts the optional parameters
|
569
|
+
# @return [TwilioResponse]
|
570
|
+
def create_twilio_account(twilio, opts = {})
|
571
|
+
data, _status_code, _headers = create_twilio_account_with_http_info(twilio, opts)
|
572
|
+
data
|
573
|
+
end
|
574
|
+
|
575
|
+
# Create Twilio account
|
576
|
+
# @param twilio Twilio
|
577
|
+
# @param [Hash] opts the optional parameters
|
578
|
+
# @return [Array<(TwilioResponse, Fixnum, Hash)>] TwilioResponse data, response status code and response headers
|
579
|
+
def create_twilio_account_with_http_info(twilio, opts = {})
|
580
|
+
if @api_client.config.debugging
|
581
|
+
@api_client.config.logger.debug 'Calling API: StorefrontApi.create_twilio_account ...'
|
582
|
+
end
|
583
|
+
# verify the required parameter 'twilio' is set
|
584
|
+
if @api_client.config.client_side_validation && twilio.nil?
|
585
|
+
fail ArgumentError, "Missing the required parameter 'twilio' when calling StorefrontApi.create_twilio_account"
|
586
|
+
end
|
587
|
+
# resource path
|
588
|
+
local_var_path = '/storefront/twilio/accounts'
|
589
|
+
|
590
|
+
# query parameters
|
591
|
+
query_params = {}
|
592
|
+
|
593
|
+
# header parameters
|
594
|
+
header_params = {}
|
595
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
596
|
+
# HTTP header 'Accept' (if needed)
|
597
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
598
|
+
# HTTP header 'Content-Type'
|
599
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
600
|
+
|
601
|
+
# form parameters
|
602
|
+
form_params = {}
|
603
|
+
|
604
|
+
# http body (model)
|
605
|
+
post_body = @api_client.object_to_http_body(twilio)
|
606
|
+
auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
|
607
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
608
|
+
:header_params => header_params,
|
609
|
+
:query_params => query_params,
|
610
|
+
:form_params => form_params,
|
611
|
+
:body => post_body,
|
612
|
+
:auth_names => auth_names,
|
613
|
+
:return_type => 'TwilioResponse')
|
614
|
+
if @api_client.config.debugging
|
615
|
+
@api_client.config.logger.debug "API called: StorefrontApi#create_twilio_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
616
|
+
end
|
617
|
+
return data, status_code, headers
|
618
|
+
end
|
566
619
|
# Delete email campaignFolder
|
567
620
|
# @param storefront_oid
|
568
621
|
# @param email_campaign_folder_uuid
|
@@ -1314,6 +1367,59 @@ module UltracartClient
|
|
1314
1367
|
end
|
1315
1368
|
return data, status_code, headers
|
1316
1369
|
end
|
1370
|
+
# delete Twilio account
|
1371
|
+
# @param esp_twilio_uuid
|
1372
|
+
# @param [Hash] opts the optional parameters
|
1373
|
+
# @return [BaseResponse]
|
1374
|
+
def delete_twilio_account(esp_twilio_uuid, opts = {})
|
1375
|
+
data, _status_code, _headers = delete_twilio_account_with_http_info(esp_twilio_uuid, opts)
|
1376
|
+
data
|
1377
|
+
end
|
1378
|
+
|
1379
|
+
# delete Twilio account
|
1380
|
+
# @param esp_twilio_uuid
|
1381
|
+
# @param [Hash] opts the optional parameters
|
1382
|
+
# @return [Array<(BaseResponse, Fixnum, Hash)>] BaseResponse data, response status code and response headers
|
1383
|
+
def delete_twilio_account_with_http_info(esp_twilio_uuid, opts = {})
|
1384
|
+
if @api_client.config.debugging
|
1385
|
+
@api_client.config.logger.debug 'Calling API: StorefrontApi.delete_twilio_account ...'
|
1386
|
+
end
|
1387
|
+
# verify the required parameter 'esp_twilio_uuid' is set
|
1388
|
+
if @api_client.config.client_side_validation && esp_twilio_uuid.nil?
|
1389
|
+
fail ArgumentError, "Missing the required parameter 'esp_twilio_uuid' when calling StorefrontApi.delete_twilio_account"
|
1390
|
+
end
|
1391
|
+
# resource path
|
1392
|
+
local_var_path = '/storefront/twilio/accounts/{esp_twilio_uuid}'.sub('{' + 'esp_twilio_uuid' + '}', esp_twilio_uuid.to_s)
|
1393
|
+
|
1394
|
+
# query parameters
|
1395
|
+
query_params = {}
|
1396
|
+
|
1397
|
+
# header parameters
|
1398
|
+
header_params = {}
|
1399
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
1400
|
+
# HTTP header 'Accept' (if needed)
|
1401
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
1402
|
+
# HTTP header 'Content-Type'
|
1403
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
1404
|
+
|
1405
|
+
# form parameters
|
1406
|
+
form_params = {}
|
1407
|
+
|
1408
|
+
# http body (model)
|
1409
|
+
post_body = nil
|
1410
|
+
auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
|
1411
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
1412
|
+
:header_params => header_params,
|
1413
|
+
:query_params => query_params,
|
1414
|
+
:form_params => form_params,
|
1415
|
+
:body => post_body,
|
1416
|
+
:auth_names => auth_names,
|
1417
|
+
:return_type => 'BaseResponse')
|
1418
|
+
if @api_client.config.debugging
|
1419
|
+
@api_client.config.logger.debug "API called: StorefrontApi#delete_twilio_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
1420
|
+
end
|
1421
|
+
return data, status_code, headers
|
1422
|
+
end
|
1317
1423
|
# Duplicate library item.
|
1318
1424
|
# @param library_item_oid
|
1319
1425
|
# @param [Hash] opts the optional parameters
|
@@ -5967,6 +6073,106 @@ module UltracartClient
|
|
5967
6073
|
end
|
5968
6074
|
return data, status_code, headers
|
5969
6075
|
end
|
6076
|
+
# Get Twilio account
|
6077
|
+
# @param esp_twilio_uuid
|
6078
|
+
# @param [Hash] opts the optional parameters
|
6079
|
+
# @return [TwilioResponse]
|
6080
|
+
def get_twilio_account(esp_twilio_uuid, opts = {})
|
6081
|
+
data, _status_code, _headers = get_twilio_account_with_http_info(esp_twilio_uuid, opts)
|
6082
|
+
data
|
6083
|
+
end
|
6084
|
+
|
6085
|
+
# Get Twilio account
|
6086
|
+
# @param esp_twilio_uuid
|
6087
|
+
# @param [Hash] opts the optional parameters
|
6088
|
+
# @return [Array<(TwilioResponse, Fixnum, Hash)>] TwilioResponse data, response status code and response headers
|
6089
|
+
def get_twilio_account_with_http_info(esp_twilio_uuid, opts = {})
|
6090
|
+
if @api_client.config.debugging
|
6091
|
+
@api_client.config.logger.debug 'Calling API: StorefrontApi.get_twilio_account ...'
|
6092
|
+
end
|
6093
|
+
# verify the required parameter 'esp_twilio_uuid' is set
|
6094
|
+
if @api_client.config.client_side_validation && esp_twilio_uuid.nil?
|
6095
|
+
fail ArgumentError, "Missing the required parameter 'esp_twilio_uuid' when calling StorefrontApi.get_twilio_account"
|
6096
|
+
end
|
6097
|
+
# resource path
|
6098
|
+
local_var_path = '/storefront/twilio/accounts/{esp_twilio_uuid}'.sub('{' + 'esp_twilio_uuid' + '}', esp_twilio_uuid.to_s)
|
6099
|
+
|
6100
|
+
# query parameters
|
6101
|
+
query_params = {}
|
6102
|
+
|
6103
|
+
# header parameters
|
6104
|
+
header_params = {}
|
6105
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
6106
|
+
# HTTP header 'Accept' (if needed)
|
6107
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
6108
|
+
# HTTP header 'Content-Type'
|
6109
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
6110
|
+
|
6111
|
+
# form parameters
|
6112
|
+
form_params = {}
|
6113
|
+
|
6114
|
+
# http body (model)
|
6115
|
+
post_body = nil
|
6116
|
+
auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
|
6117
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
6118
|
+
:header_params => header_params,
|
6119
|
+
:query_params => query_params,
|
6120
|
+
:form_params => form_params,
|
6121
|
+
:body => post_body,
|
6122
|
+
:auth_names => auth_names,
|
6123
|
+
:return_type => 'TwilioResponse')
|
6124
|
+
if @api_client.config.debugging
|
6125
|
+
@api_client.config.logger.debug "API called: StorefrontApi#get_twilio_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
6126
|
+
end
|
6127
|
+
return data, status_code, headers
|
6128
|
+
end
|
6129
|
+
# Get all Twilio accounts
|
6130
|
+
# @param [Hash] opts the optional parameters
|
6131
|
+
# @return [TwiliosResponse]
|
6132
|
+
def get_twilio_accounts(opts = {})
|
6133
|
+
data, _status_code, _headers = get_twilio_accounts_with_http_info(opts)
|
6134
|
+
data
|
6135
|
+
end
|
6136
|
+
|
6137
|
+
# Get all Twilio accounts
|
6138
|
+
# @param [Hash] opts the optional parameters
|
6139
|
+
# @return [Array<(TwiliosResponse, Fixnum, Hash)>] TwiliosResponse data, response status code and response headers
|
6140
|
+
def get_twilio_accounts_with_http_info(opts = {})
|
6141
|
+
if @api_client.config.debugging
|
6142
|
+
@api_client.config.logger.debug 'Calling API: StorefrontApi.get_twilio_accounts ...'
|
6143
|
+
end
|
6144
|
+
# resource path
|
6145
|
+
local_var_path = '/storefront/twilio/accounts'
|
6146
|
+
|
6147
|
+
# query parameters
|
6148
|
+
query_params = {}
|
6149
|
+
|
6150
|
+
# header parameters
|
6151
|
+
header_params = {}
|
6152
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
6153
|
+
# HTTP header 'Accept' (if needed)
|
6154
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
6155
|
+
# HTTP header 'Content-Type'
|
6156
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
6157
|
+
|
6158
|
+
# form parameters
|
6159
|
+
form_params = {}
|
6160
|
+
|
6161
|
+
# http body (model)
|
6162
|
+
post_body = nil
|
6163
|
+
auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
|
6164
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
6165
|
+
:header_params => header_params,
|
6166
|
+
:query_params => query_params,
|
6167
|
+
:form_params => form_params,
|
6168
|
+
:body => post_body,
|
6169
|
+
:auth_names => auth_names,
|
6170
|
+
:return_type => 'TwiliosResponse')
|
6171
|
+
if @api_client.config.debugging
|
6172
|
+
@api_client.config.logger.debug "API called: StorefrontApi#get_twilio_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
6173
|
+
end
|
6174
|
+
return data, status_code, headers
|
6175
|
+
end
|
5970
6176
|
# Globally unsubscribe a customer
|
5971
6177
|
# @param storefront_oid
|
5972
6178
|
# @param unsubscribe Unsubscribe
|
@@ -9236,5 +9442,64 @@ module UltracartClient
|
|
9236
9442
|
end
|
9237
9443
|
return data, status_code, headers
|
9238
9444
|
end
|
9445
|
+
# Update Twilio account
|
9446
|
+
# @param esp_twilio_uuid
|
9447
|
+
# @param twilio Twilio
|
9448
|
+
# @param [Hash] opts the optional parameters
|
9449
|
+
# @return [TwilioResponse]
|
9450
|
+
def update_twilio_account(esp_twilio_uuid, twilio, opts = {})
|
9451
|
+
data, _status_code, _headers = update_twilio_account_with_http_info(esp_twilio_uuid, twilio, opts)
|
9452
|
+
data
|
9453
|
+
end
|
9454
|
+
|
9455
|
+
# Update Twilio account
|
9456
|
+
# @param esp_twilio_uuid
|
9457
|
+
# @param twilio Twilio
|
9458
|
+
# @param [Hash] opts the optional parameters
|
9459
|
+
# @return [Array<(TwilioResponse, Fixnum, Hash)>] TwilioResponse data, response status code and response headers
|
9460
|
+
def update_twilio_account_with_http_info(esp_twilio_uuid, twilio, opts = {})
|
9461
|
+
if @api_client.config.debugging
|
9462
|
+
@api_client.config.logger.debug 'Calling API: StorefrontApi.update_twilio_account ...'
|
9463
|
+
end
|
9464
|
+
# verify the required parameter 'esp_twilio_uuid' is set
|
9465
|
+
if @api_client.config.client_side_validation && esp_twilio_uuid.nil?
|
9466
|
+
fail ArgumentError, "Missing the required parameter 'esp_twilio_uuid' when calling StorefrontApi.update_twilio_account"
|
9467
|
+
end
|
9468
|
+
# verify the required parameter 'twilio' is set
|
9469
|
+
if @api_client.config.client_side_validation && twilio.nil?
|
9470
|
+
fail ArgumentError, "Missing the required parameter 'twilio' when calling StorefrontApi.update_twilio_account"
|
9471
|
+
end
|
9472
|
+
# resource path
|
9473
|
+
local_var_path = '/storefront/twilio/accounts/{esp_twilio_uuid}'.sub('{' + 'esp_twilio_uuid' + '}', esp_twilio_uuid.to_s)
|
9474
|
+
|
9475
|
+
# query parameters
|
9476
|
+
query_params = {}
|
9477
|
+
|
9478
|
+
# header parameters
|
9479
|
+
header_params = {}
|
9480
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
9481
|
+
# HTTP header 'Accept' (if needed)
|
9482
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
9483
|
+
# HTTP header 'Content-Type'
|
9484
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
9485
|
+
|
9486
|
+
# form parameters
|
9487
|
+
form_params = {}
|
9488
|
+
|
9489
|
+
# http body (model)
|
9490
|
+
post_body = @api_client.object_to_http_body(twilio)
|
9491
|
+
auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
|
9492
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
9493
|
+
:header_params => header_params,
|
9494
|
+
:query_params => query_params,
|
9495
|
+
:form_params => form_params,
|
9496
|
+
:body => post_body,
|
9497
|
+
:auth_names => auth_names,
|
9498
|
+
:return_type => 'TwilioResponse')
|
9499
|
+
if @api_client.config.debugging
|
9500
|
+
@api_client.config.logger.debug "API called: StorefrontApi#update_twilio_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
9501
|
+
end
|
9502
|
+
return data, status_code, headers
|
9503
|
+
end
|
9239
9504
|
end
|
9240
9505
|
end
|
@@ -0,0 +1,213 @@
|
|
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 Twilio
|
17
|
+
attr_accessor :account_sid
|
18
|
+
|
19
|
+
attr_accessor :auth_token
|
20
|
+
|
21
|
+
attr_accessor :esp_twilio_uuid
|
22
|
+
|
23
|
+
attr_accessor :phone_numbers
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'account_sid' => :'account_sid',
|
29
|
+
:'auth_token' => :'auth_token',
|
30
|
+
:'esp_twilio_uuid' => :'esp_twilio_uuid',
|
31
|
+
:'phone_numbers' => :'phone_numbers'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.swagger_types
|
37
|
+
{
|
38
|
+
:'account_sid' => :'String',
|
39
|
+
:'auth_token' => :'String',
|
40
|
+
:'esp_twilio_uuid' => :'String',
|
41
|
+
:'phone_numbers' => :'Array<String>'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
return unless attributes.is_a?(Hash)
|
49
|
+
|
50
|
+
# convert string to symbol for hash key
|
51
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
52
|
+
|
53
|
+
if attributes.has_key?(:'account_sid')
|
54
|
+
self.account_sid = attributes[:'account_sid']
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes.has_key?(:'auth_token')
|
58
|
+
self.auth_token = attributes[:'auth_token']
|
59
|
+
end
|
60
|
+
|
61
|
+
if attributes.has_key?(:'esp_twilio_uuid')
|
62
|
+
self.esp_twilio_uuid = attributes[:'esp_twilio_uuid']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.has_key?(:'phone_numbers')
|
66
|
+
if (value = attributes[:'phone_numbers']).is_a?(Array)
|
67
|
+
self.phone_numbers = value
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
73
|
+
# @return Array for valid properties with the reasons
|
74
|
+
def list_invalid_properties
|
75
|
+
invalid_properties = Array.new
|
76
|
+
invalid_properties
|
77
|
+
end
|
78
|
+
|
79
|
+
# Check to see if the all the properties in the model are valid
|
80
|
+
# @return true if the model is valid
|
81
|
+
def valid?
|
82
|
+
true
|
83
|
+
end
|
84
|
+
|
85
|
+
# Checks equality by comparing each attribute.
|
86
|
+
# @param [Object] Object to be compared
|
87
|
+
def ==(o)
|
88
|
+
return true if self.equal?(o)
|
89
|
+
self.class == o.class &&
|
90
|
+
account_sid == o.account_sid &&
|
91
|
+
auth_token == o.auth_token &&
|
92
|
+
esp_twilio_uuid == o.esp_twilio_uuid &&
|
93
|
+
phone_numbers == o.phone_numbers
|
94
|
+
end
|
95
|
+
|
96
|
+
# @see the `==` method
|
97
|
+
# @param [Object] Object to be compared
|
98
|
+
def eql?(o)
|
99
|
+
self == o
|
100
|
+
end
|
101
|
+
|
102
|
+
# Calculates hash code according to all attributes.
|
103
|
+
# @return [Fixnum] Hash code
|
104
|
+
def hash
|
105
|
+
[account_sid, auth_token, esp_twilio_uuid, phone_numbers].hash
|
106
|
+
end
|
107
|
+
|
108
|
+
# Builds the object from hash
|
109
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
110
|
+
# @return [Object] Returns the model itself
|
111
|
+
def build_from_hash(attributes)
|
112
|
+
return nil unless attributes.is_a?(Hash)
|
113
|
+
self.class.swagger_types.each_pair do |key, type|
|
114
|
+
if type =~ /\AArray<(.*)>/i
|
115
|
+
# check to ensure the input is an array given that the attribute
|
116
|
+
# is documented as an array but the input is not
|
117
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
118
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
119
|
+
end
|
120
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
121
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
122
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
123
|
+
end
|
124
|
+
|
125
|
+
self
|
126
|
+
end
|
127
|
+
|
128
|
+
# Deserializes the data based on type
|
129
|
+
# @param string type Data type
|
130
|
+
# @param string value Value to be deserialized
|
131
|
+
# @return [Object] Deserialized data
|
132
|
+
def _deserialize(type, value)
|
133
|
+
case type.to_sym
|
134
|
+
when :DateTime
|
135
|
+
DateTime.parse(value)
|
136
|
+
when :Date
|
137
|
+
Date.parse(value)
|
138
|
+
when :String
|
139
|
+
value.to_s
|
140
|
+
when :Integer
|
141
|
+
value.to_i
|
142
|
+
when :Float
|
143
|
+
value.to_f
|
144
|
+
when :BOOLEAN
|
145
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
146
|
+
true
|
147
|
+
else
|
148
|
+
false
|
149
|
+
end
|
150
|
+
when :Object
|
151
|
+
# generic object (usually a Hash), return directly
|
152
|
+
value
|
153
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
154
|
+
inner_type = Regexp.last_match[:inner_type]
|
155
|
+
value.map { |v| _deserialize(inner_type, v) }
|
156
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
157
|
+
k_type = Regexp.last_match[:k_type]
|
158
|
+
v_type = Regexp.last_match[:v_type]
|
159
|
+
{}.tap do |hash|
|
160
|
+
value.each do |k, v|
|
161
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
else # model
|
165
|
+
temp_model = UltracartClient.const_get(type).new
|
166
|
+
temp_model.build_from_hash(value)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# Returns the string representation of the object
|
171
|
+
# @return [String] String presentation of the object
|
172
|
+
def to_s
|
173
|
+
to_hash.to_s
|
174
|
+
end
|
175
|
+
|
176
|
+
# to_body is an alias to to_hash (backward compatibility)
|
177
|
+
# @return [Hash] Returns the object in the form of hash
|
178
|
+
def to_body
|
179
|
+
to_hash
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the object in the form of hash
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
184
|
+
def to_hash
|
185
|
+
hash = {}
|
186
|
+
self.class.attribute_map.each_pair do |attr, param|
|
187
|
+
value = self.send(attr)
|
188
|
+
next if value.nil?
|
189
|
+
hash[param] = _to_hash(value)
|
190
|
+
end
|
191
|
+
hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Outputs non-array value in the form of hash
|
195
|
+
# For object, use to_hash. Otherwise, just return the value
|
196
|
+
# @param [Object] value Any valid value
|
197
|
+
# @return [Hash] Returns the value in the form of hash
|
198
|
+
def _to_hash(value)
|
199
|
+
if value.is_a?(Array)
|
200
|
+
value.compact.map { |v| _to_hash(v) }
|
201
|
+
elsif value.is_a?(Hash)
|
202
|
+
{}.tap do |hash|
|
203
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
204
|
+
end
|
205
|
+
elsif value.respond_to? :to_hash
|
206
|
+
value.to_hash
|
207
|
+
else
|
208
|
+
value
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
end
|