ultracart_api 4.1.10 → 4.1.12
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 +12 -2
- data/docs/ConversationApi.md +282 -0
- data/docs/ConversationVirtualAgentBudget.md +24 -0
- data/docs/ConversationVirtualAgentBudgetResponse.md +26 -0
- data/docs/ConversationVirtualAgentCapabilities.md +34 -0
- data/docs/ConversationVirtualAgentCapabilitiesResponse.md +26 -0
- data/lib/ultracart_api/api/conversation_api.rb +254 -0
- data/lib/ultracart_api/models/conversation_virtual_agent_budget.rb +246 -0
- data/lib/ultracart_api/models/conversation_virtual_agent_budget_response.rb +256 -0
- data/lib/ultracart_api/models/conversation_virtual_agent_capabilities.rb +291 -0
- data/lib/ultracart_api/models/conversation_virtual_agent_capabilities_response.rb +256 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +4 -0
- metadata +10 -2
@@ -3349,6 +3349,122 @@ module UltracartClient
|
|
3349
3349
|
return data, status_code, headers
|
3350
3350
|
end
|
3351
3351
|
|
3352
|
+
# Get virtual agent budget
|
3353
|
+
# Retrieve virtual agent budget
|
3354
|
+
# @param [Hash] opts the optional parameters
|
3355
|
+
# @return [ConversationVirtualAgentBudgetResponse]
|
3356
|
+
def get_virtual_agent_budget(opts = {})
|
3357
|
+
data, _status_code, _headers = get_virtual_agent_budget_with_http_info(opts)
|
3358
|
+
data
|
3359
|
+
end
|
3360
|
+
|
3361
|
+
# Get virtual agent budget
|
3362
|
+
# Retrieve virtual agent budget
|
3363
|
+
# @param [Hash] opts the optional parameters
|
3364
|
+
# @return [Array<(ConversationVirtualAgentBudgetResponse, Integer, Hash)>] ConversationVirtualAgentBudgetResponse data, response status code and response headers
|
3365
|
+
def get_virtual_agent_budget_with_http_info(opts = {})
|
3366
|
+
if @api_client.config.debugging
|
3367
|
+
@api_client.config.logger.debug 'Calling API: ConversationApi.get_virtual_agent_budget ...'
|
3368
|
+
end
|
3369
|
+
# resource path
|
3370
|
+
local_var_path = '/conversation/virtualagent/budget'
|
3371
|
+
|
3372
|
+
# query parameters
|
3373
|
+
query_params = opts[:query_params] || {}
|
3374
|
+
|
3375
|
+
# header parameters
|
3376
|
+
header_params = opts[:header_params] || {}
|
3377
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
3378
|
+
# HTTP header 'Accept' (if needed)
|
3379
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
3380
|
+
|
3381
|
+
# form parameters
|
3382
|
+
form_params = opts[:form_params] || {}
|
3383
|
+
|
3384
|
+
# http body (model)
|
3385
|
+
post_body = opts[:debug_body]
|
3386
|
+
|
3387
|
+
# return_type
|
3388
|
+
return_type = opts[:debug_return_type] || 'ConversationVirtualAgentBudgetResponse'
|
3389
|
+
|
3390
|
+
# auth_names
|
3391
|
+
auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
|
3392
|
+
|
3393
|
+
new_options = opts.merge(
|
3394
|
+
:operation => :"ConversationApi.get_virtual_agent_budget",
|
3395
|
+
:header_params => header_params,
|
3396
|
+
:query_params => query_params,
|
3397
|
+
:form_params => form_params,
|
3398
|
+
:body => post_body,
|
3399
|
+
:auth_names => auth_names,
|
3400
|
+
:return_type => return_type
|
3401
|
+
)
|
3402
|
+
|
3403
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
3404
|
+
if @api_client.config.debugging
|
3405
|
+
@api_client.config.logger.debug "API called: ConversationApi#get_virtual_agent_budget\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
3406
|
+
end
|
3407
|
+
return data, status_code, headers
|
3408
|
+
end
|
3409
|
+
|
3410
|
+
# Get virtual agent capabilities
|
3411
|
+
# Retrieve virtual agent capabilities
|
3412
|
+
# @param [Hash] opts the optional parameters
|
3413
|
+
# @return [ConversationVirtualAgentCapabilitiesResponse]
|
3414
|
+
def get_virtual_agent_capabilities(opts = {})
|
3415
|
+
data, _status_code, _headers = get_virtual_agent_capabilities_with_http_info(opts)
|
3416
|
+
data
|
3417
|
+
end
|
3418
|
+
|
3419
|
+
# Get virtual agent capabilities
|
3420
|
+
# Retrieve virtual agent capabilities
|
3421
|
+
# @param [Hash] opts the optional parameters
|
3422
|
+
# @return [Array<(ConversationVirtualAgentCapabilitiesResponse, Integer, Hash)>] ConversationVirtualAgentCapabilitiesResponse data, response status code and response headers
|
3423
|
+
def get_virtual_agent_capabilities_with_http_info(opts = {})
|
3424
|
+
if @api_client.config.debugging
|
3425
|
+
@api_client.config.logger.debug 'Calling API: ConversationApi.get_virtual_agent_capabilities ...'
|
3426
|
+
end
|
3427
|
+
# resource path
|
3428
|
+
local_var_path = '/conversation/virtualagent/capabilities'
|
3429
|
+
|
3430
|
+
# query parameters
|
3431
|
+
query_params = opts[:query_params] || {}
|
3432
|
+
|
3433
|
+
# header parameters
|
3434
|
+
header_params = opts[:header_params] || {}
|
3435
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
3436
|
+
# HTTP header 'Accept' (if needed)
|
3437
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
3438
|
+
|
3439
|
+
# form parameters
|
3440
|
+
form_params = opts[:form_params] || {}
|
3441
|
+
|
3442
|
+
# http body (model)
|
3443
|
+
post_body = opts[:debug_body]
|
3444
|
+
|
3445
|
+
# return_type
|
3446
|
+
return_type = opts[:debug_return_type] || 'ConversationVirtualAgentCapabilitiesResponse'
|
3447
|
+
|
3448
|
+
# auth_names
|
3449
|
+
auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
|
3450
|
+
|
3451
|
+
new_options = opts.merge(
|
3452
|
+
:operation => :"ConversationApi.get_virtual_agent_capabilities",
|
3453
|
+
:header_params => header_params,
|
3454
|
+
:query_params => query_params,
|
3455
|
+
:form_params => form_params,
|
3456
|
+
:body => post_body,
|
3457
|
+
:auth_names => auth_names,
|
3458
|
+
:return_type => return_type
|
3459
|
+
)
|
3460
|
+
|
3461
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
3462
|
+
if @api_client.config.debugging
|
3463
|
+
@api_client.config.logger.debug "API called: ConversationApi#get_virtual_agent_capabilities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
3464
|
+
end
|
3465
|
+
return data, status_code, headers
|
3466
|
+
end
|
3467
|
+
|
3352
3468
|
# Insert a canned message
|
3353
3469
|
# Insert a canned message
|
3354
3470
|
# @param canned_message [ConversationCannedMessage] Canned message
|
@@ -5537,5 +5653,143 @@ module UltracartClient
|
|
5537
5653
|
end
|
5538
5654
|
return data, status_code, headers
|
5539
5655
|
end
|
5656
|
+
|
5657
|
+
# Update virtual agent budget
|
5658
|
+
# Update virtual agent budget
|
5659
|
+
# @param virtual_agent_budget [ConversationVirtualAgentBudget] Virtual Agent Budget
|
5660
|
+
# @param [Hash] opts the optional parameters
|
5661
|
+
# @return [ConversationVirtualAgentBudgetResponse]
|
5662
|
+
def update_virtual_agent_budget(virtual_agent_budget, opts = {})
|
5663
|
+
data, _status_code, _headers = update_virtual_agent_budget_with_http_info(virtual_agent_budget, opts)
|
5664
|
+
data
|
5665
|
+
end
|
5666
|
+
|
5667
|
+
# Update virtual agent budget
|
5668
|
+
# Update virtual agent budget
|
5669
|
+
# @param virtual_agent_budget [ConversationVirtualAgentBudget] Virtual Agent Budget
|
5670
|
+
# @param [Hash] opts the optional parameters
|
5671
|
+
# @return [Array<(ConversationVirtualAgentBudgetResponse, Integer, Hash)>] ConversationVirtualAgentBudgetResponse data, response status code and response headers
|
5672
|
+
def update_virtual_agent_budget_with_http_info(virtual_agent_budget, opts = {})
|
5673
|
+
if @api_client.config.debugging
|
5674
|
+
@api_client.config.logger.debug 'Calling API: ConversationApi.update_virtual_agent_budget ...'
|
5675
|
+
end
|
5676
|
+
# verify the required parameter 'virtual_agent_budget' is set
|
5677
|
+
if @api_client.config.client_side_validation && virtual_agent_budget.nil?
|
5678
|
+
fail ArgumentError, "Missing the required parameter 'virtual_agent_budget' when calling ConversationApi.update_virtual_agent_budget"
|
5679
|
+
end
|
5680
|
+
# resource path
|
5681
|
+
local_var_path = '/conversation/virtualagent/budget'
|
5682
|
+
|
5683
|
+
# query parameters
|
5684
|
+
query_params = opts[:query_params] || {}
|
5685
|
+
|
5686
|
+
# header parameters
|
5687
|
+
header_params = opts[:header_params] || {}
|
5688
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
5689
|
+
# HTTP header 'Accept' (if needed)
|
5690
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
5691
|
+
# HTTP header 'Content-Type'
|
5692
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
5693
|
+
if !content_type.nil?
|
5694
|
+
header_params['Content-Type'] = content_type
|
5695
|
+
end
|
5696
|
+
|
5697
|
+
# form parameters
|
5698
|
+
form_params = opts[:form_params] || {}
|
5699
|
+
|
5700
|
+
# http body (model)
|
5701
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(virtual_agent_budget)
|
5702
|
+
|
5703
|
+
# return_type
|
5704
|
+
return_type = opts[:debug_return_type] || 'ConversationVirtualAgentBudgetResponse'
|
5705
|
+
|
5706
|
+
# auth_names
|
5707
|
+
auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
|
5708
|
+
|
5709
|
+
new_options = opts.merge(
|
5710
|
+
:operation => :"ConversationApi.update_virtual_agent_budget",
|
5711
|
+
:header_params => header_params,
|
5712
|
+
:query_params => query_params,
|
5713
|
+
:form_params => form_params,
|
5714
|
+
:body => post_body,
|
5715
|
+
:auth_names => auth_names,
|
5716
|
+
:return_type => return_type
|
5717
|
+
)
|
5718
|
+
|
5719
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
5720
|
+
if @api_client.config.debugging
|
5721
|
+
@api_client.config.logger.debug "API called: ConversationApi#update_virtual_agent_budget\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
5722
|
+
end
|
5723
|
+
return data, status_code, headers
|
5724
|
+
end
|
5725
|
+
|
5726
|
+
# Update virtual agent capabilities
|
5727
|
+
# Update virtual agent capabilities
|
5728
|
+
# @param virtual_agent_capabilities [ConversationVirtualAgentCapabilities] Virtual Agent Capabilities
|
5729
|
+
# @param [Hash] opts the optional parameters
|
5730
|
+
# @return [ConversationVirtualAgentCapabilitiesResponse]
|
5731
|
+
def update_virtual_agent_capabilities(virtual_agent_capabilities, opts = {})
|
5732
|
+
data, _status_code, _headers = update_virtual_agent_capabilities_with_http_info(virtual_agent_capabilities, opts)
|
5733
|
+
data
|
5734
|
+
end
|
5735
|
+
|
5736
|
+
# Update virtual agent capabilities
|
5737
|
+
# Update virtual agent capabilities
|
5738
|
+
# @param virtual_agent_capabilities [ConversationVirtualAgentCapabilities] Virtual Agent Capabilities
|
5739
|
+
# @param [Hash] opts the optional parameters
|
5740
|
+
# @return [Array<(ConversationVirtualAgentCapabilitiesResponse, Integer, Hash)>] ConversationVirtualAgentCapabilitiesResponse data, response status code and response headers
|
5741
|
+
def update_virtual_agent_capabilities_with_http_info(virtual_agent_capabilities, opts = {})
|
5742
|
+
if @api_client.config.debugging
|
5743
|
+
@api_client.config.logger.debug 'Calling API: ConversationApi.update_virtual_agent_capabilities ...'
|
5744
|
+
end
|
5745
|
+
# verify the required parameter 'virtual_agent_capabilities' is set
|
5746
|
+
if @api_client.config.client_side_validation && virtual_agent_capabilities.nil?
|
5747
|
+
fail ArgumentError, "Missing the required parameter 'virtual_agent_capabilities' when calling ConversationApi.update_virtual_agent_capabilities"
|
5748
|
+
end
|
5749
|
+
# resource path
|
5750
|
+
local_var_path = '/conversation/virtualagent/capabilities'
|
5751
|
+
|
5752
|
+
# query parameters
|
5753
|
+
query_params = opts[:query_params] || {}
|
5754
|
+
|
5755
|
+
# header parameters
|
5756
|
+
header_params = opts[:header_params] || {}
|
5757
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
5758
|
+
# HTTP header 'Accept' (if needed)
|
5759
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
5760
|
+
# HTTP header 'Content-Type'
|
5761
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
5762
|
+
if !content_type.nil?
|
5763
|
+
header_params['Content-Type'] = content_type
|
5764
|
+
end
|
5765
|
+
|
5766
|
+
# form parameters
|
5767
|
+
form_params = opts[:form_params] || {}
|
5768
|
+
|
5769
|
+
# http body (model)
|
5770
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(virtual_agent_capabilities)
|
5771
|
+
|
5772
|
+
# return_type
|
5773
|
+
return_type = opts[:debug_return_type] || 'ConversationVirtualAgentCapabilitiesResponse'
|
5774
|
+
|
5775
|
+
# auth_names
|
5776
|
+
auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
|
5777
|
+
|
5778
|
+
new_options = opts.merge(
|
5779
|
+
:operation => :"ConversationApi.update_virtual_agent_capabilities",
|
5780
|
+
:header_params => header_params,
|
5781
|
+
:query_params => query_params,
|
5782
|
+
:form_params => form_params,
|
5783
|
+
:body => post_body,
|
5784
|
+
:auth_names => auth_names,
|
5785
|
+
:return_type => return_type
|
5786
|
+
)
|
5787
|
+
|
5788
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
5789
|
+
if @api_client.config.debugging
|
5790
|
+
@api_client.config.logger.debug "API called: ConversationApi#update_virtual_agent_capabilities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
5791
|
+
end
|
5792
|
+
return data, status_code, headers
|
5793
|
+
end
|
5540
5794
|
end
|
5541
5795
|
end
|
@@ -0,0 +1,246 @@
|
|
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 ConversationVirtualAgentBudget
|
18
|
+
attr_accessor :budget_daily
|
19
|
+
|
20
|
+
attr_accessor :budget_monthly
|
21
|
+
|
22
|
+
attr_accessor :used_daily
|
23
|
+
|
24
|
+
attr_accessor :used_monthly
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'budget_daily' => :'budget_daily',
|
30
|
+
:'budget_monthly' => :'budget_monthly',
|
31
|
+
:'used_daily' => :'used_daily',
|
32
|
+
:'used_monthly' => :'used_monthly'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns all the JSON keys this model knows about
|
37
|
+
def self.acceptable_attributes
|
38
|
+
attribute_map.values
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.openapi_types
|
43
|
+
{
|
44
|
+
:'budget_daily' => :'Float',
|
45
|
+
:'budget_monthly' => :'Float',
|
46
|
+
:'used_daily' => :'Float',
|
47
|
+
:'used_monthly' => :'Float'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# List of attributes with nullable: true
|
52
|
+
def self.openapi_nullable
|
53
|
+
Set.new([
|
54
|
+
])
|
55
|
+
end
|
56
|
+
|
57
|
+
# Initializes the object
|
58
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
59
|
+
def initialize(attributes = {})
|
60
|
+
if (!attributes.is_a?(Hash))
|
61
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ConversationVirtualAgentBudget` initialize method"
|
62
|
+
end
|
63
|
+
|
64
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
65
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
66
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ConversationVirtualAgentBudget`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
68
|
+
end
|
69
|
+
h[k.to_sym] = v
|
70
|
+
}
|
71
|
+
|
72
|
+
if attributes.key?(:'budget_daily')
|
73
|
+
self.budget_daily = attributes[:'budget_daily']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.key?(:'budget_monthly')
|
77
|
+
self.budget_monthly = attributes[:'budget_monthly']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.key?(:'used_daily')
|
81
|
+
self.used_daily = attributes[:'used_daily']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'used_monthly')
|
85
|
+
self.used_monthly = attributes[:'used_monthly']
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
90
|
+
# @return Array for valid properties with the reasons
|
91
|
+
def list_invalid_properties
|
92
|
+
invalid_properties = Array.new
|
93
|
+
invalid_properties
|
94
|
+
end
|
95
|
+
|
96
|
+
# Check to see if the all the properties in the model are valid
|
97
|
+
# @return true if the model is valid
|
98
|
+
def valid?
|
99
|
+
true
|
100
|
+
end
|
101
|
+
|
102
|
+
# Checks equality by comparing each attribute.
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def ==(o)
|
105
|
+
return true if self.equal?(o)
|
106
|
+
self.class == o.class &&
|
107
|
+
budget_daily == o.budget_daily &&
|
108
|
+
budget_monthly == o.budget_monthly &&
|
109
|
+
used_daily == o.used_daily &&
|
110
|
+
used_monthly == o.used_monthly
|
111
|
+
end
|
112
|
+
|
113
|
+
# @see the `==` method
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def eql?(o)
|
116
|
+
self == o
|
117
|
+
end
|
118
|
+
|
119
|
+
# Calculates hash code according to all attributes.
|
120
|
+
# @return [Integer] Hash code
|
121
|
+
def hash
|
122
|
+
[budget_daily, budget_monthly, used_daily, used_monthly].hash
|
123
|
+
end
|
124
|
+
|
125
|
+
# Builds the object from hash
|
126
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
127
|
+
# @return [Object] Returns the model itself
|
128
|
+
def self.build_from_hash(attributes)
|
129
|
+
new.build_from_hash(attributes)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Builds the object from hash
|
133
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
134
|
+
# @return [Object] Returns the model itself
|
135
|
+
def build_from_hash(attributes)
|
136
|
+
return nil unless attributes.is_a?(Hash)
|
137
|
+
attributes = attributes.transform_keys(&:to_sym)
|
138
|
+
self.class.openapi_types.each_pair do |key, type|
|
139
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
140
|
+
self.send("#{key}=", nil)
|
141
|
+
elsif 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
|
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 :Time
|
162
|
+
Time.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
|
+
# models (e.g. Pet) or oneOf
|
193
|
+
klass = UltracartClient.const_get(type)
|
194
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
# Returns the string representation of the object
|
199
|
+
# @return [String] String presentation of the object
|
200
|
+
def to_s
|
201
|
+
to_hash.to_s
|
202
|
+
end
|
203
|
+
|
204
|
+
# to_body is an alias to to_hash (backward compatibility)
|
205
|
+
# @return [Hash] Returns the object in the form of hash
|
206
|
+
def to_body
|
207
|
+
to_hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Returns the object in the form of hash
|
211
|
+
# @return [Hash] Returns the object in the form of hash
|
212
|
+
def to_hash
|
213
|
+
hash = {}
|
214
|
+
self.class.attribute_map.each_pair do |attr, param|
|
215
|
+
value = self.send(attr)
|
216
|
+
if value.nil?
|
217
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
218
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
219
|
+
end
|
220
|
+
|
221
|
+
hash[param] = _to_hash(value)
|
222
|
+
end
|
223
|
+
hash
|
224
|
+
end
|
225
|
+
|
226
|
+
# Outputs non-array value in the form of hash
|
227
|
+
# For object, use to_hash. Otherwise, just return the value
|
228
|
+
# @param [Object] value Any valid value
|
229
|
+
# @return [Hash] Returns the value in the form of hash
|
230
|
+
def _to_hash(value)
|
231
|
+
if value.is_a?(Array)
|
232
|
+
value.compact.map { |v| _to_hash(v) }
|
233
|
+
elsif value.is_a?(Hash)
|
234
|
+
{}.tap do |hash|
|
235
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
236
|
+
end
|
237
|
+
elsif value.respond_to? :to_hash
|
238
|
+
value.to_hash
|
239
|
+
else
|
240
|
+
value
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
|
246
|
+
end
|