helloextend_api_client 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +151 -0
- data/Rakefile +10 -0
- data/docs/Address.md +27 -0
- data/docs/Amount.md +19 -0
- data/docs/Contract.md +39 -0
- data/docs/ContractPlan.md +19 -0
- data/docs/ContractProduct.md +27 -0
- data/docs/ContractsApi.md +180 -0
- data/docs/Customer.md +23 -0
- data/docs/Error.md +19 -0
- data/docs/Invoice.md +27 -0
- data/docs/InvoiceDetails.md +19 -0
- data/docs/InvoiceDiscount.md +21 -0
- data/docs/InvoiceItems.md +31 -0
- data/docs/InvoiceMetadata.md +21 -0
- data/docs/InvoiceMetadataProduct.md +21 -0
- data/docs/InvoicePayee.md +23 -0
- data/docs/InvoicePayer.md +23 -0
- data/docs/Offer.md +17 -0
- data/docs/OfferPlan.md +23 -0
- data/docs/OfferPlanContract.md +27 -0
- data/docs/OffersApi.md +58 -0
- data/docs/Plan.md +21 -0
- data/docs/PlanDetails.md +21 -0
- data/docs/PlanPrices.md +21 -0
- data/docs/PlansApi.md +61 -0
- data/docs/PlansList.md +17 -0
- data/docs/Product.md +45 -0
- data/docs/ProductIdentifiers.md +25 -0
- data/docs/ProductMfrWarranty.md +21 -0
- data/docs/ProductsApi.md +241 -0
- data/git_push.sh +58 -0
- data/helloextend_api_client.gemspec +39 -0
- data/lib/helloextend_api_client.rb +68 -0
- data/lib/helloextend_api_client/api/contracts_api.rb +229 -0
- data/lib/helloextend_api_client/api/offers_api.rb +90 -0
- data/lib/helloextend_api_client/api/plans_api.rb +82 -0
- data/lib/helloextend_api_client/api/products_api.rb +298 -0
- data/lib/helloextend_api_client/api_client.rb +388 -0
- data/lib/helloextend_api_client/api_error.rb +57 -0
- data/lib/helloextend_api_client/configuration.rb +248 -0
- data/lib/helloextend_api_client/models/address.rb +259 -0
- data/lib/helloextend_api_client/models/amount.rb +217 -0
- data/lib/helloextend_api_client/models/contract.rb +378 -0
- data/lib/helloextend_api_client/models/contract_plan.rb +228 -0
- data/lib/helloextend_api_client/models/contract_product.rb +268 -0
- data/lib/helloextend_api_client/models/customer.rb +245 -0
- data/lib/helloextend_api_client/models/error.rb +225 -0
- data/lib/helloextend_api_client/models/invoice.rb +254 -0
- data/lib/helloextend_api_client/models/invoice_details.rb +216 -0
- data/lib/helloextend_api_client/models/invoice_discount.rb +226 -0
- data/lib/helloextend_api_client/models/invoice_items.rb +271 -0
- data/lib/helloextend_api_client/models/invoice_metadata.rb +226 -0
- data/lib/helloextend_api_client/models/invoice_metadata_product.rb +225 -0
- data/lib/helloextend_api_client/models/invoice_payee.rb +233 -0
- data/lib/helloextend_api_client/models/invoice_payer.rb +233 -0
- data/lib/helloextend_api_client/models/offer.rb +208 -0
- data/lib/helloextend_api_client/models/offer_plan.rb +236 -0
- data/lib/helloextend_api_client/models/offer_plan_contract.rb +258 -0
- data/lib/helloextend_api_client/models/plan.rb +225 -0
- data/lib/helloextend_api_client/models/plan_details.rb +227 -0
- data/lib/helloextend_api_client/models/plan_prices.rb +230 -0
- data/lib/helloextend_api_client/models/plans_list.rb +208 -0
- data/lib/helloextend_api_client/models/product.rb +429 -0
- data/lib/helloextend_api_client/models/product_identifiers.rb +247 -0
- data/lib/helloextend_api_client/models/product_mfr_warranty.rb +228 -0
- data/lib/helloextend_api_client/version.rb +15 -0
- data/spec/api/contracts_api_spec.rb +74 -0
- data/spec/api/offers_api_spec.rb +48 -0
- data/spec/api/plans_api_spec.rb +46 -0
- data/spec/api/products_api_spec.rb +88 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/address_spec.rb +71 -0
- data/spec/models/amount_spec.rb +47 -0
- data/spec/models/contract_plan_spec.rb +47 -0
- data/spec/models/contract_product_spec.rb +71 -0
- data/spec/models/contract_spec.rb +111 -0
- data/spec/models/customer_spec.rb +59 -0
- data/spec/models/error_spec.rb +47 -0
- data/spec/models/invoice_details_spec.rb +47 -0
- data/spec/models/invoice_discount_spec.rb +53 -0
- data/spec/models/invoice_items_spec.rb +83 -0
- data/spec/models/invoice_metadata_product_spec.rb +53 -0
- data/spec/models/invoice_metadata_spec.rb +53 -0
- data/spec/models/invoice_payee_spec.rb +59 -0
- data/spec/models/invoice_payer_spec.rb +59 -0
- data/spec/models/invoice_spec.rb +71 -0
- data/spec/models/offer_plan_contract_spec.rb +71 -0
- data/spec/models/offer_plan_spec.rb +59 -0
- data/spec/models/offer_spec.rb +41 -0
- data/spec/models/plan_details_spec.rb +53 -0
- data/spec/models/plan_prices_spec.rb +53 -0
- data/spec/models/plan_spec.rb +53 -0
- data/spec/models/plans_list_spec.rb +41 -0
- data/spec/models/product_identifiers_spec.rb +65 -0
- data/spec/models/product_mfr_warranty_spec.rb +53 -0
- data/spec/models/product_spec.rb +129 -0
- data/spec/spec_helper.rb +111 -0
- metadata +235 -0
@@ -0,0 +1,230 @@
|
|
1
|
+
=begin
|
2
|
+
#Extend API Reference
|
3
|
+
|
4
|
+
## Introduction Welcome to the Extend API Documentation! Our goal is to make your integration as clear and easy as possible, so if you have feedback or suggestions for our API or reference docs, [please let us know](mailto:devs@helloextend.com). If you are implementing the API for the first time, please use the latest \"2019-08-01\" API version. If you have already implemented the API and haven't specified a version, you are on the \"Default\" API version. #### You can get up and running with Extend with just 5 simple steps: * Create an account with Extend, and get an access token from your Extend merchant portal * Sync your store's products to Extend * Get the relevant Extend warranty SKUs and add them to your store * Add the JS SDK snippets to your store's website, which will enable warranty offers to be displayed in your store * Record warranty purchases with Extend so we can create a new contract and deliver it to the customer, or record warranty returns / refunds so we can cancel the contract and account for the refunded amount <div class='wrapper tip'><h2>Pro Tip! Keep your store's products up to date</h2><p>To make sure you are selling warranty plans on all eligible products (and not selling them on ineligible ones), it is best to keep your store's products in sync with Extend. If you update your products infrequently, it might be easiest to manually upload or edit products in your merchant portal. If you do update frequently, though, consider integrating with our Products API resource.</p><p>Need help? <a href='mailto:devs@helloextend.com'>Contact us!</a> We love to help!</p></div>
|
5
|
+
|
6
|
+
The version of the OpenAPI document: Default
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module HelloextendApiClient
|
16
|
+
# A table that helps define the set of possible price points at which a warranty plan can be sold
|
17
|
+
class PlanPrices
|
18
|
+
# The minimum price allowed for the warranty plan offered, in the base unit (i.e. cents) with no currency code
|
19
|
+
attr_accessor :min
|
20
|
+
|
21
|
+
# The maximum price for the warranty plan offered, in the base unit (i.e. cents) with no currency code
|
22
|
+
attr_accessor :max
|
23
|
+
|
24
|
+
# A list of all possible rounded price points at which the warranty plan could be offered. If your system does not allow dynamic pricing on the product page and in the cart, then create a seperate warranty plan SKU for each price point
|
25
|
+
attr_accessor :points
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
:'min' => :'min',
|
31
|
+
:'max' => :'max',
|
32
|
+
:'points' => :'points'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute type mapping.
|
37
|
+
def self.openapi_types
|
38
|
+
{
|
39
|
+
:'min' => :'Integer',
|
40
|
+
:'max' => :'Integer',
|
41
|
+
:'points' => :'Array<Integer>'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# List of attributes with nullable: true
|
46
|
+
def self.openapi_nullable
|
47
|
+
Set.new([
|
48
|
+
])
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
if (!attributes.is_a?(Hash))
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `HelloextendApiClient::PlanPrices` initialize method"
|
56
|
+
end
|
57
|
+
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
60
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `HelloextendApiClient::PlanPrices`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
62
|
+
end
|
63
|
+
h[k.to_sym] = v
|
64
|
+
}
|
65
|
+
|
66
|
+
if attributes.key?(:'min')
|
67
|
+
self.min = attributes[:'min']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:'max')
|
71
|
+
self.max = attributes[:'max']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'points')
|
75
|
+
if (value = attributes[:'points']).is_a?(Array)
|
76
|
+
self.points = value
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
82
|
+
# @return Array for valid properties with the reasons
|
83
|
+
def list_invalid_properties
|
84
|
+
invalid_properties = Array.new
|
85
|
+
invalid_properties
|
86
|
+
end
|
87
|
+
|
88
|
+
# Check to see if the all the properties in the model are valid
|
89
|
+
# @return true if the model is valid
|
90
|
+
def valid?
|
91
|
+
true
|
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
|
+
min == o.min &&
|
100
|
+
max == o.max &&
|
101
|
+
points == o.points
|
102
|
+
end
|
103
|
+
|
104
|
+
# @see the `==` method
|
105
|
+
# @param [Object] Object to be compared
|
106
|
+
def eql?(o)
|
107
|
+
self == o
|
108
|
+
end
|
109
|
+
|
110
|
+
# Calculates hash code according to all attributes.
|
111
|
+
# @return [Integer] Hash code
|
112
|
+
def hash
|
113
|
+
[min, max, points].hash
|
114
|
+
end
|
115
|
+
|
116
|
+
# Builds the object from hash
|
117
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
118
|
+
# @return [Object] Returns the model itself
|
119
|
+
def self.build_from_hash(attributes)
|
120
|
+
new.build_from_hash(attributes)
|
121
|
+
end
|
122
|
+
|
123
|
+
# Builds the object from hash
|
124
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
125
|
+
# @return [Object] Returns the model itself
|
126
|
+
def build_from_hash(attributes)
|
127
|
+
return nil unless attributes.is_a?(Hash)
|
128
|
+
self.class.openapi_types.each_pair do |key, type|
|
129
|
+
if type =~ /\AArray<(.*)>/i
|
130
|
+
# check to ensure the input is an array given that the attribute
|
131
|
+
# is documented as an array but the input is not
|
132
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
133
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
134
|
+
end
|
135
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
136
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
137
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
138
|
+
end
|
139
|
+
|
140
|
+
self
|
141
|
+
end
|
142
|
+
|
143
|
+
# Deserializes the data based on type
|
144
|
+
# @param string type Data type
|
145
|
+
# @param string value Value to be deserialized
|
146
|
+
# @return [Object] Deserialized data
|
147
|
+
def _deserialize(type, value)
|
148
|
+
case type.to_sym
|
149
|
+
when :DateTime
|
150
|
+
DateTime.parse(value)
|
151
|
+
when :Date
|
152
|
+
Date.parse(value)
|
153
|
+
when :String
|
154
|
+
value.to_s
|
155
|
+
when :Integer
|
156
|
+
value.to_i
|
157
|
+
when :Float
|
158
|
+
value.to_f
|
159
|
+
when :Boolean
|
160
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
161
|
+
true
|
162
|
+
else
|
163
|
+
false
|
164
|
+
end
|
165
|
+
when :Object
|
166
|
+
# generic object (usually a Hash), return directly
|
167
|
+
value
|
168
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
169
|
+
inner_type = Regexp.last_match[:inner_type]
|
170
|
+
value.map { |v| _deserialize(inner_type, v) }
|
171
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
172
|
+
k_type = Regexp.last_match[:k_type]
|
173
|
+
v_type = Regexp.last_match[:v_type]
|
174
|
+
{}.tap do |hash|
|
175
|
+
value.each do |k, v|
|
176
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
else # model
|
180
|
+
HelloextendApiClient.const_get(type).build_from_hash(value)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# Returns the string representation of the object
|
185
|
+
# @return [String] String presentation of the object
|
186
|
+
def to_s
|
187
|
+
to_hash.to_s
|
188
|
+
end
|
189
|
+
|
190
|
+
# to_body is an alias to to_hash (backward compatibility)
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_body
|
193
|
+
to_hash
|
194
|
+
end
|
195
|
+
|
196
|
+
# Returns the object in the form of hash
|
197
|
+
# @return [Hash] Returns the object in the form of hash
|
198
|
+
def to_hash
|
199
|
+
hash = {}
|
200
|
+
self.class.attribute_map.each_pair do |attr, param|
|
201
|
+
value = self.send(attr)
|
202
|
+
if value.nil?
|
203
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
204
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
205
|
+
end
|
206
|
+
|
207
|
+
hash[param] = _to_hash(value)
|
208
|
+
end
|
209
|
+
hash
|
210
|
+
end
|
211
|
+
|
212
|
+
# Outputs non-array value in the form of hash
|
213
|
+
# For object, use to_hash. Otherwise, just return the value
|
214
|
+
# @param [Object] value Any valid value
|
215
|
+
# @return [Hash] Returns the value in the form of hash
|
216
|
+
def _to_hash(value)
|
217
|
+
if value.is_a?(Array)
|
218
|
+
value.compact.map { |v| _to_hash(v) }
|
219
|
+
elsif value.is_a?(Hash)
|
220
|
+
{}.tap do |hash|
|
221
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
222
|
+
end
|
223
|
+
elsif value.respond_to? :to_hash
|
224
|
+
value.to_hash
|
225
|
+
else
|
226
|
+
value
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
@@ -0,0 +1,208 @@
|
|
1
|
+
=begin
|
2
|
+
#Extend API Reference
|
3
|
+
|
4
|
+
## Introduction Welcome to the Extend API Documentation! Our goal is to make your integration as clear and easy as possible, so if you have feedback or suggestions for our API or reference docs, [please let us know](mailto:devs@helloextend.com). If you are implementing the API for the first time, please use the latest \"2019-08-01\" API version. If you have already implemented the API and haven't specified a version, you are on the \"Default\" API version. #### You can get up and running with Extend with just 5 simple steps: * Create an account with Extend, and get an access token from your Extend merchant portal * Sync your store's products to Extend * Get the relevant Extend warranty SKUs and add them to your store * Add the JS SDK snippets to your store's website, which will enable warranty offers to be displayed in your store * Record warranty purchases with Extend so we can create a new contract and deliver it to the customer, or record warranty returns / refunds so we can cancel the contract and account for the refunded amount <div class='wrapper tip'><h2>Pro Tip! Keep your store's products up to date</h2><p>To make sure you are selling warranty plans on all eligible products (and not selling them on ineligible ones), it is best to keep your store's products in sync with Extend. If you update your products infrequently, it might be easiest to manually upload or edit products in your merchant portal. If you do update frequently, though, consider integrating with our Products API resource.</p><p>Need help? <a href='mailto:devs@helloextend.com'>Contact us!</a> We love to help!</p></div>
|
5
|
+
|
6
|
+
The version of the OpenAPI document: Default
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module HelloextendApiClient
|
16
|
+
class PlansList
|
17
|
+
attr_accessor :plans
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'plans' => :'plans'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Attribute type mapping.
|
27
|
+
def self.openapi_types
|
28
|
+
{
|
29
|
+
:'plans' => :'Array<Plan>'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# List of attributes with nullable: true
|
34
|
+
def self.openapi_nullable
|
35
|
+
Set.new([
|
36
|
+
])
|
37
|
+
end
|
38
|
+
|
39
|
+
# Initializes the object
|
40
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
41
|
+
def initialize(attributes = {})
|
42
|
+
if (!attributes.is_a?(Hash))
|
43
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `HelloextendApiClient::PlansList` initialize method"
|
44
|
+
end
|
45
|
+
|
46
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
47
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
48
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
49
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `HelloextendApiClient::PlansList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
50
|
+
end
|
51
|
+
h[k.to_sym] = v
|
52
|
+
}
|
53
|
+
|
54
|
+
if attributes.key?(:'plans')
|
55
|
+
if (value = attributes[:'plans']).is_a?(Array)
|
56
|
+
self.plans = value
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
+
# @return Array for valid properties with the reasons
|
63
|
+
def list_invalid_properties
|
64
|
+
invalid_properties = Array.new
|
65
|
+
invalid_properties
|
66
|
+
end
|
67
|
+
|
68
|
+
# Check to see if the all the properties in the model are valid
|
69
|
+
# @return true if the model is valid
|
70
|
+
def valid?
|
71
|
+
true
|
72
|
+
end
|
73
|
+
|
74
|
+
# Checks equality by comparing each attribute.
|
75
|
+
# @param [Object] Object to be compared
|
76
|
+
def ==(o)
|
77
|
+
return true if self.equal?(o)
|
78
|
+
self.class == o.class &&
|
79
|
+
plans == o.plans
|
80
|
+
end
|
81
|
+
|
82
|
+
# @see the `==` method
|
83
|
+
# @param [Object] Object to be compared
|
84
|
+
def eql?(o)
|
85
|
+
self == o
|
86
|
+
end
|
87
|
+
|
88
|
+
# Calculates hash code according to all attributes.
|
89
|
+
# @return [Integer] Hash code
|
90
|
+
def hash
|
91
|
+
[plans].hash
|
92
|
+
end
|
93
|
+
|
94
|
+
# Builds the object from hash
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
# @return [Object] Returns the model itself
|
97
|
+
def self.build_from_hash(attributes)
|
98
|
+
new.build_from_hash(attributes)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Builds the object from hash
|
102
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
103
|
+
# @return [Object] Returns the model itself
|
104
|
+
def build_from_hash(attributes)
|
105
|
+
return nil unless attributes.is_a?(Hash)
|
106
|
+
self.class.openapi_types.each_pair do |key, type|
|
107
|
+
if type =~ /\AArray<(.*)>/i
|
108
|
+
# check to ensure the input is an array given that the attribute
|
109
|
+
# is documented as an array but the input is not
|
110
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
111
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
112
|
+
end
|
113
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
114
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
115
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
116
|
+
end
|
117
|
+
|
118
|
+
self
|
119
|
+
end
|
120
|
+
|
121
|
+
# Deserializes the data based on type
|
122
|
+
# @param string type Data type
|
123
|
+
# @param string value Value to be deserialized
|
124
|
+
# @return [Object] Deserialized data
|
125
|
+
def _deserialize(type, value)
|
126
|
+
case type.to_sym
|
127
|
+
when :DateTime
|
128
|
+
DateTime.parse(value)
|
129
|
+
when :Date
|
130
|
+
Date.parse(value)
|
131
|
+
when :String
|
132
|
+
value.to_s
|
133
|
+
when :Integer
|
134
|
+
value.to_i
|
135
|
+
when :Float
|
136
|
+
value.to_f
|
137
|
+
when :Boolean
|
138
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
139
|
+
true
|
140
|
+
else
|
141
|
+
false
|
142
|
+
end
|
143
|
+
when :Object
|
144
|
+
# generic object (usually a Hash), return directly
|
145
|
+
value
|
146
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
147
|
+
inner_type = Regexp.last_match[:inner_type]
|
148
|
+
value.map { |v| _deserialize(inner_type, v) }
|
149
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
150
|
+
k_type = Regexp.last_match[:k_type]
|
151
|
+
v_type = Regexp.last_match[:v_type]
|
152
|
+
{}.tap do |hash|
|
153
|
+
value.each do |k, v|
|
154
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
else # model
|
158
|
+
HelloextendApiClient.const_get(type).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
|
+
if value.nil?
|
181
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
182
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
183
|
+
end
|
184
|
+
|
185
|
+
hash[param] = _to_hash(value)
|
186
|
+
end
|
187
|
+
hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Outputs non-array value in the form of hash
|
191
|
+
# For object, use to_hash. Otherwise, just return the value
|
192
|
+
# @param [Object] value Any valid value
|
193
|
+
# @return [Hash] Returns the value in the form of hash
|
194
|
+
def _to_hash(value)
|
195
|
+
if value.is_a?(Array)
|
196
|
+
value.compact.map { |v| _to_hash(v) }
|
197
|
+
elsif value.is_a?(Hash)
|
198
|
+
{}.tap do |hash|
|
199
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
200
|
+
end
|
201
|
+
elsif value.respond_to? :to_hash
|
202
|
+
value.to_hash
|
203
|
+
else
|
204
|
+
value
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
@@ -0,0 +1,429 @@
|
|
1
|
+
=begin
|
2
|
+
#Extend API Reference
|
3
|
+
|
4
|
+
## Introduction Welcome to the Extend API Documentation! Our goal is to make your integration as clear and easy as possible, so if you have feedback or suggestions for our API or reference docs, [please let us know](mailto:devs@helloextend.com). If you are implementing the API for the first time, please use the latest \"2019-08-01\" API version. If you have already implemented the API and haven't specified a version, you are on the \"Default\" API version. #### You can get up and running with Extend with just 5 simple steps: * Create an account with Extend, and get an access token from your Extend merchant portal * Sync your store's products to Extend * Get the relevant Extend warranty SKUs and add them to your store * Add the JS SDK snippets to your store's website, which will enable warranty offers to be displayed in your store * Record warranty purchases with Extend so we can create a new contract and deliver it to the customer, or record warranty returns / refunds so we can cancel the contract and account for the refunded amount <div class='wrapper tip'><h2>Pro Tip! Keep your store's products up to date</h2><p>To make sure you are selling warranty plans on all eligible products (and not selling them on ineligible ones), it is best to keep your store's products in sync with Extend. If you update your products infrequently, it might be easiest to manually upload or edit products in your merchant portal. If you do update frequently, though, consider integrating with our Products API resource.</p><p>Need help? <a href='mailto:devs@helloextend.com'>Contact us!</a> We love to help!</p></div>
|
5
|
+
|
6
|
+
The version of the OpenAPI document: Default
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module HelloextendApiClient
|
16
|
+
class Product
|
17
|
+
# Product Brand, Manufacturer or Vendor
|
18
|
+
attr_accessor :brand
|
19
|
+
|
20
|
+
# Product category. Can be any value and may be used by Extend to map the product to warranty plans.
|
21
|
+
attr_accessor :category
|
22
|
+
|
23
|
+
# The timestamp when the object was created (internal)
|
24
|
+
attr_accessor :created_at
|
25
|
+
|
26
|
+
# Product description
|
27
|
+
attr_accessor :description
|
28
|
+
|
29
|
+
# Enable/disable selling of warranties on this product
|
30
|
+
attr_accessor :enabled
|
31
|
+
|
32
|
+
# A url pointing to the primary image for the product
|
33
|
+
attr_accessor :image_url
|
34
|
+
|
35
|
+
attr_accessor :mfr_warranty
|
36
|
+
|
37
|
+
# The base retail price of the product (in cents)
|
38
|
+
attr_accessor :price
|
39
|
+
|
40
|
+
# Product name
|
41
|
+
attr_accessor :title
|
42
|
+
|
43
|
+
# The timestamp when the object was last updated (internal)
|
44
|
+
attr_accessor :updated_at
|
45
|
+
|
46
|
+
attr_accessor :status
|
47
|
+
|
48
|
+
# This is the unique identifier that identifies the product. This can be a product SKU, or variant id.
|
49
|
+
attr_accessor :reference_id
|
50
|
+
|
51
|
+
# This is the id of the parent product, if there is one. This allows nesting of a single parent product with multiple variants (such as multiple color options for the same product)
|
52
|
+
attr_accessor :parent_reference_id
|
53
|
+
|
54
|
+
# A list of all extended warranty plans for which the product is eligible, listed by planId. The Offers SDK or Offers API will provide more detail about which plan options to display for a given product at a given time.
|
55
|
+
attr_accessor :plans
|
56
|
+
|
57
|
+
attr_accessor :identifiers
|
58
|
+
|
59
|
+
class EnumAttributeValidator
|
60
|
+
attr_reader :datatype
|
61
|
+
attr_reader :allowable_values
|
62
|
+
|
63
|
+
def initialize(datatype, allowable_values)
|
64
|
+
@allowable_values = allowable_values.map do |value|
|
65
|
+
case datatype.to_s
|
66
|
+
when /Integer/i
|
67
|
+
value.to_i
|
68
|
+
when /Float/i
|
69
|
+
value.to_f
|
70
|
+
else
|
71
|
+
value
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def valid?(value)
|
77
|
+
!value || allowable_values.include?(value)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
82
|
+
def self.attribute_map
|
83
|
+
{
|
84
|
+
:'brand' => :'brand',
|
85
|
+
:'category' => :'category',
|
86
|
+
:'created_at' => :'createdAt',
|
87
|
+
:'description' => :'description',
|
88
|
+
:'enabled' => :'enabled',
|
89
|
+
:'image_url' => :'imageUrl',
|
90
|
+
:'mfr_warranty' => :'mfrWarranty',
|
91
|
+
:'price' => :'price',
|
92
|
+
:'title' => :'title',
|
93
|
+
:'updated_at' => :'updatedAt',
|
94
|
+
:'status' => :'status',
|
95
|
+
:'reference_id' => :'referenceId',
|
96
|
+
:'parent_reference_id' => :'parentReferenceId',
|
97
|
+
:'plans' => :'plans',
|
98
|
+
:'identifiers' => :'identifiers'
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
102
|
+
# Attribute type mapping.
|
103
|
+
def self.openapi_types
|
104
|
+
{
|
105
|
+
:'brand' => :'String',
|
106
|
+
:'category' => :'String',
|
107
|
+
:'created_at' => :'Float',
|
108
|
+
:'description' => :'String',
|
109
|
+
:'enabled' => :'Boolean',
|
110
|
+
:'image_url' => :'String',
|
111
|
+
:'mfr_warranty' => :'ProductMfrWarranty',
|
112
|
+
:'price' => :'Float',
|
113
|
+
:'title' => :'String',
|
114
|
+
:'updated_at' => :'Float',
|
115
|
+
:'status' => :'String',
|
116
|
+
:'reference_id' => :'String',
|
117
|
+
:'parent_reference_id' => :'String',
|
118
|
+
:'plans' => :'Array<String>',
|
119
|
+
:'identifiers' => :'ProductIdentifiers'
|
120
|
+
}
|
121
|
+
end
|
122
|
+
|
123
|
+
# List of attributes with nullable: true
|
124
|
+
def self.openapi_nullable
|
125
|
+
Set.new([
|
126
|
+
])
|
127
|
+
end
|
128
|
+
|
129
|
+
# Initializes the object
|
130
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
131
|
+
def initialize(attributes = {})
|
132
|
+
if (!attributes.is_a?(Hash))
|
133
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `HelloextendApiClient::Product` initialize method"
|
134
|
+
end
|
135
|
+
|
136
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
137
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
138
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
139
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `HelloextendApiClient::Product`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
140
|
+
end
|
141
|
+
h[k.to_sym] = v
|
142
|
+
}
|
143
|
+
|
144
|
+
if attributes.key?(:'brand')
|
145
|
+
self.brand = attributes[:'brand']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.key?(:'category')
|
149
|
+
self.category = attributes[:'category']
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.key?(:'created_at')
|
153
|
+
self.created_at = attributes[:'created_at']
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.key?(:'description')
|
157
|
+
self.description = attributes[:'description']
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes.key?(:'enabled')
|
161
|
+
self.enabled = attributes[:'enabled']
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.key?(:'image_url')
|
165
|
+
self.image_url = attributes[:'image_url']
|
166
|
+
end
|
167
|
+
|
168
|
+
if attributes.key?(:'mfr_warranty')
|
169
|
+
self.mfr_warranty = attributes[:'mfr_warranty']
|
170
|
+
end
|
171
|
+
|
172
|
+
if attributes.key?(:'price')
|
173
|
+
self.price = attributes[:'price']
|
174
|
+
end
|
175
|
+
|
176
|
+
if attributes.key?(:'title')
|
177
|
+
self.title = attributes[:'title']
|
178
|
+
end
|
179
|
+
|
180
|
+
if attributes.key?(:'updated_at')
|
181
|
+
self.updated_at = attributes[:'updated_at']
|
182
|
+
end
|
183
|
+
|
184
|
+
if attributes.key?(:'status')
|
185
|
+
self.status = attributes[:'status']
|
186
|
+
end
|
187
|
+
|
188
|
+
if attributes.key?(:'reference_id')
|
189
|
+
self.reference_id = attributes[:'reference_id']
|
190
|
+
end
|
191
|
+
|
192
|
+
if attributes.key?(:'parent_reference_id')
|
193
|
+
self.parent_reference_id = attributes[:'parent_reference_id']
|
194
|
+
end
|
195
|
+
|
196
|
+
if attributes.key?(:'plans')
|
197
|
+
if (value = attributes[:'plans']).is_a?(Array)
|
198
|
+
self.plans = value
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
if attributes.key?(:'identifiers')
|
203
|
+
self.identifiers = attributes[:'identifiers']
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
208
|
+
# @return Array for valid properties with the reasons
|
209
|
+
def list_invalid_properties
|
210
|
+
invalid_properties = Array.new
|
211
|
+
if !@description.nil? && @description.to_s.length > 2000
|
212
|
+
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 2000.')
|
213
|
+
end
|
214
|
+
|
215
|
+
if @price.nil?
|
216
|
+
invalid_properties.push('invalid value for "price", price cannot be nil.')
|
217
|
+
end
|
218
|
+
|
219
|
+
if @title.nil?
|
220
|
+
invalid_properties.push('invalid value for "title", title cannot be nil.')
|
221
|
+
end
|
222
|
+
|
223
|
+
if @title.to_s.length > 255
|
224
|
+
invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 255.')
|
225
|
+
end
|
226
|
+
|
227
|
+
if @reference_id.nil?
|
228
|
+
invalid_properties.push('invalid value for "reference_id", reference_id cannot be nil.')
|
229
|
+
end
|
230
|
+
|
231
|
+
invalid_properties
|
232
|
+
end
|
233
|
+
|
234
|
+
# Check to see if the all the properties in the model are valid
|
235
|
+
# @return true if the model is valid
|
236
|
+
def valid?
|
237
|
+
return false if !@description.nil? && @description.to_s.length > 2000
|
238
|
+
return false if @price.nil?
|
239
|
+
return false if @title.nil?
|
240
|
+
return false if @title.to_s.length > 255
|
241
|
+
status_validator = EnumAttributeValidator.new('String', ["new", "updated", "active", "inactive"])
|
242
|
+
return false unless status_validator.valid?(@status)
|
243
|
+
return false if @reference_id.nil?
|
244
|
+
true
|
245
|
+
end
|
246
|
+
|
247
|
+
# Custom attribute writer method with validation
|
248
|
+
# @param [Object] description Value to be assigned
|
249
|
+
def description=(description)
|
250
|
+
if !description.nil? && description.to_s.length > 2000
|
251
|
+
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 2000.'
|
252
|
+
end
|
253
|
+
|
254
|
+
@description = description
|
255
|
+
end
|
256
|
+
|
257
|
+
# Custom attribute writer method with validation
|
258
|
+
# @param [Object] title Value to be assigned
|
259
|
+
def title=(title)
|
260
|
+
if title.nil?
|
261
|
+
fail ArgumentError, 'title cannot be nil'
|
262
|
+
end
|
263
|
+
|
264
|
+
if title.to_s.length > 255
|
265
|
+
fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 255.'
|
266
|
+
end
|
267
|
+
|
268
|
+
@title = title
|
269
|
+
end
|
270
|
+
|
271
|
+
# Custom attribute writer method checking allowed values (enum).
|
272
|
+
# @param [Object] status Object to be assigned
|
273
|
+
def status=(status)
|
274
|
+
validator = EnumAttributeValidator.new('String', ["new", "updated", "active", "inactive"])
|
275
|
+
unless validator.valid?(status)
|
276
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
277
|
+
end
|
278
|
+
@status = status
|
279
|
+
end
|
280
|
+
|
281
|
+
# Checks equality by comparing each attribute.
|
282
|
+
# @param [Object] Object to be compared
|
283
|
+
def ==(o)
|
284
|
+
return true if self.equal?(o)
|
285
|
+
self.class == o.class &&
|
286
|
+
brand == o.brand &&
|
287
|
+
category == o.category &&
|
288
|
+
created_at == o.created_at &&
|
289
|
+
description == o.description &&
|
290
|
+
enabled == o.enabled &&
|
291
|
+
image_url == o.image_url &&
|
292
|
+
mfr_warranty == o.mfr_warranty &&
|
293
|
+
price == o.price &&
|
294
|
+
title == o.title &&
|
295
|
+
updated_at == o.updated_at &&
|
296
|
+
status == o.status &&
|
297
|
+
reference_id == o.reference_id &&
|
298
|
+
parent_reference_id == o.parent_reference_id &&
|
299
|
+
plans == o.plans &&
|
300
|
+
identifiers == o.identifiers
|
301
|
+
end
|
302
|
+
|
303
|
+
# @see the `==` method
|
304
|
+
# @param [Object] Object to be compared
|
305
|
+
def eql?(o)
|
306
|
+
self == o
|
307
|
+
end
|
308
|
+
|
309
|
+
# Calculates hash code according to all attributes.
|
310
|
+
# @return [Integer] Hash code
|
311
|
+
def hash
|
312
|
+
[brand, category, created_at, description, enabled, image_url, mfr_warranty, price, title, updated_at, status, reference_id, parent_reference_id, plans, identifiers].hash
|
313
|
+
end
|
314
|
+
|
315
|
+
# Builds the object from hash
|
316
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
317
|
+
# @return [Object] Returns the model itself
|
318
|
+
def self.build_from_hash(attributes)
|
319
|
+
new.build_from_hash(attributes)
|
320
|
+
end
|
321
|
+
|
322
|
+
# Builds the object from hash
|
323
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
324
|
+
# @return [Object] Returns the model itself
|
325
|
+
def build_from_hash(attributes)
|
326
|
+
return nil unless attributes.is_a?(Hash)
|
327
|
+
self.class.openapi_types.each_pair do |key, type|
|
328
|
+
if type =~ /\AArray<(.*)>/i
|
329
|
+
# check to ensure the input is an array given that the attribute
|
330
|
+
# is documented as an array but the input is not
|
331
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
332
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
333
|
+
end
|
334
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
335
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
336
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
337
|
+
end
|
338
|
+
|
339
|
+
self
|
340
|
+
end
|
341
|
+
|
342
|
+
# Deserializes the data based on type
|
343
|
+
# @param string type Data type
|
344
|
+
# @param string value Value to be deserialized
|
345
|
+
# @return [Object] Deserialized data
|
346
|
+
def _deserialize(type, value)
|
347
|
+
case type.to_sym
|
348
|
+
when :DateTime
|
349
|
+
DateTime.parse(value)
|
350
|
+
when :Date
|
351
|
+
Date.parse(value)
|
352
|
+
when :String
|
353
|
+
value.to_s
|
354
|
+
when :Integer
|
355
|
+
value.to_i
|
356
|
+
when :Float
|
357
|
+
value.to_f
|
358
|
+
when :Boolean
|
359
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
360
|
+
true
|
361
|
+
else
|
362
|
+
false
|
363
|
+
end
|
364
|
+
when :Object
|
365
|
+
# generic object (usually a Hash), return directly
|
366
|
+
value
|
367
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
368
|
+
inner_type = Regexp.last_match[:inner_type]
|
369
|
+
value.map { |v| _deserialize(inner_type, v) }
|
370
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
371
|
+
k_type = Regexp.last_match[:k_type]
|
372
|
+
v_type = Regexp.last_match[:v_type]
|
373
|
+
{}.tap do |hash|
|
374
|
+
value.each do |k, v|
|
375
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
376
|
+
end
|
377
|
+
end
|
378
|
+
else # model
|
379
|
+
HelloextendApiClient.const_get(type).build_from_hash(value)
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
# Returns the string representation of the object
|
384
|
+
# @return [String] String presentation of the object
|
385
|
+
def to_s
|
386
|
+
to_hash.to_s
|
387
|
+
end
|
388
|
+
|
389
|
+
# to_body is an alias to to_hash (backward compatibility)
|
390
|
+
# @return [Hash] Returns the object in the form of hash
|
391
|
+
def to_body
|
392
|
+
to_hash
|
393
|
+
end
|
394
|
+
|
395
|
+
# Returns the object in the form of hash
|
396
|
+
# @return [Hash] Returns the object in the form of hash
|
397
|
+
def to_hash
|
398
|
+
hash = {}
|
399
|
+
self.class.attribute_map.each_pair do |attr, param|
|
400
|
+
value = self.send(attr)
|
401
|
+
if value.nil?
|
402
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
403
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
404
|
+
end
|
405
|
+
|
406
|
+
hash[param] = _to_hash(value)
|
407
|
+
end
|
408
|
+
hash
|
409
|
+
end
|
410
|
+
|
411
|
+
# Outputs non-array value in the form of hash
|
412
|
+
# For object, use to_hash. Otherwise, just return the value
|
413
|
+
# @param [Object] value Any valid value
|
414
|
+
# @return [Hash] Returns the value in the form of hash
|
415
|
+
def _to_hash(value)
|
416
|
+
if value.is_a?(Array)
|
417
|
+
value.compact.map { |v| _to_hash(v) }
|
418
|
+
elsif value.is_a?(Hash)
|
419
|
+
{}.tap do |hash|
|
420
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
421
|
+
end
|
422
|
+
elsif value.respond_to? :to_hash
|
423
|
+
value.to_hash
|
424
|
+
else
|
425
|
+
value
|
426
|
+
end
|
427
|
+
end
|
428
|
+
end
|
429
|
+
end
|