ultracart_api 4.1.179 → 4.1.180
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 +9 -2
- data/docs/AutoOrderApi.md +54 -0
- data/docs/OrderApi.md +165 -0
- data/docs/OrderAssignRmaRequest.md +18 -0
- data/docs/OrderAutoOrderUpdateBillingUrlResponse.md +26 -0
- data/docs/SfvbBlogPostDetail.md +8 -2
- data/docs/SfvbBlogPostRequest.md +6 -0
- data/lib/ultracart_api/api/auto_order_api.rb +64 -0
- data/lib/ultracart_api/api/order_api.rb +209 -0
- data/lib/ultracart_api/models/order_assign_rma_request.rb +235 -0
- data/lib/ultracart_api/models/order_auto_order_update_billing_url_response.rb +257 -0
- data/lib/ultracart_api/models/sfvb_blog_post_detail.rb +33 -3
- data/lib/ultracart_api/models/sfvb_blog_post_request.rb +31 -1
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +2 -0
- metadata +6 -2
|
@@ -102,6 +102,84 @@ module UltracartClient
|
|
|
102
102
|
return data, status_code, headers
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
+
# Associates an RMA with an order
|
|
106
|
+
# Associates an RMA number with an order. Any existing RMA on the order is replaced.
|
|
107
|
+
# @param order_id [String] The order id to associate the RMA with.
|
|
108
|
+
# @param assign_rma_request [OrderAssignRmaRequest] Assign RMA request
|
|
109
|
+
# @param [Hash] opts the optional parameters
|
|
110
|
+
# @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples
|
|
111
|
+
# @return [OrderResponse]
|
|
112
|
+
def assign_rma(order_id, assign_rma_request, opts = {})
|
|
113
|
+
data, _status_code, _headers = assign_rma_with_http_info(order_id, assign_rma_request, opts)
|
|
114
|
+
data
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Associates an RMA with an order
|
|
118
|
+
# Associates an RMA number with an order. Any existing RMA on the order is replaced.
|
|
119
|
+
# @param order_id [String] The order id to associate the RMA with.
|
|
120
|
+
# @param assign_rma_request [OrderAssignRmaRequest] Assign RMA request
|
|
121
|
+
# @param [Hash] opts the optional parameters
|
|
122
|
+
# @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples
|
|
123
|
+
# @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers
|
|
124
|
+
def assign_rma_with_http_info(order_id, assign_rma_request, opts = {})
|
|
125
|
+
if @api_client.config.debugging
|
|
126
|
+
@api_client.config.logger.debug 'Calling API: OrderApi.assign_rma ...'
|
|
127
|
+
end
|
|
128
|
+
# verify the required parameter 'order_id' is set
|
|
129
|
+
if @api_client.config.client_side_validation && order_id.nil?
|
|
130
|
+
fail ArgumentError, "Missing the required parameter 'order_id' when calling OrderApi.assign_rma"
|
|
131
|
+
end
|
|
132
|
+
# verify the required parameter 'assign_rma_request' is set
|
|
133
|
+
if @api_client.config.client_side_validation && assign_rma_request.nil?
|
|
134
|
+
fail ArgumentError, "Missing the required parameter 'assign_rma_request' when calling OrderApi.assign_rma"
|
|
135
|
+
end
|
|
136
|
+
# resource path
|
|
137
|
+
local_var_path = '/order/orders/{order_id}/rma'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s))
|
|
138
|
+
|
|
139
|
+
# query parameters
|
|
140
|
+
query_params = opts[:query_params] || {}
|
|
141
|
+
query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?
|
|
142
|
+
|
|
143
|
+
# header parameters
|
|
144
|
+
header_params = opts[:header_params] || {}
|
|
145
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
|
146
|
+
# HTTP header 'Accept' (if needed)
|
|
147
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
148
|
+
# HTTP header 'Content-Type'
|
|
149
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
150
|
+
if !content_type.nil?
|
|
151
|
+
header_params['Content-Type'] = content_type
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# form parameters
|
|
155
|
+
form_params = opts[:form_params] || {}
|
|
156
|
+
|
|
157
|
+
# http body (model)
|
|
158
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(assign_rma_request)
|
|
159
|
+
|
|
160
|
+
# return_type
|
|
161
|
+
return_type = opts[:debug_return_type] || 'OrderResponse'
|
|
162
|
+
|
|
163
|
+
# auth_names
|
|
164
|
+
auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
|
|
165
|
+
|
|
166
|
+
new_options = opts.merge(
|
|
167
|
+
:operation => :"OrderApi.assign_rma",
|
|
168
|
+
:header_params => header_params,
|
|
169
|
+
:query_params => query_params,
|
|
170
|
+
:form_params => form_params,
|
|
171
|
+
:body => post_body,
|
|
172
|
+
:auth_names => auth_names,
|
|
173
|
+
:return_type => return_type
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
177
|
+
if @api_client.config.debugging
|
|
178
|
+
@api_client.config.logger.debug "API called: OrderApi#assign_rma\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
179
|
+
end
|
|
180
|
+
return data, status_code, headers
|
|
181
|
+
end
|
|
182
|
+
|
|
105
183
|
# Assigns an order to an affiliate
|
|
106
184
|
# Assigns an order to an affiliate.
|
|
107
185
|
# @param order_id [String] The order id to assign to the affiliate.
|
|
@@ -1810,6 +1888,137 @@ module UltracartClient
|
|
|
1810
1888
|
return data, status_code, headers
|
|
1811
1889
|
end
|
|
1812
1890
|
|
|
1891
|
+
# Retrieve orders by RMA
|
|
1892
|
+
# Retrieves the orders associated with the specified RMA number. The RMA must be an exact value; wildcards are not permitted.
|
|
1893
|
+
# @param rma [String] The RMA number to search for.
|
|
1894
|
+
# @param [Hash] opts the optional parameters
|
|
1895
|
+
# @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples
|
|
1896
|
+
# @return [OrdersResponse]
|
|
1897
|
+
def get_orders_by_rma(rma, opts = {})
|
|
1898
|
+
data, _status_code, _headers = get_orders_by_rma_with_http_info(rma, opts)
|
|
1899
|
+
data
|
|
1900
|
+
end
|
|
1901
|
+
|
|
1902
|
+
# Retrieve orders by RMA
|
|
1903
|
+
# Retrieves the orders associated with the specified RMA number. The RMA must be an exact value; wildcards are not permitted.
|
|
1904
|
+
# @param rma [String] The RMA number to search for.
|
|
1905
|
+
# @param [Hash] opts the optional parameters
|
|
1906
|
+
# @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples
|
|
1907
|
+
# @return [Array<(OrdersResponse, Integer, Hash)>] OrdersResponse data, response status code and response headers
|
|
1908
|
+
def get_orders_by_rma_with_http_info(rma, opts = {})
|
|
1909
|
+
if @api_client.config.debugging
|
|
1910
|
+
@api_client.config.logger.debug 'Calling API: OrderApi.get_orders_by_rma ...'
|
|
1911
|
+
end
|
|
1912
|
+
# verify the required parameter 'rma' is set
|
|
1913
|
+
if @api_client.config.client_side_validation && rma.nil?
|
|
1914
|
+
fail ArgumentError, "Missing the required parameter 'rma' when calling OrderApi.get_orders_by_rma"
|
|
1915
|
+
end
|
|
1916
|
+
# resource path
|
|
1917
|
+
local_var_path = '/order/orders/rma/{rma}'.sub('{' + 'rma' + '}', CGI.escape(rma.to_s))
|
|
1918
|
+
|
|
1919
|
+
# query parameters
|
|
1920
|
+
query_params = opts[:query_params] || {}
|
|
1921
|
+
query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?
|
|
1922
|
+
|
|
1923
|
+
# header parameters
|
|
1924
|
+
header_params = opts[:header_params] || {}
|
|
1925
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
|
1926
|
+
# HTTP header 'Accept' (if needed)
|
|
1927
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
1928
|
+
|
|
1929
|
+
# form parameters
|
|
1930
|
+
form_params = opts[:form_params] || {}
|
|
1931
|
+
|
|
1932
|
+
# http body (model)
|
|
1933
|
+
post_body = opts[:debug_body]
|
|
1934
|
+
|
|
1935
|
+
# return_type
|
|
1936
|
+
return_type = opts[:debug_return_type] || 'OrdersResponse'
|
|
1937
|
+
|
|
1938
|
+
# auth_names
|
|
1939
|
+
auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
|
|
1940
|
+
|
|
1941
|
+
new_options = opts.merge(
|
|
1942
|
+
:operation => :"OrderApi.get_orders_by_rma",
|
|
1943
|
+
:header_params => header_params,
|
|
1944
|
+
:query_params => query_params,
|
|
1945
|
+
:form_params => form_params,
|
|
1946
|
+
:body => post_body,
|
|
1947
|
+
:auth_names => auth_names,
|
|
1948
|
+
:return_type => return_type
|
|
1949
|
+
)
|
|
1950
|
+
|
|
1951
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
1952
|
+
if @api_client.config.debugging
|
|
1953
|
+
@api_client.config.logger.debug "API called: OrderApi#get_orders_by_rma\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
1954
|
+
end
|
|
1955
|
+
return data, status_code, headers
|
|
1956
|
+
end
|
|
1957
|
+
|
|
1958
|
+
# Generate an auto order update billing url
|
|
1959
|
+
# Generates the url a customer can use to update the billing information on the auto order associated with this order. This is the same url sent in the auto order update billing email.
|
|
1960
|
+
# @param order_id [String] The order id to generate the update billing url for.
|
|
1961
|
+
# @param [Hash] opts the optional parameters
|
|
1962
|
+
# @return [OrderAutoOrderUpdateBillingUrlResponse]
|
|
1963
|
+
def get_update_billing_url(order_id, opts = {})
|
|
1964
|
+
data, _status_code, _headers = get_update_billing_url_with_http_info(order_id, opts)
|
|
1965
|
+
data
|
|
1966
|
+
end
|
|
1967
|
+
|
|
1968
|
+
# Generate an auto order update billing url
|
|
1969
|
+
# Generates the url a customer can use to update the billing information on the auto order associated with this order. This is the same url sent in the auto order update billing email.
|
|
1970
|
+
# @param order_id [String] The order id to generate the update billing url for.
|
|
1971
|
+
# @param [Hash] opts the optional parameters
|
|
1972
|
+
# @return [Array<(OrderAutoOrderUpdateBillingUrlResponse, Integer, Hash)>] OrderAutoOrderUpdateBillingUrlResponse data, response status code and response headers
|
|
1973
|
+
def get_update_billing_url_with_http_info(order_id, opts = {})
|
|
1974
|
+
if @api_client.config.debugging
|
|
1975
|
+
@api_client.config.logger.debug 'Calling API: OrderApi.get_update_billing_url ...'
|
|
1976
|
+
end
|
|
1977
|
+
# verify the required parameter 'order_id' is set
|
|
1978
|
+
if @api_client.config.client_side_validation && order_id.nil?
|
|
1979
|
+
fail ArgumentError, "Missing the required parameter 'order_id' when calling OrderApi.get_update_billing_url"
|
|
1980
|
+
end
|
|
1981
|
+
# resource path
|
|
1982
|
+
local_var_path = '/order/orders/{order_id}/auto_order_update_billing_url'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s))
|
|
1983
|
+
|
|
1984
|
+
# query parameters
|
|
1985
|
+
query_params = opts[:query_params] || {}
|
|
1986
|
+
|
|
1987
|
+
# header parameters
|
|
1988
|
+
header_params = opts[:header_params] || {}
|
|
1989
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
|
1990
|
+
# HTTP header 'Accept' (if needed)
|
|
1991
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
1992
|
+
|
|
1993
|
+
# form parameters
|
|
1994
|
+
form_params = opts[:form_params] || {}
|
|
1995
|
+
|
|
1996
|
+
# http body (model)
|
|
1997
|
+
post_body = opts[:debug_body]
|
|
1998
|
+
|
|
1999
|
+
# return_type
|
|
2000
|
+
return_type = opts[:debug_return_type] || 'OrderAutoOrderUpdateBillingUrlResponse'
|
|
2001
|
+
|
|
2002
|
+
# auth_names
|
|
2003
|
+
auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
|
|
2004
|
+
|
|
2005
|
+
new_options = opts.merge(
|
|
2006
|
+
:operation => :"OrderApi.get_update_billing_url",
|
|
2007
|
+
:header_params => header_params,
|
|
2008
|
+
:query_params => query_params,
|
|
2009
|
+
:form_params => form_params,
|
|
2010
|
+
:body => post_body,
|
|
2011
|
+
:auth_names => auth_names,
|
|
2012
|
+
:return_type => return_type
|
|
2013
|
+
)
|
|
2014
|
+
|
|
2015
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
2016
|
+
if @api_client.config.debugging
|
|
2017
|
+
@api_client.config.logger.debug "API called: OrderApi#get_update_billing_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
2018
|
+
end
|
|
2019
|
+
return data, status_code, headers
|
|
2020
|
+
end
|
|
2021
|
+
|
|
1813
2022
|
# Add items and release a held order
|
|
1814
2023
|
# This method adds items to an order in the hold stage and releases it
|
|
1815
2024
|
# @param order_id [String] The order id to release.
|
|
@@ -0,0 +1,235 @@
|
|
|
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 OrderAssignRmaRequest
|
|
18
|
+
# RMA number to associate with the order
|
|
19
|
+
attr_accessor :rma
|
|
20
|
+
|
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
22
|
+
def self.attribute_map
|
|
23
|
+
{
|
|
24
|
+
:'rma' => :'rma'
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Returns all the JSON keys this model knows about
|
|
29
|
+
def self.acceptable_attributes
|
|
30
|
+
attribute_map.values
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Attribute type mapping.
|
|
34
|
+
def self.openapi_types
|
|
35
|
+
{
|
|
36
|
+
:'rma' => :'String'
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# List of attributes with nullable: true
|
|
41
|
+
def self.openapi_nullable
|
|
42
|
+
Set.new([
|
|
43
|
+
])
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Initializes the object
|
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
48
|
+
def initialize(attributes = {})
|
|
49
|
+
if (!attributes.is_a?(Hash))
|
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::OrderAssignRmaRequest` initialize method"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::OrderAssignRmaRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
57
|
+
end
|
|
58
|
+
h[k.to_sym] = v
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if attributes.key?(:'rma')
|
|
62
|
+
self.rma = attributes[:'rma']
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
67
|
+
# @return Array for valid properties with the reasons
|
|
68
|
+
def list_invalid_properties
|
|
69
|
+
invalid_properties = Array.new
|
|
70
|
+
if !@rma.nil? && @rma.to_s.length > 30
|
|
71
|
+
invalid_properties.push('invalid value for "rma", the character length must be smaller than or equal to 30.')
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
invalid_properties
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Check to see if the all the properties in the model are valid
|
|
78
|
+
# @return true if the model is valid
|
|
79
|
+
def valid?
|
|
80
|
+
return false if !@rma.nil? && @rma.to_s.length > 30
|
|
81
|
+
true
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Custom attribute writer method with validation
|
|
85
|
+
# @param [Object] rma Value to be assigned
|
|
86
|
+
def rma=(rma)
|
|
87
|
+
if !rma.nil? && rma.to_s.length > 30
|
|
88
|
+
fail ArgumentError, 'invalid value for "rma", the character length must be smaller than or equal to 30.'
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
@rma = rma
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Checks equality by comparing each attribute.
|
|
95
|
+
# @param [Object] Object to be compared
|
|
96
|
+
def ==(o)
|
|
97
|
+
return true if self.equal?(o)
|
|
98
|
+
self.class == o.class &&
|
|
99
|
+
rma == o.rma
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# @see the `==` method
|
|
103
|
+
# @param [Object] Object to be compared
|
|
104
|
+
def eql?(o)
|
|
105
|
+
self == o
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Calculates hash code according to all attributes.
|
|
109
|
+
# @return [Integer] Hash code
|
|
110
|
+
def hash
|
|
111
|
+
[rma].hash
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Builds the object from hash
|
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
116
|
+
# @return [Object] Returns the model itself
|
|
117
|
+
def self.build_from_hash(attributes)
|
|
118
|
+
new.build_from_hash(attributes)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Builds the object from hash
|
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
123
|
+
# @return [Object] Returns the model itself
|
|
124
|
+
def build_from_hash(attributes)
|
|
125
|
+
return nil unless attributes.is_a?(Hash)
|
|
126
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
127
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
128
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
129
|
+
self.send("#{key}=", nil)
|
|
130
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
131
|
+
# check to ensure the input is an array given that the attribute
|
|
132
|
+
# is documented as an array but the input is not
|
|
133
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
134
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
135
|
+
end
|
|
136
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
137
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
self
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Deserializes the data based on type
|
|
145
|
+
# @param string type Data type
|
|
146
|
+
# @param string value Value to be deserialized
|
|
147
|
+
# @return [Object] Deserialized data
|
|
148
|
+
def _deserialize(type, value)
|
|
149
|
+
case type.to_sym
|
|
150
|
+
when :Time
|
|
151
|
+
Time.parse(value)
|
|
152
|
+
when :Date
|
|
153
|
+
Date.parse(value)
|
|
154
|
+
when :String
|
|
155
|
+
value.to_s
|
|
156
|
+
when :Integer
|
|
157
|
+
value.to_i
|
|
158
|
+
when :Float
|
|
159
|
+
value.to_f
|
|
160
|
+
when :Boolean
|
|
161
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
162
|
+
true
|
|
163
|
+
else
|
|
164
|
+
false
|
|
165
|
+
end
|
|
166
|
+
when :Object
|
|
167
|
+
# generic object (usually a Hash), return directly
|
|
168
|
+
value
|
|
169
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
170
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
171
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
172
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
173
|
+
k_type = Regexp.last_match[:k_type]
|
|
174
|
+
v_type = Regexp.last_match[:v_type]
|
|
175
|
+
{}.tap do |hash|
|
|
176
|
+
value.each do |k, v|
|
|
177
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
else # model
|
|
181
|
+
# models (e.g. Pet) or oneOf
|
|
182
|
+
klass = UltracartClient.const_get(type)
|
|
183
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Returns the string representation of the object
|
|
188
|
+
# @return [String] String presentation of the object
|
|
189
|
+
def to_s
|
|
190
|
+
to_hash.to_s
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
|
195
|
+
def to_body
|
|
196
|
+
to_hash
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Returns the object in the form of hash
|
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
|
201
|
+
def to_hash
|
|
202
|
+
hash = {}
|
|
203
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
204
|
+
value = self.send(attr)
|
|
205
|
+
if value.nil?
|
|
206
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
207
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
hash[param] = _to_hash(value)
|
|
211
|
+
end
|
|
212
|
+
hash
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Outputs non-array value in the form of hash
|
|
216
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
217
|
+
# @param [Object] value Any valid value
|
|
218
|
+
# @return [Hash] Returns the value in the form of hash
|
|
219
|
+
def _to_hash(value)
|
|
220
|
+
if value.is_a?(Array)
|
|
221
|
+
value.compact.map { |v| _to_hash(v) }
|
|
222
|
+
elsif value.is_a?(Hash)
|
|
223
|
+
{}.tap do |hash|
|
|
224
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
225
|
+
end
|
|
226
|
+
elsif value.respond_to? :to_hash
|
|
227
|
+
value.to_hash
|
|
228
|
+
else
|
|
229
|
+
value
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
end
|