helloextend_api_client 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +151 -0
  4. data/Rakefile +10 -0
  5. data/docs/Address.md +27 -0
  6. data/docs/Amount.md +19 -0
  7. data/docs/Contract.md +39 -0
  8. data/docs/ContractPlan.md +19 -0
  9. data/docs/ContractProduct.md +27 -0
  10. data/docs/ContractsApi.md +180 -0
  11. data/docs/Customer.md +23 -0
  12. data/docs/Error.md +19 -0
  13. data/docs/Invoice.md +27 -0
  14. data/docs/InvoiceDetails.md +19 -0
  15. data/docs/InvoiceDiscount.md +21 -0
  16. data/docs/InvoiceItems.md +31 -0
  17. data/docs/InvoiceMetadata.md +21 -0
  18. data/docs/InvoiceMetadataProduct.md +21 -0
  19. data/docs/InvoicePayee.md +23 -0
  20. data/docs/InvoicePayer.md +23 -0
  21. data/docs/Offer.md +17 -0
  22. data/docs/OfferPlan.md +23 -0
  23. data/docs/OfferPlanContract.md +27 -0
  24. data/docs/OffersApi.md +58 -0
  25. data/docs/Plan.md +21 -0
  26. data/docs/PlanDetails.md +21 -0
  27. data/docs/PlanPrices.md +21 -0
  28. data/docs/PlansApi.md +61 -0
  29. data/docs/PlansList.md +17 -0
  30. data/docs/Product.md +45 -0
  31. data/docs/ProductIdentifiers.md +25 -0
  32. data/docs/ProductMfrWarranty.md +21 -0
  33. data/docs/ProductsApi.md +241 -0
  34. data/git_push.sh +58 -0
  35. data/helloextend_api_client.gemspec +39 -0
  36. data/lib/helloextend_api_client.rb +68 -0
  37. data/lib/helloextend_api_client/api/contracts_api.rb +229 -0
  38. data/lib/helloextend_api_client/api/offers_api.rb +90 -0
  39. data/lib/helloextend_api_client/api/plans_api.rb +82 -0
  40. data/lib/helloextend_api_client/api/products_api.rb +298 -0
  41. data/lib/helloextend_api_client/api_client.rb +388 -0
  42. data/lib/helloextend_api_client/api_error.rb +57 -0
  43. data/lib/helloextend_api_client/configuration.rb +248 -0
  44. data/lib/helloextend_api_client/models/address.rb +259 -0
  45. data/lib/helloextend_api_client/models/amount.rb +217 -0
  46. data/lib/helloextend_api_client/models/contract.rb +378 -0
  47. data/lib/helloextend_api_client/models/contract_plan.rb +228 -0
  48. data/lib/helloextend_api_client/models/contract_product.rb +268 -0
  49. data/lib/helloextend_api_client/models/customer.rb +245 -0
  50. data/lib/helloextend_api_client/models/error.rb +225 -0
  51. data/lib/helloextend_api_client/models/invoice.rb +254 -0
  52. data/lib/helloextend_api_client/models/invoice_details.rb +216 -0
  53. data/lib/helloextend_api_client/models/invoice_discount.rb +226 -0
  54. data/lib/helloextend_api_client/models/invoice_items.rb +271 -0
  55. data/lib/helloextend_api_client/models/invoice_metadata.rb +226 -0
  56. data/lib/helloextend_api_client/models/invoice_metadata_product.rb +225 -0
  57. data/lib/helloextend_api_client/models/invoice_payee.rb +233 -0
  58. data/lib/helloextend_api_client/models/invoice_payer.rb +233 -0
  59. data/lib/helloextend_api_client/models/offer.rb +208 -0
  60. data/lib/helloextend_api_client/models/offer_plan.rb +236 -0
  61. data/lib/helloextend_api_client/models/offer_plan_contract.rb +258 -0
  62. data/lib/helloextend_api_client/models/plan.rb +225 -0
  63. data/lib/helloextend_api_client/models/plan_details.rb +227 -0
  64. data/lib/helloextend_api_client/models/plan_prices.rb +230 -0
  65. data/lib/helloextend_api_client/models/plans_list.rb +208 -0
  66. data/lib/helloextend_api_client/models/product.rb +429 -0
  67. data/lib/helloextend_api_client/models/product_identifiers.rb +247 -0
  68. data/lib/helloextend_api_client/models/product_mfr_warranty.rb +228 -0
  69. data/lib/helloextend_api_client/version.rb +15 -0
  70. data/spec/api/contracts_api_spec.rb +74 -0
  71. data/spec/api/offers_api_spec.rb +48 -0
  72. data/spec/api/plans_api_spec.rb +46 -0
  73. data/spec/api/products_api_spec.rb +88 -0
  74. data/spec/api_client_spec.rb +226 -0
  75. data/spec/configuration_spec.rb +42 -0
  76. data/spec/models/address_spec.rb +71 -0
  77. data/spec/models/amount_spec.rb +47 -0
  78. data/spec/models/contract_plan_spec.rb +47 -0
  79. data/spec/models/contract_product_spec.rb +71 -0
  80. data/spec/models/contract_spec.rb +111 -0
  81. data/spec/models/customer_spec.rb +59 -0
  82. data/spec/models/error_spec.rb +47 -0
  83. data/spec/models/invoice_details_spec.rb +47 -0
  84. data/spec/models/invoice_discount_spec.rb +53 -0
  85. data/spec/models/invoice_items_spec.rb +83 -0
  86. data/spec/models/invoice_metadata_product_spec.rb +53 -0
  87. data/spec/models/invoice_metadata_spec.rb +53 -0
  88. data/spec/models/invoice_payee_spec.rb +59 -0
  89. data/spec/models/invoice_payer_spec.rb +59 -0
  90. data/spec/models/invoice_spec.rb +71 -0
  91. data/spec/models/offer_plan_contract_spec.rb +71 -0
  92. data/spec/models/offer_plan_spec.rb +59 -0
  93. data/spec/models/offer_spec.rb +41 -0
  94. data/spec/models/plan_details_spec.rb +53 -0
  95. data/spec/models/plan_prices_spec.rb +53 -0
  96. data/spec/models/plan_spec.rb +53 -0
  97. data/spec/models/plans_list_spec.rb +41 -0
  98. data/spec/models/product_identifiers_spec.rb +65 -0
  99. data/spec/models/product_mfr_warranty_spec.rb +53 -0
  100. data/spec/models/product_spec.rb +129 -0
  101. data/spec/spec_helper.rb +111 -0
  102. metadata +235 -0
