ultracart_api 3.11.57 → 3.11.58
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 +7 -10
- data/docs/ConversationApi.md +2 -0
- data/docs/EmailCommseqPostcard.md +1 -1
- data/docs/ItemApi.md +0 -166
- data/docs/OrderApi.md +58 -0
- data/docs/OrderUpsellCartRequest.md +10 -0
- data/lib/ultracart_api/api/conversation_api.rb +3 -0
- data/lib/ultracart_api/api/item_api.rb +0 -187
- data/lib/ultracart_api/api/order_api.rb +64 -0
- data/lib/ultracart_api/models/email_commseq_postcard.rb +1 -1
- data/lib/ultracart_api/models/{item_inventory_update_request.rb → order_upsell_cart_request.rb} +29 -10
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +1 -3
- metadata +4 -8
- data/docs/ItemInventoryUpdate.md +0 -10
- data/docs/ItemInventoryUpdateRequest.md +0 -8
- data/docs/ItemShippingDistributionCenterResponse.md +0 -12
- data/lib/ultracart_api/models/item_inventory_update.rb +0 -205
- data/lib/ultracart_api/models/item_shipping_distribution_center_response.rb +0 -221
|
@@ -949,6 +949,70 @@ module UltracartClient
|
|
|
949
949
|
end
|
|
950
950
|
return data, status_code, headers
|
|
951
951
|
end
|
|
952
|
+
# Get Order Upsell Cart
|
|
953
|
+
# Creates a new cart using cloned information from the order, but with a specific set of items, coupons and optionally a checkout URL to return the customer to
|
|
954
|
+
# @param upsell_cart_request Request for the upsell cart
|
|
955
|
+
# @param order_id The order id to base things on.
|
|
956
|
+
# @param [Hash] opts the optional parameters
|
|
957
|
+
# @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples
|
|
958
|
+
# @return [OrderResponse]
|
|
959
|
+
def get_order_upsell_cart(upsell_cart_request, order_id, opts = {})
|
|
960
|
+
data, _status_code, _headers = get_order_upsell_cart_with_http_info(upsell_cart_request, order_id, opts)
|
|
961
|
+
data
|
|
962
|
+
end
|
|
963
|
+
|
|
964
|
+
# Get Order Upsell Cart
|
|
965
|
+
# Creates a new cart using cloned information from the order, but with a specific set of items, coupons and optionally a checkout URL to return the customer to
|
|
966
|
+
# @param upsell_cart_request Request for the upsell cart
|
|
967
|
+
# @param order_id The order id to base things on.
|
|
968
|
+
# @param [Hash] opts the optional parameters
|
|
969
|
+
# @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples
|
|
970
|
+
# @return [Array<(OrderResponse, Fixnum, Hash)>] OrderResponse data, response status code and response headers
|
|
971
|
+
def get_order_upsell_cart_with_http_info(upsell_cart_request, order_id, opts = {})
|
|
972
|
+
if @api_client.config.debugging
|
|
973
|
+
@api_client.config.logger.debug 'Calling API: OrderApi.get_order_upsell_cart ...'
|
|
974
|
+
end
|
|
975
|
+
# verify the required parameter 'upsell_cart_request' is set
|
|
976
|
+
if @api_client.config.client_side_validation && upsell_cart_request.nil?
|
|
977
|
+
fail ArgumentError, "Missing the required parameter 'upsell_cart_request' when calling OrderApi.get_order_upsell_cart"
|
|
978
|
+
end
|
|
979
|
+
# verify the required parameter 'order_id' is set
|
|
980
|
+
if @api_client.config.client_side_validation && order_id.nil?
|
|
981
|
+
fail ArgumentError, "Missing the required parameter 'order_id' when calling OrderApi.get_order_upsell_cart"
|
|
982
|
+
end
|
|
983
|
+
# resource path
|
|
984
|
+
local_var_path = '/order/orders/{order_id}/upsell_with_cart'.sub('{' + 'order_id' + '}', order_id.to_s)
|
|
985
|
+
|
|
986
|
+
# query parameters
|
|
987
|
+
query_params = {}
|
|
988
|
+
query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?
|
|
989
|
+
|
|
990
|
+
# header parameters
|
|
991
|
+
header_params = {}
|
|
992
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
|
993
|
+
# HTTP header 'Accept' (if needed)
|
|
994
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
995
|
+
# HTTP header 'Content-Type'
|
|
996
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
|
|
997
|
+
|
|
998
|
+
# form parameters
|
|
999
|
+
form_params = {}
|
|
1000
|
+
|
|
1001
|
+
# http body (model)
|
|
1002
|
+
post_body = @api_client.object_to_http_body(upsell_cart_request)
|
|
1003
|
+
auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
|
|
1004
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
|
1005
|
+
:header_params => header_params,
|
|
1006
|
+
:query_params => query_params,
|
|
1007
|
+
:form_params => form_params,
|
|
1008
|
+
:body => post_body,
|
|
1009
|
+
:auth_names => auth_names,
|
|
1010
|
+
:return_type => 'OrderResponse')
|
|
1011
|
+
if @api_client.config.debugging
|
|
1012
|
+
@api_client.config.logger.debug "API called: OrderApi#get_order_upsell_cart\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
1013
|
+
end
|
|
1014
|
+
return data, status_code, headers
|
|
1015
|
+
end
|
|
952
1016
|
# Retrieve orders
|
|
953
1017
|
# Retrieves a group of orders from the account. If no parameters are specified, the API call will fail with a bad request error. Always specify some parameters to limit the scope of the orders returned to ones you are truly interested in. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.
|
|
954
1018
|
# @param [Hash] opts the optional parameters
|
|
@@ -44,7 +44,7 @@ module UltracartClient
|
|
|
44
44
|
# Postcard front container uuid
|
|
45
45
|
attr_accessor :postcard_front_container_uuid
|
|
46
46
|
|
|
47
|
-
# URL to screenshot of the
|
|
47
|
+
# URL to screenshot of the front of the postcard
|
|
48
48
|
attr_accessor :screenshot_back_url
|
|
49
49
|
|
|
50
50
|
# URL to screenshot of the front of the postcard
|
data/lib/ultracart_api/models/{item_inventory_update_request.rb → order_upsell_cart_request.rb}
RENAMED
|
@@ -13,21 +13,28 @@ Swagger Codegen version: 2.4.15-SNAPSHOT
|
|
|
13
13
|
require 'date'
|
|
14
14
|
|
|
15
15
|
module UltracartClient
|
|
16
|
-
class
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
class OrderUpsellCartRequest
|
|
17
|
+
attr_accessor :checkout_url
|
|
18
|
+
|
|
19
|
+
attr_accessor :coupon_codes
|
|
20
|
+
|
|
21
|
+
attr_accessor :items
|
|
19
22
|
|
|
20
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
21
24
|
def self.attribute_map
|
|
22
25
|
{
|
|
23
|
-
:'
|
|
26
|
+
:'checkout_url' => :'checkout_url',
|
|
27
|
+
:'coupon_codes' => :'coupon_codes',
|
|
28
|
+
:'items' => :'items'
|
|
24
29
|
}
|
|
25
30
|
end
|
|
26
31
|
|
|
27
32
|
# Attribute type mapping.
|
|
28
33
|
def self.swagger_types
|
|
29
34
|
{
|
|
30
|
-
:'
|
|
35
|
+
:'checkout_url' => :'String',
|
|
36
|
+
:'coupon_codes' => :'Array<String>',
|
|
37
|
+
:'items' => :'Array<CartItem>'
|
|
31
38
|
}
|
|
32
39
|
end
|
|
33
40
|
|
|
@@ -39,9 +46,19 @@ module UltracartClient
|
|
|
39
46
|
# convert string to symbol for hash key
|
|
40
47
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
41
48
|
|
|
42
|
-
if attributes.has_key?(:'
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
if attributes.has_key?(:'checkout_url')
|
|
50
|
+
self.checkout_url = attributes[:'checkout_url']
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
if attributes.has_key?(:'coupon_codes')
|
|
54
|
+
if (value = attributes[:'coupon_codes']).is_a?(Array)
|
|
55
|
+
self.coupon_codes = value
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
if attributes.has_key?(:'items')
|
|
60
|
+
if (value = attributes[:'items']).is_a?(Array)
|
|
61
|
+
self.items = value
|
|
45
62
|
end
|
|
46
63
|
end
|
|
47
64
|
end
|
|
@@ -64,7 +81,9 @@ module UltracartClient
|
|
|
64
81
|
def ==(o)
|
|
65
82
|
return true if self.equal?(o)
|
|
66
83
|
self.class == o.class &&
|
|
67
|
-
|
|
84
|
+
checkout_url == o.checkout_url &&
|
|
85
|
+
coupon_codes == o.coupon_codes &&
|
|
86
|
+
items == o.items
|
|
68
87
|
end
|
|
69
88
|
|
|
70
89
|
# @see the `==` method
|
|
@@ -76,7 +95,7 @@ module UltracartClient
|
|
|
76
95
|
# Calculates hash code according to all attributes.
|
|
77
96
|
# @return [Fixnum] Hash code
|
|
78
97
|
def hash
|
|
79
|
-
[
|
|
98
|
+
[checkout_url, coupon_codes, items].hash
|
|
80
99
|
end
|
|
81
100
|
|
|
82
101
|
# Builds the object from hash
|
data/lib/ultracart_api.rb
CHANGED
|
@@ -640,8 +640,6 @@ require 'ultracart_api/models/item_internal'
|
|
|
640
640
|
require 'ultracart_api/models/item_inventory_snapshot'
|
|
641
641
|
require 'ultracart_api/models/item_inventory_snapshot_distribution_center'
|
|
642
642
|
require 'ultracart_api/models/item_inventory_snapshot_response'
|
|
643
|
-
require 'ultracart_api/models/item_inventory_update'
|
|
644
|
-
require 'ultracart_api/models/item_inventory_update_request'
|
|
645
643
|
require 'ultracart_api/models/item_kit_component'
|
|
646
644
|
require 'ultracart_api/models/item_kit_definition'
|
|
647
645
|
require 'ultracart_api/models/item_option'
|
|
@@ -673,7 +671,6 @@ require 'ultracart_api/models/item_shipping_case'
|
|
|
673
671
|
require 'ultracart_api/models/item_shipping_destination_markup'
|
|
674
672
|
require 'ultracart_api/models/item_shipping_destination_restriction'
|
|
675
673
|
require 'ultracart_api/models/item_shipping_distribution_center'
|
|
676
|
-
require 'ultracart_api/models/item_shipping_distribution_center_response'
|
|
677
674
|
require 'ultracart_api/models/item_shipping_method'
|
|
678
675
|
require 'ultracart_api/models/item_shipping_package_requirement'
|
|
679
676
|
require 'ultracart_api/models/item_tag'
|
|
@@ -779,6 +776,7 @@ require 'ultracart_api/models/order_token_response'
|
|
|
779
776
|
require 'ultracart_api/models/order_tracking_number_detail'
|
|
780
777
|
require 'ultracart_api/models/order_tracking_number_details'
|
|
781
778
|
require 'ultracart_api/models/order_transactional_merchant_note'
|
|
779
|
+
require 'ultracart_api/models/order_upsell_cart_request'
|
|
782
780
|
require 'ultracart_api/models/order_utm'
|
|
783
781
|
require 'ultracart_api/models/order_validation_request'
|
|
784
782
|
require 'ultracart_api/models/order_validation_response'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ultracart_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.11.
|
|
4
|
+
version: 3.11.58
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- UltraCart
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-02-
|
|
11
|
+
date: 2026-02-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: typhoeus
|
|
@@ -856,8 +856,6 @@ files:
|
|
|
856
856
|
- docs/ItemInventorySnapshot.md
|
|
857
857
|
- docs/ItemInventorySnapshotDistributionCenter.md
|
|
858
858
|
- docs/ItemInventorySnapshotResponse.md
|
|
859
|
-
- docs/ItemInventoryUpdate.md
|
|
860
|
-
- docs/ItemInventoryUpdateRequest.md
|
|
861
859
|
- docs/ItemKitComponent.md
|
|
862
860
|
- docs/ItemKitDefinition.md
|
|
863
861
|
- docs/ItemOption.md
|
|
@@ -889,7 +887,6 @@ files:
|
|
|
889
887
|
- docs/ItemShippingDestinationMarkup.md
|
|
890
888
|
- docs/ItemShippingDestinationRestriction.md
|
|
891
889
|
- docs/ItemShippingDistributionCenter.md
|
|
892
|
-
- docs/ItemShippingDistributionCenterResponse.md
|
|
893
890
|
- docs/ItemShippingMethod.md
|
|
894
891
|
- docs/ItemShippingPackageRequirement.md
|
|
895
892
|
- docs/ItemTag.md
|
|
@@ -997,6 +994,7 @@ files:
|
|
|
997
994
|
- docs/OrderTrackingNumberDetail.md
|
|
998
995
|
- docs/OrderTrackingNumberDetails.md
|
|
999
996
|
- docs/OrderTransactionalMerchantNote.md
|
|
997
|
+
- docs/OrderUpsellCartRequest.md
|
|
1000
998
|
- docs/OrderUtm.md
|
|
1001
999
|
- docs/OrderValidationRequest.md
|
|
1002
1000
|
- docs/OrderValidationResponse.md
|
|
@@ -1833,8 +1831,6 @@ files:
|
|
|
1833
1831
|
- lib/ultracart_api/models/item_inventory_snapshot.rb
|
|
1834
1832
|
- lib/ultracart_api/models/item_inventory_snapshot_distribution_center.rb
|
|
1835
1833
|
- lib/ultracart_api/models/item_inventory_snapshot_response.rb
|
|
1836
|
-
- lib/ultracart_api/models/item_inventory_update.rb
|
|
1837
|
-
- lib/ultracart_api/models/item_inventory_update_request.rb
|
|
1838
1834
|
- lib/ultracart_api/models/item_kit_component.rb
|
|
1839
1835
|
- lib/ultracart_api/models/item_kit_definition.rb
|
|
1840
1836
|
- lib/ultracart_api/models/item_option.rb
|
|
@@ -1866,7 +1862,6 @@ files:
|
|
|
1866
1862
|
- lib/ultracart_api/models/item_shipping_destination_markup.rb
|
|
1867
1863
|
- lib/ultracart_api/models/item_shipping_destination_restriction.rb
|
|
1868
1864
|
- lib/ultracart_api/models/item_shipping_distribution_center.rb
|
|
1869
|
-
- lib/ultracart_api/models/item_shipping_distribution_center_response.rb
|
|
1870
1865
|
- lib/ultracart_api/models/item_shipping_method.rb
|
|
1871
1866
|
- lib/ultracart_api/models/item_shipping_package_requirement.rb
|
|
1872
1867
|
- lib/ultracart_api/models/item_tag.rb
|
|
@@ -1972,6 +1967,7 @@ files:
|
|
|
1972
1967
|
- lib/ultracart_api/models/order_tracking_number_detail.rb
|
|
1973
1968
|
- lib/ultracart_api/models/order_tracking_number_details.rb
|
|
1974
1969
|
- lib/ultracart_api/models/order_transactional_merchant_note.rb
|
|
1970
|
+
- lib/ultracart_api/models/order_upsell_cart_request.rb
|
|
1975
1971
|
- lib/ultracart_api/models/order_utm.rb
|
|
1976
1972
|
- lib/ultracart_api/models/order_validation_request.rb
|
|
1977
1973
|
- lib/ultracart_api/models/order_validation_response.rb
|
data/docs/ItemInventoryUpdate.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# UltracartClient::ItemInventoryUpdate
|
|
2
|
-
|
|
3
|
-
## Properties
|
|
4
|
-
Name | Type | Description | Notes
|
|
5
|
-
------------ | ------------- | ------------- | -------------
|
|
6
|
-
**distribution_center_code** | **String** | Distribution center code | [optional]
|
|
7
|
-
**inventory_level** | **Float** | Inventory level | [optional]
|
|
8
|
-
**merchant_item_id** | **String** | Merchant Item ID | [optional]
|
|
9
|
-
|
|
10
|
-
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# UltracartClient::ItemInventoryUpdateRequest
|
|
2
|
-
|
|
3
|
-
## Properties
|
|
4
|
-
Name | Type | Description | Notes
|
|
5
|
-
------------ | ------------- | ------------- | -------------
|
|
6
|
-
**inventory_updates** | [**Array<ItemInventoryUpdate>**](ItemInventoryUpdate.md) | Inventory updates array | [optional]
|
|
7
|
-
|
|
8
|
-
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# UltracartClient::ItemShippingDistributionCenterResponse
|
|
2
|
-
|
|
3
|
-
## Properties
|
|
4
|
-
Name | Type | Description | Notes
|
|
5
|
-
------------ | ------------- | ------------- | -------------
|
|
6
|
-
**error** | [**Error**](Error.md) | | [optional]
|
|
7
|
-
**item_shipping_distribution_center** | [**ItemShippingDistributionCenter**](ItemShippingDistributionCenter.md) | | [optional]
|
|
8
|
-
**metadata** | [**ResponseMetadata**](ResponseMetadata.md) | | [optional]
|
|
9
|
-
**success** | **BOOLEAN** | Indicates if API call was successful | [optional]
|
|
10
|
-
**warning** | [**Warning**](Warning.md) | | [optional]
|
|
11
|
-
|
|
12
|
-
|
|
@@ -1,205 +0,0 @@
|
|
|
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 ItemInventoryUpdate
|
|
17
|
-
# Distribution center code
|
|
18
|
-
attr_accessor :distribution_center_code
|
|
19
|
-
|
|
20
|
-
# Inventory level
|
|
21
|
-
attr_accessor :inventory_level
|
|
22
|
-
|
|
23
|
-
# Merchant Item ID
|
|
24
|
-
attr_accessor :merchant_item_id
|
|
25
|
-
|
|
26
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
|
27
|
-
def self.attribute_map
|
|
28
|
-
{
|
|
29
|
-
:'distribution_center_code' => :'distribution_center_code',
|
|
30
|
-
:'inventory_level' => :'inventory_level',
|
|
31
|
-
:'merchant_item_id' => :'merchant_item_id'
|
|
32
|
-
}
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Attribute type mapping.
|
|
36
|
-
def self.swagger_types
|
|
37
|
-
{
|
|
38
|
-
:'distribution_center_code' => :'String',
|
|
39
|
-
:'inventory_level' => :'Float',
|
|
40
|
-
:'merchant_item_id' => :'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?(:'distribution_center_code')
|
|
53
|
-
self.distribution_center_code = attributes[:'distribution_center_code']
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
if attributes.has_key?(:'inventory_level')
|
|
57
|
-
self.inventory_level = attributes[:'inventory_level']
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
if attributes.has_key?(:'merchant_item_id')
|
|
61
|
-
self.merchant_item_id = attributes[:'merchant_item_id']
|
|
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
|
-
distribution_center_code == o.distribution_center_code &&
|
|
84
|
-
inventory_level == o.inventory_level &&
|
|
85
|
-
merchant_item_id == o.merchant_item_id
|
|
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
|
-
[distribution_center_code, inventory_level, merchant_item_id].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
|