ultracart_api 4.1.97 → 4.1.98
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 +4 -2
- data/docs/Coupon.md +2 -0
- data/docs/CouponAmountOffItemsAndFreeShipping.md +28 -0
- data/lib/ultracart_api/models/coupon.rb +10 -1
- data/lib/ultracart_api/models/coupon_amount_off_items_and_free_shipping.rb +291 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5d16fc9086ba10e99c5f7d108ef3d87718de83a82ff33936b7c7a2b1bc9e4f7b
|
|
4
|
+
data.tar.gz: 5023254127cd0016835b4a18768ce5f87bf79459413c9b219c6d7071df1f2c3b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c7a92f38ba33f63d9d8181607d8c11cce9e78b92cdae238c5e48ad33e98bf1baeeff2612a06a15ff377f74d49a9a944d3aa85a484abcf3cff24b809c1f409919
|
|
7
|
+
data.tar.gz: 76fe42c6ba9869960f889ea36166ae123463f33939db590d47b468c614f48285abca2e46046675c8aa0c6951648a85bd7bcad43603cecb3a82910af1403af575
|
data/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Note: Every method has a sample for every language. See https://github.com/Ultr
|
|
|
7
7
|
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
|
8
8
|
|
|
9
9
|
- API version: 2.0.0
|
|
10
|
-
- Package version: 4.1.
|
|
10
|
+
- Package version: 4.1.98
|
|
11
11
|
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
|
12
12
|
- For more information, please visit [http://www.ultracart.com/api/](http://www.ultracart.com/api/)
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-g
|
|
|
16
16
|
gemfile:
|
|
17
17
|
|
|
18
18
|
```shell
|
|
19
|
-
gem 'ultracart_api', '4.1.
|
|
19
|
+
gem 'ultracart_api', '4.1.98'
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
install:
|
|
@@ -1007,6 +1007,7 @@ Class | Method | HTTP request | Description
|
|
|
1007
1007
|
- [UltracartClient::Country](docs/Country.md)
|
|
1008
1008
|
- [UltracartClient::Coupon](docs/Coupon.md)
|
|
1009
1009
|
- [UltracartClient::CouponAmountOffItems](docs/CouponAmountOffItems.md)
|
|
1010
|
+
- [UltracartClient::CouponAmountOffItemsAndFreeShipping](docs/CouponAmountOffItemsAndFreeShipping.md)
|
|
1010
1011
|
- [UltracartClient::CouponAmountOffShipping](docs/CouponAmountOffShipping.md)
|
|
1011
1012
|
- [UltracartClient::CouponAmountOffShippingWithItemsPurchase](docs/CouponAmountOffShippingWithItemsPurchase.md)
|
|
1012
1013
|
- [UltracartClient::CouponAmountOffSubtotal](docs/CouponAmountOffSubtotal.md)
|
|
@@ -1774,6 +1775,7 @@ Not every change is committed to every SDK.
|
|
|
1774
1775
|
|
|
1775
1776
|
| Version | Date | Comments |
|
|
1776
1777
|
| --: | :-: | --- |
|
|
1778
|
+
| 4.1.98 | 06/04/2026 | coupon - new coupon type for amount off items with free shipping |
|
|
1777
1779
|
| 4.1.97 | 06/03/2026 | fraud api alpha version |
|
|
1778
1780
|
| 4.1.96 | 06/03/2026 | fraud api alpha build |
|
|
1779
1781
|
| 4.1.95 | 06/02/2026 | fraud api alpha version |
|
data/docs/Coupon.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
| **affiliate_oid** | **Integer** | Associates an order with an affiliate when this value is set. | [optional] |
|
|
8
8
|
| **allow_multiple_one_time_codes** | **Boolean** | True if multiple one time codes for this coupon can be used on a cart at the same time. | [optional] |
|
|
9
9
|
| **amount_off_items** | [**CouponAmountOffItems**](CouponAmountOffItems.md) | | [optional] |
|
|
10
|
+
| **amount_off_items_and_free_shipping** | [**CouponAmountOffItemsAndFreeShipping**](CouponAmountOffItemsAndFreeShipping.md) | | [optional] |
|
|
10
11
|
| **amount_off_shipping** | [**CouponAmountOffShipping**](CouponAmountOffShipping.md) | | [optional] |
|
|
11
12
|
| **amount_off_shipping_with_items_purchase** | [**CouponAmountOffShippingWithItemsPurchase**](CouponAmountOffShippingWithItemsPurchase.md) | | [optional] |
|
|
12
13
|
| **amount_off_subtotal** | [**CouponAmountOffSubtotal**](CouponAmountOffSubtotal.md) | | [optional] |
|
|
@@ -82,6 +83,7 @@ instance = UltracartClient::Coupon.new(
|
|
|
82
83
|
affiliate_oid: null,
|
|
83
84
|
allow_multiple_one_time_codes: null,
|
|
84
85
|
amount_off_items: null,
|
|
86
|
+
amount_off_items_and_free_shipping: null,
|
|
85
87
|
amount_off_shipping: null,
|
|
86
88
|
amount_off_shipping_with_items_purchase: null,
|
|
87
89
|
amount_off_subtotal: null,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# UltracartClient::CouponAmountOffItemsAndFreeShipping
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **currency_code** | **String** | The ISO-4217 three letter currency code the customer is viewing prices in | [optional] |
|
|
8
|
+
| **discount_amount** | **Float** | The amount of discount | [optional] |
|
|
9
|
+
| **item_tags** | **Array<String>** | An optional list of item tags which will receive a discount. | [optional] |
|
|
10
|
+
| **items** | **Array<String>** | A list of items which are eligible for the discount amount. | [optional] |
|
|
11
|
+
| **limit** | **Integer** | The limit of items which are eligible for the discount amount. | [optional] |
|
|
12
|
+
| **shipping_methods** | **Array<String>** | One or more shipping methods that may be used with this coupon. If not specified or empty, methods that are marked as qualifies for free shipping will be the only free methods | [optional] |
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```ruby
|
|
17
|
+
require 'ultracart_api'
|
|
18
|
+
|
|
19
|
+
instance = UltracartClient::CouponAmountOffItemsAndFreeShipping.new(
|
|
20
|
+
currency_code: null,
|
|
21
|
+
discount_amount: null,
|
|
22
|
+
item_tags: null,
|
|
23
|
+
items: null,
|
|
24
|
+
limit: null,
|
|
25
|
+
shipping_methods: null
|
|
26
|
+
)
|
|
27
|
+
```
|
|
28
|
+
|
|
@@ -23,6 +23,8 @@ module UltracartClient
|
|
|
23
23
|
|
|
24
24
|
attr_accessor :amount_off_items
|
|
25
25
|
|
|
26
|
+
attr_accessor :amount_off_items_and_free_shipping
|
|
27
|
+
|
|
26
28
|
attr_accessor :amount_off_shipping
|
|
27
29
|
|
|
28
30
|
attr_accessor :amount_off_shipping_with_items_purchase
|
|
@@ -198,6 +200,7 @@ module UltracartClient
|
|
|
198
200
|
:'affiliate_oid' => :'affiliate_oid',
|
|
199
201
|
:'allow_multiple_one_time_codes' => :'allow_multiple_one_time_codes',
|
|
200
202
|
:'amount_off_items' => :'amount_off_items',
|
|
203
|
+
:'amount_off_items_and_free_shipping' => :'amount_off_items_and_free_shipping',
|
|
201
204
|
:'amount_off_shipping' => :'amount_off_shipping',
|
|
202
205
|
:'amount_off_shipping_with_items_purchase' => :'amount_off_shipping_with_items_purchase',
|
|
203
206
|
:'amount_off_subtotal' => :'amount_off_subtotal',
|
|
@@ -277,6 +280,7 @@ module UltracartClient
|
|
|
277
280
|
:'affiliate_oid' => :'Integer',
|
|
278
281
|
:'allow_multiple_one_time_codes' => :'Boolean',
|
|
279
282
|
:'amount_off_items' => :'CouponAmountOffItems',
|
|
283
|
+
:'amount_off_items_and_free_shipping' => :'CouponAmountOffItemsAndFreeShipping',
|
|
280
284
|
:'amount_off_shipping' => :'CouponAmountOffShipping',
|
|
281
285
|
:'amount_off_shipping_with_items_purchase' => :'CouponAmountOffShippingWithItemsPurchase',
|
|
282
286
|
:'amount_off_subtotal' => :'CouponAmountOffSubtotal',
|
|
@@ -378,6 +382,10 @@ module UltracartClient
|
|
|
378
382
|
self.amount_off_items = attributes[:'amount_off_items']
|
|
379
383
|
end
|
|
380
384
|
|
|
385
|
+
if attributes.key?(:'amount_off_items_and_free_shipping')
|
|
386
|
+
self.amount_off_items_and_free_shipping = attributes[:'amount_off_items_and_free_shipping']
|
|
387
|
+
end
|
|
388
|
+
|
|
381
389
|
if attributes.key?(:'amount_off_shipping')
|
|
382
390
|
self.amount_off_shipping = attributes[:'amount_off_shipping']
|
|
383
391
|
end
|
|
@@ -758,6 +766,7 @@ module UltracartClient
|
|
|
758
766
|
affiliate_oid == o.affiliate_oid &&
|
|
759
767
|
allow_multiple_one_time_codes == o.allow_multiple_one_time_codes &&
|
|
760
768
|
amount_off_items == o.amount_off_items &&
|
|
769
|
+
amount_off_items_and_free_shipping == o.amount_off_items_and_free_shipping &&
|
|
761
770
|
amount_off_shipping == o.amount_off_shipping &&
|
|
762
771
|
amount_off_shipping_with_items_purchase == o.amount_off_shipping_with_items_purchase &&
|
|
763
772
|
amount_off_subtotal == o.amount_off_subtotal &&
|
|
@@ -834,7 +843,7 @@ module UltracartClient
|
|
|
834
843
|
# Calculates hash code according to all attributes.
|
|
835
844
|
# @return [Integer] Hash code
|
|
836
845
|
def hash
|
|
837
|
-
[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, amount_shipping_with_subtotal, 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_item_purchase_and_free_shipping, 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, more_loyalty_cashback, more_loyalty_points, multiple_amounts_off_items, no_discount, percent_more_loyalty_cashback, percent_more_loyalty_points, percent_off_item_with_items_quantity_purchase, percent_off_items, percent_off_items_and_free_shipping, percent_off_items_with_items_purchase, percent_off_items_with_minimum_item_amount, 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, skip_on_rebill, start_dts, super_coupon, tiered_amount_off_items, tiered_amount_off_subtotal, tiered_percent_off_items, tiered_percent_off_shipping, tiered_percent_off_subtotal, tiered_percent_off_subtotal_based_on_msrp, usable_by].hash
|
|
846
|
+
[affiliate_oid, allow_multiple_one_time_codes, amount_off_items, amount_off_items_and_free_shipping, 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, amount_shipping_with_subtotal, 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_item_purchase_and_free_shipping, 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, more_loyalty_cashback, more_loyalty_points, multiple_amounts_off_items, no_discount, percent_more_loyalty_cashback, percent_more_loyalty_points, percent_off_item_with_items_quantity_purchase, percent_off_items, percent_off_items_and_free_shipping, percent_off_items_with_items_purchase, percent_off_items_with_minimum_item_amount, 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, skip_on_rebill, start_dts, super_coupon, tiered_amount_off_items, tiered_amount_off_subtotal, tiered_percent_off_items, tiered_percent_off_shipping, tiered_percent_off_subtotal, tiered_percent_off_subtotal_based_on_msrp, usable_by].hash
|
|
838
847
|
end
|
|
839
848
|
|
|
840
849
|
# Builds the object from hash
|
|
@@ -0,0 +1,291 @@
|
|
|
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 CouponAmountOffItemsAndFreeShipping
|
|
18
|
+
# The ISO-4217 three letter currency code the customer is viewing prices in
|
|
19
|
+
attr_accessor :currency_code
|
|
20
|
+
|
|
21
|
+
# The amount of discount
|
|
22
|
+
attr_accessor :discount_amount
|
|
23
|
+
|
|
24
|
+
# An optional list of item tags which will receive a discount.
|
|
25
|
+
attr_accessor :item_tags
|
|
26
|
+
|
|
27
|
+
# A list of items which are eligible for the discount amount.
|
|
28
|
+
attr_accessor :items
|
|
29
|
+
|
|
30
|
+
# The limit of items which are eligible for the discount amount.
|
|
31
|
+
attr_accessor :limit
|
|
32
|
+
|
|
33
|
+
# One or more shipping methods that may be used with this coupon. If not specified or empty, methods that are marked as qualifies for free shipping will be the only free methods
|
|
34
|
+
attr_accessor :shipping_methods
|
|
35
|
+
|
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
|
+
def self.attribute_map
|
|
38
|
+
{
|
|
39
|
+
:'currency_code' => :'currency_code',
|
|
40
|
+
:'discount_amount' => :'discount_amount',
|
|
41
|
+
:'item_tags' => :'item_tags',
|
|
42
|
+
:'items' => :'items',
|
|
43
|
+
:'limit' => :'limit',
|
|
44
|
+
:'shipping_methods' => :'shipping_methods'
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Returns all the JSON keys this model knows about
|
|
49
|
+
def self.acceptable_attributes
|
|
50
|
+
attribute_map.values
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Attribute type mapping.
|
|
54
|
+
def self.openapi_types
|
|
55
|
+
{
|
|
56
|
+
:'currency_code' => :'String',
|
|
57
|
+
:'discount_amount' => :'Float',
|
|
58
|
+
:'item_tags' => :'Array<String>',
|
|
59
|
+
:'items' => :'Array<String>',
|
|
60
|
+
:'limit' => :'Integer',
|
|
61
|
+
:'shipping_methods' => :'Array<String>'
|
|
62
|
+
}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# List of attributes with nullable: true
|
|
66
|
+
def self.openapi_nullable
|
|
67
|
+
Set.new([
|
|
68
|
+
])
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Initializes the object
|
|
72
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
73
|
+
def initialize(attributes = {})
|
|
74
|
+
if (!attributes.is_a?(Hash))
|
|
75
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::CouponAmountOffItemsAndFreeShipping` initialize method"
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
79
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
80
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
81
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::CouponAmountOffItemsAndFreeShipping`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
82
|
+
end
|
|
83
|
+
h[k.to_sym] = v
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if attributes.key?(:'currency_code')
|
|
87
|
+
self.currency_code = attributes[:'currency_code']
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
if attributes.key?(:'discount_amount')
|
|
91
|
+
self.discount_amount = attributes[:'discount_amount']
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'item_tags')
|
|
95
|
+
if (value = attributes[:'item_tags']).is_a?(Array)
|
|
96
|
+
self.item_tags = value
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'items')
|
|
101
|
+
if (value = attributes[:'items']).is_a?(Array)
|
|
102
|
+
self.items = value
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if attributes.key?(:'limit')
|
|
107
|
+
self.limit = attributes[:'limit']
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:'shipping_methods')
|
|
111
|
+
if (value = attributes[:'shipping_methods']).is_a?(Array)
|
|
112
|
+
self.shipping_methods = value
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
118
|
+
# @return Array for valid properties with the reasons
|
|
119
|
+
def list_invalid_properties
|
|
120
|
+
invalid_properties = Array.new
|
|
121
|
+
if !@currency_code.nil? && @currency_code.to_s.length > 3
|
|
122
|
+
invalid_properties.push('invalid value for "currency_code", the character length must be smaller than or equal to 3.')
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
invalid_properties
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Check to see if the all the properties in the model are valid
|
|
129
|
+
# @return true if the model is valid
|
|
130
|
+
def valid?
|
|
131
|
+
return false if !@currency_code.nil? && @currency_code.to_s.length > 3
|
|
132
|
+
true
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Custom attribute writer method with validation
|
|
136
|
+
# @param [Object] currency_code Value to be assigned
|
|
137
|
+
def currency_code=(currency_code)
|
|
138
|
+
if !currency_code.nil? && currency_code.to_s.length > 3
|
|
139
|
+
fail ArgumentError, 'invalid value for "currency_code", the character length must be smaller than or equal to 3.'
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
@currency_code = currency_code
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Checks equality by comparing each attribute.
|
|
146
|
+
# @param [Object] Object to be compared
|
|
147
|
+
def ==(o)
|
|
148
|
+
return true if self.equal?(o)
|
|
149
|
+
self.class == o.class &&
|
|
150
|
+
currency_code == o.currency_code &&
|
|
151
|
+
discount_amount == o.discount_amount &&
|
|
152
|
+
item_tags == o.item_tags &&
|
|
153
|
+
items == o.items &&
|
|
154
|
+
limit == o.limit &&
|
|
155
|
+
shipping_methods == o.shipping_methods
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# @see the `==` method
|
|
159
|
+
# @param [Object] Object to be compared
|
|
160
|
+
def eql?(o)
|
|
161
|
+
self == o
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Calculates hash code according to all attributes.
|
|
165
|
+
# @return [Integer] Hash code
|
|
166
|
+
def hash
|
|
167
|
+
[currency_code, discount_amount, item_tags, items, limit, shipping_methods].hash
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Builds the object from hash
|
|
171
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
172
|
+
# @return [Object] Returns the model itself
|
|
173
|
+
def self.build_from_hash(attributes)
|
|
174
|
+
new.build_from_hash(attributes)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Builds the object from hash
|
|
178
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
179
|
+
# @return [Object] Returns the model itself
|
|
180
|
+
def build_from_hash(attributes)
|
|
181
|
+
return nil unless attributes.is_a?(Hash)
|
|
182
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
183
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
184
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
185
|
+
self.send("#{key}=", nil)
|
|
186
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
187
|
+
# check to ensure the input is an array given that the attribute
|
|
188
|
+
# is documented as an array but the input is not
|
|
189
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
190
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
191
|
+
end
|
|
192
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
193
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
self
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Deserializes the data based on type
|
|
201
|
+
# @param string type Data type
|
|
202
|
+
# @param string value Value to be deserialized
|
|
203
|
+
# @return [Object] Deserialized data
|
|
204
|
+
def _deserialize(type, value)
|
|
205
|
+
case type.to_sym
|
|
206
|
+
when :Time
|
|
207
|
+
Time.parse(value)
|
|
208
|
+
when :Date
|
|
209
|
+
Date.parse(value)
|
|
210
|
+
when :String
|
|
211
|
+
value.to_s
|
|
212
|
+
when :Integer
|
|
213
|
+
value.to_i
|
|
214
|
+
when :Float
|
|
215
|
+
value.to_f
|
|
216
|
+
when :Boolean
|
|
217
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
218
|
+
true
|
|
219
|
+
else
|
|
220
|
+
false
|
|
221
|
+
end
|
|
222
|
+
when :Object
|
|
223
|
+
# generic object (usually a Hash), return directly
|
|
224
|
+
value
|
|
225
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
226
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
227
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
228
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
229
|
+
k_type = Regexp.last_match[:k_type]
|
|
230
|
+
v_type = Regexp.last_match[:v_type]
|
|
231
|
+
{}.tap do |hash|
|
|
232
|
+
value.each do |k, v|
|
|
233
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
else # model
|
|
237
|
+
# models (e.g. Pet) or oneOf
|
|
238
|
+
klass = UltracartClient.const_get(type)
|
|
239
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# Returns the string representation of the object
|
|
244
|
+
# @return [String] String presentation of the object
|
|
245
|
+
def to_s
|
|
246
|
+
to_hash.to_s
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
250
|
+
# @return [Hash] Returns the object in the form of hash
|
|
251
|
+
def to_body
|
|
252
|
+
to_hash
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Returns the object in the form of hash
|
|
256
|
+
# @return [Hash] Returns the object in the form of hash
|
|
257
|
+
def to_hash
|
|
258
|
+
hash = {}
|
|
259
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
260
|
+
value = self.send(attr)
|
|
261
|
+
if value.nil?
|
|
262
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
263
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
hash[param] = _to_hash(value)
|
|
267
|
+
end
|
|
268
|
+
hash
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# Outputs non-array value in the form of hash
|
|
272
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
273
|
+
# @param [Object] value Any valid value
|
|
274
|
+
# @return [Hash] Returns the value in the form of hash
|
|
275
|
+
def _to_hash(value)
|
|
276
|
+
if value.is_a?(Array)
|
|
277
|
+
value.compact.map { |v| _to_hash(v) }
|
|
278
|
+
elsif value.is_a?(Hash)
|
|
279
|
+
{}.tap do |hash|
|
|
280
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
281
|
+
end
|
|
282
|
+
elsif value.respond_to? :to_hash
|
|
283
|
+
value.to_hash
|
|
284
|
+
else
|
|
285
|
+
value
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
end
|
data/lib/ultracart_api.rb
CHANGED
|
@@ -329,6 +329,7 @@ require 'ultracart_api/models/countries_response'
|
|
|
329
329
|
require 'ultracart_api/models/country'
|
|
330
330
|
require 'ultracart_api/models/coupon'
|
|
331
331
|
require 'ultracart_api/models/coupon_amount_off_items'
|
|
332
|
+
require 'ultracart_api/models/coupon_amount_off_items_and_free_shipping'
|
|
332
333
|
require 'ultracart_api/models/coupon_amount_off_shipping'
|
|
333
334
|
require 'ultracart_api/models/coupon_amount_off_shipping_with_items_purchase'
|
|
334
335
|
require 'ultracart_api/models/coupon_amount_off_subtotal'
|
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: 4.1.
|
|
4
|
+
version: 4.1.98
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- UltraCart
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: typhoeus
|
|
@@ -379,6 +379,7 @@ files:
|
|
|
379
379
|
- docs/Country.md
|
|
380
380
|
- docs/Coupon.md
|
|
381
381
|
- docs/CouponAmountOffItems.md
|
|
382
|
+
- docs/CouponAmountOffItemsAndFreeShipping.md
|
|
382
383
|
- docs/CouponAmountOffShipping.md
|
|
383
384
|
- docs/CouponAmountOffShippingWithItemsPurchase.md
|
|
384
385
|
- docs/CouponAmountOffSubtotal.md
|
|
@@ -1424,6 +1425,7 @@ files:
|
|
|
1424
1425
|
- lib/ultracart_api/models/country.rb
|
|
1425
1426
|
- lib/ultracart_api/models/coupon.rb
|
|
1426
1427
|
- lib/ultracart_api/models/coupon_amount_off_items.rb
|
|
1428
|
+
- lib/ultracart_api/models/coupon_amount_off_items_and_free_shipping.rb
|
|
1427
1429
|
- lib/ultracart_api/models/coupon_amount_off_shipping.rb
|
|
1428
1430
|
- lib/ultracart_api/models/coupon_amount_off_shipping_with_items_purchase.rb
|
|
1429
1431
|
- lib/ultracart_api/models/coupon_amount_off_subtotal.rb
|