@@ -0,0 +1,225 @@
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 Plan
17
+ # Unique identifier for a warranty Plan
18
+ attr_accessor :id
19
+
20
+ attr_accessor :details
21
+
22
+ attr_accessor :prices
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'id' => :'id',
28
+ :'details' => :'details',
29
+ :'prices' => :'prices'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'id' => :'String',
37
+ :'details' => :'PlanDetails',
38
+ :'prices' => :'PlanPrices'
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new([
45
+ ])
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ if (!attributes.is_a?(Hash))
52
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HelloextendApiClient::Plan` initialize method"
53
+ end
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h|
57
+ if (!self.class.attribute_map.key?(k.to_sym))
58
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HelloextendApiClient::Plan`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
+ end
60
+ h[k.to_sym] = v
61
+ }
62
+
63
+ if attributes.key?(:'id')
64
+ self.id = attributes[:'id']
65
+ end
66
+
67
+ if attributes.key?(:'details')
68
+ self.details = attributes[:'details']
69
+ end
70
+
71
+ if attributes.key?(:'prices')
72
+ self.prices = attributes[:'prices']
73
+ end
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properties with the reasons
78
+ def list_invalid_properties
79
+ invalid_properties = Array.new
80
+ invalid_properties
81
+ end
82
+
83
+ # Check to see if the all the properties in the model are valid
84
+ # @return true if the model is valid
85
+ def valid?
86
+ true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(o)
92
+ return true if self.equal?(o)
93
+ self.class == o.class &&
94
+ id == o.id &&
95
+ details == o.details &&
96
+ prices == o.prices
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Integer] Hash code
107
+ def hash
108
+ [id, details, prices].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def self.build_from_hash(attributes)
115
+ new.build_from_hash(attributes)
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.openapi_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ DateTime.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :Boolean
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ HelloextendApiClient.const_get(type).build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.openapi_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+ end
225
+ end
@@ -0,0 +1,227 @@
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 PlanDetails
17
+ # The name of the warranty plan. Use this in the product title for the warranty plan SKU(s) in your store
18
+ attr_accessor :title
19
+
20
+ # The imageUrl for the warranty plan. Use this as the product image for the warranty plan SKU(s) in your store
21
+ attr_accessor :image_url
22
+
23
+ # The length of the extended warranty coverage, in months
24
+ attr_accessor :term_length
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'title' => :'title',
30
+ :'image_url' => :'imageUrl',
31
+ :'term_length' => :'termLength'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'title' => :'String',
39
+ :'image_url' => :'String',
40
+ :'term_length' => :'Float'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HelloextendApiClient::PlanDetails` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HelloextendApiClient::PlanDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'title')
66
+ self.title = attributes[:'title']
67
+ end
68
+
69
+ if attributes.key?(:'image_url')
70
+ self.image_url = attributes[:'image_url']
71
+ end
72
+
73
+ if attributes.key?(:'term_length')
74
+ self.term_length = attributes[:'term_length']
75
+ end
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ true
89
+ end
90
+
91
+ # Checks equality by comparing each attribute.
92
+ # @param [Object] Object to be compared
93
+ def ==(o)
94
+ return true if self.equal?(o)
95
+ self.class == o.class &&
96
+ title == o.title &&
97
+ image_url == o.image_url &&
98
+ term_length == o.term_length
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
109
+ def hash
110
+ [title, image_url, term_length].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ new.build_from_hash(attributes)
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ self.class.openapi_types.each_pair do |key, type|
126
+ if type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
130
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
135
+ end
136
+
137
+ self
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def _deserialize(type, value)
145
+ case type.to_sym
146
+ when :DateTime
147
+ DateTime.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ HelloextendApiClient.const_get(type).build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ if value.nil?
200
+ is_nullable = self.class.openapi_nullable.include?(attr)
201
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
+ end
203
+
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+ end
227
+ end