tradenity 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +7 -0
- data/README.md +89 -77
- data/lib/tradenity/api_client.rb +408 -0
- data/lib/tradenity/api_error.rb +36 -0
- data/lib/tradenity/configuration.rb +205 -0
- data/lib/tradenity/exceptions.rb +5 -0
- data/lib/tradenity/rails/railtie.rb +20 -20
- data/lib/tradenity/resources/address.rb +729 -0
- data/lib/tradenity/resources/braintree_gateway.rb +804 -0
- data/lib/tradenity/resources/brand.rb +732 -0
- data/lib/tradenity/resources/cancel_operation.rb +675 -0
- data/lib/tradenity/resources/cart_settings.rb +219 -0
- data/lib/tradenity/resources/cash_on_delivery_payment.rb +746 -0
- data/lib/tradenity/resources/category.rb +763 -0
- data/lib/tradenity/resources/collection.rb +734 -0
- data/lib/tradenity/resources/contact_info.rb +306 -0
- data/lib/tradenity/resources/countries_geo_zone.rb +739 -0
- data/lib/tradenity/resources/country.rb +803 -0
- data/lib/tradenity/resources/coupon.rb +454 -0
- data/lib/tradenity/resources/credit_card_payment.rb +803 -0
- data/lib/tradenity/resources/currency.rb +762 -0
- data/lib/tradenity/resources/customer.rb +816 -0
- data/lib/tradenity/resources/customer_group.rb +723 -0
- data/lib/tradenity/resources/dimensions.rb +263 -0
- data/lib/tradenity/resources/discount_coupon.rb +811 -0
- data/lib/tradenity/resources/discount_promotion.rb +784 -0
- data/lib/tradenity/resources/fixed_rate_shipping.rb +837 -0
- data/lib/tradenity/resources/free_item_coupon.rb +793 -0
- data/lib/tradenity/resources/free_shipping.rb +806 -0
- data/lib/tradenity/resources/free_shipping_coupon.rb +788 -0
- data/lib/tradenity/resources/free_shipping_promotion.rb +744 -0
- data/lib/tradenity/resources/gateway.rb +435 -0
- data/lib/tradenity/resources/general_settings.rb +206 -0
- data/lib/tradenity/resources/geo_zone.rb +406 -0
- data/lib/tradenity/resources/instance_meta.rb +182 -0
- data/lib/tradenity/resources/inventory_settings.rb +197 -0
- data/lib/tradenity/resources/items_selector.rb +270 -0
- data/lib/tradenity/resources/line_item.rb +347 -0
- data/lib/tradenity/resources/mail_server_settings.rb +221 -0
- data/lib/tradenity/resources/measurement_settings.rb +253 -0
- data/lib/tradenity/resources/option.rb +787 -0
- data/lib/tradenity/resources/option_set.rb +734 -0
- data/lib/tradenity/resources/option_value.rb +680 -0
- data/lib/tradenity/resources/order.rb +929 -0
- data/lib/tradenity/resources/order_line_item.rb +777 -0
- data/lib/tradenity/resources/paging.rb +38 -0
- data/lib/tradenity/resources/payment.rb +429 -0
- data/lib/tradenity/resources/payment_card.rb +847 -0
- data/lib/tradenity/resources/payment_settings.rb +201 -0
- data/lib/tradenity/resources/payment_source.rb +392 -0
- data/lib/tradenity/resources/payment_token.rb +723 -0
- data/lib/tradenity/resources/payment_transaction.rb +740 -0
- data/lib/tradenity/resources/photo.rb +341 -0
- data/lib/tradenity/resources/product.rb +1156 -0
- data/lib/tradenity/resources/promotion.rb +427 -0
- data/lib/tradenity/resources/refund_operation.rb +358 -0
- data/lib/tradenity/resources/refund_transaction.rb +730 -0
- data/lib/tradenity/resources/return_line_item.rb +781 -0
- data/lib/tradenity/resources/return_operation.rb +686 -0
- data/lib/tradenity/resources/return_settings.rb +255 -0
- data/lib/tradenity/resources/shipping_method.rb +530 -0
- data/lib/tradenity/resources/shopping_cart.rb +647 -0
- data/lib/tradenity/resources/state.rb +675 -0
- data/lib/tradenity/resources/states_geo_zone.rb +748 -0
- data/lib/tradenity/resources/store_credit.rb +686 -0
- data/lib/tradenity/resources/store_credit_payment.rb +764 -0
- data/lib/tradenity/resources/store_credit_transaction.rb +730 -0
- data/lib/tradenity/resources/store_profile.rb +532 -0
- data/lib/tradenity/resources/stripe_gateway.rb +804 -0
- data/lib/tradenity/resources/table_rate_rule.rb +712 -0
- data/lib/tradenity/resources/table_rate_shipping.rb +834 -0
- data/lib/tradenity/resources/tax_class.rb +723 -0
- data/lib/tradenity/resources/tax_rate.rb +845 -0
- data/lib/tradenity/resources/tax_settings.rb +231 -0
- data/lib/tradenity/resources/test_gateway.rb +804 -0
- data/lib/tradenity/resources/transaction.rb +523 -0
- data/lib/tradenity/resources/utils.rb +7 -0
- data/lib/tradenity/resources/variant.rb +877 -0
- data/lib/tradenity/resources/web_hooks.rb +262 -0
- data/lib/tradenity/resources/weight.rb +235 -0
- data/lib/tradenity/resources/wish_list.rb +686 -0
- data/lib/tradenity/resources/zip_codes_geo_zone.rb +755 -0
- data/lib/tradenity/token_holder.rb +22 -0
- data/lib/tradenity/version.rb +13 -3
- data/lib/tradenity.rb +117 -7
- data/tradenity.gemspec +35 -30
- metadata +200 -34
- data/lib/tradenity/api.rb +0 -17
- data/lib/tradenity/error/exceptions.rb +0 -52
- data/lib/tradenity/error/message.rb +0 -38
- data/lib/tradenity/http/client.rb +0 -130
- data/lib/tradenity/model/base.rb +0 -100
- data/lib/tradenity/model/entities.rb +0 -390
- data/lib/tradenity/model/paging.rb +0 -23
@@ -0,0 +1,806 @@
|
|
1
|
+
=begin
|
2
|
+
#Tradenity API
|
3
|
+
|
4
|
+
#Tradenity eCommerce Rest API
|
5
|
+
|
6
|
+
Contact: support@tradenity.com
|
7
|
+
Generated by: https://github.com/tradenity
|
8
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'uri'
|
12
|
+
|
13
|
+
module Tradenity
|
14
|
+
class FreeShipping
|
15
|
+
|
16
|
+
|
17
|
+
def id=(id)
|
18
|
+
@id = id
|
19
|
+
end
|
20
|
+
|
21
|
+
def id
|
22
|
+
if instance_variable_defined?('@id') && @id != nil
|
23
|
+
@id
|
24
|
+
elsif __meta && __meta.href != nil
|
25
|
+
@id = __meta.href.split('/')[-1]
|
26
|
+
@id
|
27
|
+
else
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
attr_accessor :__meta
|
33
|
+
|
34
|
+
attr_accessor :created_at
|
35
|
+
|
36
|
+
attr_accessor :updated_at
|
37
|
+
|
38
|
+
attr_accessor :name
|
39
|
+
|
40
|
+
attr_accessor :slug
|
41
|
+
|
42
|
+
attr_accessor :message
|
43
|
+
|
44
|
+
attr_accessor :description
|
45
|
+
|
46
|
+
attr_accessor :geo_zone
|
47
|
+
|
48
|
+
attr_accessor :customer_groups
|
49
|
+
|
50
|
+
attr_accessor :status
|
51
|
+
|
52
|
+
attr_accessor :use_discounted_subtotal
|
53
|
+
|
54
|
+
attr_accessor :include_taxes
|
55
|
+
|
56
|
+
attr_accessor :minimum_order
|
57
|
+
|
58
|
+
class EnumAttributeValidator
|
59
|
+
attr_reader :datatype
|
60
|
+
attr_reader :allowable_values
|
61
|
+
|
62
|
+
def initialize(datatype, allowable_values)
|
63
|
+
@allowable_values = allowable_values.map do |value|
|
64
|
+
case datatype.to_s
|
65
|
+
when /Integer/i
|
66
|
+
value.to_i
|
67
|
+
when /Float/i
|
68
|
+
value.to_f
|
69
|
+
else
|
70
|
+
value
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def valid?(value)
|
76
|
+
!value || allowable_values.include?(value)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
81
|
+
def self.attribute_map
|
82
|
+
{
|
83
|
+
:'id' => :'id',
|
84
|
+
:'__meta' => :'__meta',
|
85
|
+
:'created_at' => :'createdAt',
|
86
|
+
:'updated_at' => :'updatedAt',
|
87
|
+
:'name' => :'name',
|
88
|
+
:'slug' => :'slug',
|
89
|
+
:'message' => :'message',
|
90
|
+
:'description' => :'description',
|
91
|
+
:'geo_zone' => :'geoZone',
|
92
|
+
:'customer_groups' => :'customerGroups',
|
93
|
+
:'status' => :'status',
|
94
|
+
:'use_discounted_subtotal' => :'useDiscountedSubtotal',
|
95
|
+
:'include_taxes' => :'includeTaxes',
|
96
|
+
:'minimum_order' => :'minimumOrder'
|
97
|
+
}
|
98
|
+
end
|
99
|
+
|
100
|
+
# Attribute type mapping.
|
101
|
+
def self.swagger_types
|
102
|
+
{
|
103
|
+
:'id' => :'String',
|
104
|
+
:'__meta' => :'InstanceMeta',
|
105
|
+
:'created_at' => :'DateTime',
|
106
|
+
:'updated_at' => :'DateTime',
|
107
|
+
:'name' => :'String',
|
108
|
+
:'slug' => :'String',
|
109
|
+
:'message' => :'String',
|
110
|
+
:'description' => :'String',
|
111
|
+
:'geo_zone' => :'GeoZone',
|
112
|
+
:'customer_groups' => :'Array<CustomerGroup>',
|
113
|
+
:'status' => :'String',
|
114
|
+
:'use_discounted_subtotal' => :'BOOLEAN',
|
115
|
+
:'include_taxes' => :'BOOLEAN',
|
116
|
+
:'minimum_order' => :'Integer'
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
120
|
+
# Initializes the object
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
122
|
+
def initialize(attributes = {})
|
123
|
+
return unless attributes.is_a?(Hash)
|
124
|
+
|
125
|
+
# convert string to symbol for hash key
|
126
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
127
|
+
if attributes.has_key?(:'id')
|
128
|
+
self.id = attributes[:'id']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.has_key?(:'__meta')
|
132
|
+
self.__meta = attributes[:'__meta']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.has_key?(:'createdAt')
|
136
|
+
self.created_at = attributes[:'createdAt']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.has_key?(:'created_at')
|
140
|
+
self.created_at = attributes[:'created_at']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.has_key?(:'updatedAt')
|
144
|
+
self.updated_at = attributes[:'updatedAt']
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.has_key?(:'updated_at')
|
148
|
+
self.updated_at = attributes[:'updated_at']
|
149
|
+
end
|
150
|
+
|
151
|
+
if attributes.has_key?(:'name')
|
152
|
+
self.name = attributes[:'name']
|
153
|
+
end
|
154
|
+
|
155
|
+
if attributes.has_key?(:'slug')
|
156
|
+
self.slug = attributes[:'slug']
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.has_key?(:'message')
|
160
|
+
self.message = attributes[:'message']
|
161
|
+
end
|
162
|
+
|
163
|
+
if attributes.has_key?(:'description')
|
164
|
+
self.description = attributes[:'description']
|
165
|
+
end
|
166
|
+
|
167
|
+
if attributes.has_key?(:'geoZone')
|
168
|
+
self.geo_zone = attributes[:'geoZone']
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.has_key?(:'geo_zone')
|
172
|
+
self.geo_zone = attributes[:'geo_zone']
|
173
|
+
end
|
174
|
+
|
175
|
+
if attributes.has_key?(:'customerGroups')
|
176
|
+
if (value = attributes[:'customerGroups']).is_a?(Array)
|
177
|
+
self.customer_groups = value
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
if attributes.has_key?(:'customer_groups')
|
182
|
+
if (value = attributes[:'customer_groups']).is_a?(Array)
|
183
|
+
self.customer_groups = value
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
if attributes.has_key?(:'status')
|
188
|
+
self.status = attributes[:'status']
|
189
|
+
end
|
190
|
+
|
191
|
+
if attributes.has_key?(:'useDiscountedSubtotal')
|
192
|
+
self.use_discounted_subtotal = attributes[:'useDiscountedSubtotal']
|
193
|
+
end
|
194
|
+
|
195
|
+
if attributes.has_key?(:'use_discounted_subtotal')
|
196
|
+
self.use_discounted_subtotal = attributes[:'use_discounted_subtotal']
|
197
|
+
end
|
198
|
+
|
199
|
+
if attributes.has_key?(:'includeTaxes')
|
200
|
+
self.include_taxes = attributes[:'includeTaxes']
|
201
|
+
end
|
202
|
+
|
203
|
+
if attributes.has_key?(:'include_taxes')
|
204
|
+
self.include_taxes = attributes[:'include_taxes']
|
205
|
+
end
|
206
|
+
|
207
|
+
if attributes.has_key?(:'minimumOrder')
|
208
|
+
self.minimum_order = attributes[:'minimumOrder']
|
209
|
+
end
|
210
|
+
|
211
|
+
if attributes.has_key?(:'minimum_order')
|
212
|
+
self.minimum_order = attributes[:'minimum_order']
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
217
|
+
# @return Array for valid properties with the reasons
|
218
|
+
def list_invalid_properties
|
219
|
+
invalid_properties = Array.new
|
220
|
+
if @name.nil?
|
221
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
222
|
+
end
|
223
|
+
|
224
|
+
if @slug.nil?
|
225
|
+
invalid_properties.push('invalid value for "slug", slug cannot be nil.')
|
226
|
+
end
|
227
|
+
|
228
|
+
if @geo_zone.nil?
|
229
|
+
invalid_properties.push('invalid value for "geo_zone", geo_zone cannot be nil.')
|
230
|
+
end
|
231
|
+
|
232
|
+
if @status.nil?
|
233
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
234
|
+
end
|
235
|
+
|
236
|
+
invalid_properties
|
237
|
+
end
|
238
|
+
|
239
|
+
# Check to see if the all the properties in the model are valid
|
240
|
+
# @return true if the model is valid
|
241
|
+
def valid?
|
242
|
+
return false if @name.nil?
|
243
|
+
return false if @slug.nil?
|
244
|
+
return false if @geo_zone.nil?
|
245
|
+
return false if @status.nil?
|
246
|
+
status_validator = EnumAttributeValidator.new('String', ['enabled', 'disabled'])
|
247
|
+
return false unless status_validator.valid?(@status)
|
248
|
+
true
|
249
|
+
end
|
250
|
+
|
251
|
+
# Custom attribute writer method checking allowed values (enum).
|
252
|
+
# @param [Object] status Object to be assigned
|
253
|
+
def status=(status)
|
254
|
+
validator = EnumAttributeValidator.new('String', ['enabled', 'disabled'])
|
255
|
+
unless validator.valid?(status)
|
256
|
+
fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
|
257
|
+
end
|
258
|
+
@status = status
|
259
|
+
end
|
260
|
+
|
261
|
+
# Checks equality by comparing each attribute.
|
262
|
+
# @param [Object] Object to be compared
|
263
|
+
def ==(o)
|
264
|
+
return true if self.equal?(o)
|
265
|
+
self.class == o.class &&
|
266
|
+
__meta == o.__meta &&
|
267
|
+
created_at == o.created_at &&
|
268
|
+
updated_at == o.updated_at &&
|
269
|
+
name == o.name &&
|
270
|
+
slug == o.slug &&
|
271
|
+
message == o.message &&
|
272
|
+
description == o.description &&
|
273
|
+
geo_zone == o.geo_zone &&
|
274
|
+
customer_groups == o.customer_groups &&
|
275
|
+
status == o.status &&
|
276
|
+
use_discounted_subtotal == o.use_discounted_subtotal &&
|
277
|
+
include_taxes == o.include_taxes &&
|
278
|
+
minimum_order == o.minimum_order
|
279
|
+
end
|
280
|
+
|
281
|
+
# @see the `==` method
|
282
|
+
# @param [Object] Object to be compared
|
283
|
+
def eql?(o)
|
284
|
+
self == o
|
285
|
+
end
|
286
|
+
|
287
|
+
# Calculates hash code according to all attributes.
|
288
|
+
# @return [Fixnum] Hash code
|
289
|
+
def hash
|
290
|
+
[__meta, created_at, updated_at, name, slug, message, description, geo_zone, customer_groups, status, use_discounted_subtotal, include_taxes, minimum_order].hash
|
291
|
+
end
|
292
|
+
|
293
|
+
# Builds the object from hash
|
294
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
295
|
+
# @return [Object] Returns the model itself
|
296
|
+
def build_from_hash(attributes)
|
297
|
+
return nil unless attributes.is_a?(Hash)
|
298
|
+
self.class.swagger_types.each_pair do |key, type|
|
299
|
+
if type =~ /\AArray<(.*)>/i
|
300
|
+
# check to ensure the input is an array given that the the attribute
|
301
|
+
# is documented as an array but the input is not
|
302
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
303
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
304
|
+
end
|
305
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
306
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
307
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
308
|
+
end
|
309
|
+
|
310
|
+
self
|
311
|
+
end
|
312
|
+
|
313
|
+
# Deserializes the data based on type
|
314
|
+
# @param string type Data type
|
315
|
+
# @param string value Value to be deserialized
|
316
|
+
# @return [Object] Deserialized data
|
317
|
+
def _deserialize(type, value)
|
318
|
+
case type.to_sym
|
319
|
+
when :DateTime
|
320
|
+
DateTime.parse(value)
|
321
|
+
when :Date
|
322
|
+
Date.parse(value)
|
323
|
+
when :String
|
324
|
+
value.to_s
|
325
|
+
when :Integer
|
326
|
+
value.to_i
|
327
|
+
when :Float
|
328
|
+
value.to_f
|
329
|
+
when :BOOLEAN
|
330
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
331
|
+
true
|
332
|
+
else
|
333
|
+
false
|
334
|
+
end
|
335
|
+
when :Object
|
336
|
+
# generic object (usually a Hash), return directly
|
337
|
+
value
|
338
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
339
|
+
inner_type = Regexp.last_match[:inner_type]
|
340
|
+
value.map { |v| _deserialize(inner_type, v) }
|
341
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
342
|
+
k_type = Regexp.last_match[:k_type]
|
343
|
+
v_type = Regexp.last_match[:v_type]
|
344
|
+
{}.tap do |hash|
|
345
|
+
value.each do |k, v|
|
346
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
347
|
+
end
|
348
|
+
end
|
349
|
+
else # model
|
350
|
+
temp_model = Tradenity.const_get(type).new
|
351
|
+
temp_model.build_from_hash(value)
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
# Returns the string representation of the object
|
356
|
+
# @return [String] String presentation of the object
|
357
|
+
def to_s
|
358
|
+
to_hash.to_s
|
359
|
+
end
|
360
|
+
|
361
|
+
# to_body is an alias to to_hash (backward compatibility)
|
362
|
+
# @return [Hash] Returns the object in the form of hash
|
363
|
+
def to_body
|
364
|
+
to_hash
|
365
|
+
end
|
366
|
+
|
367
|
+
# Returns the object in the form of hash
|
368
|
+
# @return [Hash] Returns the object in the form of hash
|
369
|
+
def to_hash
|
370
|
+
hash = {}
|
371
|
+
self.class.attribute_map.each_pair do |attr, param|
|
372
|
+
value = self.send(attr)
|
373
|
+
next if value.nil?
|
374
|
+
hash[param] = _to_hash(value)
|
375
|
+
end
|
376
|
+
hash
|
377
|
+
end
|
378
|
+
|
379
|
+
# Outputs non-array value in the form of hash
|
380
|
+
# For object, use to_hash. Otherwise, just return the value
|
381
|
+
# @param [Object] value Any valid value
|
382
|
+
# @return [Hash] Returns the value in the form of hash
|
383
|
+
def _to_hash(value)
|
384
|
+
if value.is_a?(Array)
|
385
|
+
value.compact.map { |v| _to_hash(v) }
|
386
|
+
elsif value.is_a?(Hash)
|
387
|
+
{}.tap do |hash|
|
388
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
389
|
+
end
|
390
|
+
elsif value.respond_to? :to_hash
|
391
|
+
value.to_hash
|
392
|
+
else
|
393
|
+
value
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
|
398
|
+
def self.api_client
|
399
|
+
ApiClient.default
|
400
|
+
end
|
401
|
+
|
402
|
+
# Create FreeShipping
|
403
|
+
# Create a new FreeShipping
|
404
|
+
def create
|
405
|
+
data = self.class.create_free_shipping(self)
|
406
|
+
self.id = data.id
|
407
|
+
data
|
408
|
+
end
|
409
|
+
|
410
|
+
# Update FreeShipping
|
411
|
+
# Update attributes of FreeShipping
|
412
|
+
# @return [FreeShipping]
|
413
|
+
def update
|
414
|
+
self.class.update_free_shipping_by_id(self.id, self)
|
415
|
+
end
|
416
|
+
|
417
|
+
# Delete FreeShipping
|
418
|
+
# Delete this instance of FreeShipping.
|
419
|
+
# @return [nil]
|
420
|
+
def delete
|
421
|
+
self.class.delete_free_shipping_by_id(self.id)
|
422
|
+
end
|
423
|
+
|
424
|
+
class << self
|
425
|
+
|
426
|
+
# List FreeShippings
|
427
|
+
# Return a list of FreeShippings
|
428
|
+
# @param [Hash] opts the optional parameters
|
429
|
+
# @return [Page<FreeShipping>]
|
430
|
+
def find_all
|
431
|
+
list_all_free_shippings
|
432
|
+
end
|
433
|
+
|
434
|
+
# Find List of FreeShipping
|
435
|
+
# Return multiple instances of FreeShipping by its attributes.
|
436
|
+
# @param [Hash] opts the search parameters
|
437
|
+
# @return [Page<Collection>]
|
438
|
+
def find_all_by(opts = {})
|
439
|
+
list_all_free_shippings(opts)
|
440
|
+
end
|
441
|
+
|
442
|
+
# Find FreeShipping by its parameters
|
443
|
+
# Return single instance of Collection by its attributes.
|
444
|
+
# @param [Hash] opts search parameters
|
445
|
+
# @return [FreeShipping]
|
446
|
+
def find_one_by(opts = {})
|
447
|
+
list_all_free_shippings(opts)[0]
|
448
|
+
end
|
449
|
+
|
450
|
+
# Find FreeShipping
|
451
|
+
# Return single instance of FreeShipping by its ID.
|
452
|
+
# @param id ID of FreeShipping to return
|
453
|
+
# @return [FreeShipping]
|
454
|
+
def find_by_id(id)
|
455
|
+
get_free_shipping_by_id(id)
|
456
|
+
end
|
457
|
+
|
458
|
+
# Delete FreeShipping
|
459
|
+
# Delete an instance of FreeShipping by its ID.
|
460
|
+
# @param id ID of FreeShipping to delete.
|
461
|
+
# @return [nil]
|
462
|
+
def delete_by_id(id)
|
463
|
+
delete_free_shipping_by_id(id)
|
464
|
+
end
|
465
|
+
|
466
|
+
# Create FreeShipping
|
467
|
+
# Create a new FreeShipping
|
468
|
+
# @param free_shipping Attributes of freeShipping to create
|
469
|
+
# @param [Hash] opts the optional parameters
|
470
|
+
# @return [FreeShipping]
|
471
|
+
def create_free_shipping(free_shipping, opts = {})
|
472
|
+
data, _status_code, _headers = create_free_shipping_with_http_info(free_shipping, opts)
|
473
|
+
data
|
474
|
+
end
|
475
|
+
|
476
|
+
# Create FreeShipping
|
477
|
+
# Create a new FreeShipping
|
478
|
+
# @param free_shipping Attributes of freeShipping to create
|
479
|
+
# @param [Hash] opts the optional parameters
|
480
|
+
# @return [Array<(FreeShipping, Fixnum, Hash)>] FreeShipping data, response status code and response headers
|
481
|
+
def create_free_shipping_with_http_info(free_shipping, opts = {})
|
482
|
+
if api_client.config.debugging
|
483
|
+
api_client.config.logger.debug 'Calling API: FreeShipping.create_free_shipping ...'
|
484
|
+
end
|
485
|
+
# verify the required parameter 'free_shipping' is set
|
486
|
+
if api_client.config.client_side_validation && free_shipping.nil?
|
487
|
+
fail ArgumentError, "Missing the required parameter 'free_shipping' when calling FreeShipping.create_free_shipping"
|
488
|
+
end
|
489
|
+
# resource path
|
490
|
+
local_var_path = '/freeShippings'
|
491
|
+
|
492
|
+
# query parameters
|
493
|
+
query_params = opts
|
494
|
+
|
495
|
+
# header parameters
|
496
|
+
header_params = {}
|
497
|
+
# HTTP header 'Accept' (if needed)
|
498
|
+
header_params['Accept'] = api_client.select_header_accept(['application/json'])
|
499
|
+
# HTTP header 'Content-Type'
|
500
|
+
header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
|
501
|
+
|
502
|
+
# form parameters
|
503
|
+
form_params = {}
|
504
|
+
|
505
|
+
# http body (model)
|
506
|
+
post_body = api_client.object_to_http_body(free_shipping)
|
507
|
+
auth_names = []
|
508
|
+
data, status_code, headers = api_client.call_api(:POST, local_var_path,
|
509
|
+
:header_params => header_params,
|
510
|
+
:query_params => query_params,
|
511
|
+
:form_params => form_params,
|
512
|
+
:body => post_body,
|
513
|
+
:auth_names => auth_names,
|
514
|
+
:return_type => 'FreeShipping')
|
515
|
+
if api_client.config.debugging
|
516
|
+
api_client.config.logger.debug "API called: FreeShipping#create_free_shipping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
517
|
+
end
|
518
|
+
return data, status_code, headers
|
519
|
+
end
|
520
|
+
# Delete FreeShipping
|
521
|
+
# Delete an instance of FreeShipping by its ID.
|
522
|
+
# @param free_shipping_id ID of freeShipping to delete.
|
523
|
+
# @param [Hash] opts the optional parameters
|
524
|
+
# @return [nil]
|
525
|
+
def delete_free_shipping_by_id(free_shipping_id, opts = {})
|
526
|
+
delete_free_shipping_by_id_with_http_info(free_shipping_id, opts)
|
527
|
+
nil
|
528
|
+
end
|
529
|
+
|
530
|
+
# Delete FreeShipping
|
531
|
+
# Delete an instance of FreeShipping by its ID.
|
532
|
+
# @param free_shipping_id ID of freeShipping to delete.
|
533
|
+
# @param [Hash] opts the optional parameters
|
534
|
+
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
535
|
+
def delete_free_shipping_by_id_with_http_info(free_shipping_id, opts = {})
|
536
|
+
if api_client.config.debugging
|
537
|
+
api_client.config.logger.debug 'Calling API: FreeShipping.delete_free_shipping_by_id ...'
|
538
|
+
end
|
539
|
+
# verify the required parameter 'free_shipping_id' is set
|
540
|
+
if api_client.config.client_side_validation && free_shipping_id.nil?
|
541
|
+
fail ArgumentError, "Missing the required parameter 'free_shipping_id' when calling FreeShipping.delete_free_shipping_by_id"
|
542
|
+
end
|
543
|
+
# resource path
|
544
|
+
local_var_path = '/freeShippings/{freeShippingId}'.sub('{' + 'freeShippingId' + '}', free_shipping_id.to_s)
|
545
|
+
|
546
|
+
# query parameters
|
547
|
+
query_params = opts
|
548
|
+
|
549
|
+
# header parameters
|
550
|
+
header_params = {}
|
551
|
+
# HTTP header 'Accept' (if needed)
|
552
|
+
header_params['Accept'] = api_client.select_header_accept(['application/json'])
|
553
|
+
# HTTP header 'Content-Type'
|
554
|
+
header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
|
555
|
+
|
556
|
+
# form parameters
|
557
|
+
form_params = {}
|
558
|
+
|
559
|
+
# http body (model)
|
560
|
+
post_body = nil
|
561
|
+
auth_names = []
|
562
|
+
data, status_code, headers = api_client.call_api(:DELETE, local_var_path,
|
563
|
+
:header_params => header_params,
|
564
|
+
:query_params => query_params,
|
565
|
+
:form_params => form_params,
|
566
|
+
:body => post_body,
|
567
|
+
:auth_names => auth_names)
|
568
|
+
if api_client.config.debugging
|
569
|
+
api_client.config.logger.debug "API called: FreeShipping#delete_free_shipping_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
570
|
+
end
|
571
|
+
return data, status_code, headers
|
572
|
+
end
|
573
|
+
# Find FreeShipping
|
574
|
+
# Return single instance of FreeShipping by its ID.
|
575
|
+
# @param free_shipping_id ID of freeShipping to return
|
576
|
+
# @param [Hash] opts the optional parameters
|
577
|
+
# @return [FreeShipping]
|
578
|
+
def get_free_shipping_by_id(free_shipping_id, opts = {})
|
579
|
+
data, _status_code, _headers = get_free_shipping_by_id_with_http_info(free_shipping_id, opts)
|
580
|
+
data
|
581
|
+
end
|
582
|
+
|
583
|
+
# Find FreeShipping
|
584
|
+
# Return single instance of FreeShipping by its ID.
|
585
|
+
# @param free_shipping_id ID of freeShipping to return
|
586
|
+
# @param [Hash] opts the optional parameters
|
587
|
+
# @return [Array<(FreeShipping, Fixnum, Hash)>] FreeShipping data, response status code and response headers
|
588
|
+
def get_free_shipping_by_id_with_http_info(free_shipping_id, opts = {})
|
589
|
+
if api_client.config.debugging
|
590
|
+
api_client.config.logger.debug 'Calling API: FreeShipping.get_free_shipping_by_id ...'
|
591
|
+
end
|
592
|
+
# verify the required parameter 'free_shipping_id' is set
|
593
|
+
if api_client.config.client_side_validation && free_shipping_id.nil?
|
594
|
+
fail ArgumentError, "Missing the required parameter 'free_shipping_id' when calling FreeShipping.get_free_shipping_by_id"
|
595
|
+
end
|
596
|
+
# resource path
|
597
|
+
local_var_path = '/freeShippings/{freeShippingId}'.sub('{' + 'freeShippingId' + '}', free_shipping_id.to_s)
|
598
|
+
|
599
|
+
# query parameters
|
600
|
+
query_params = opts
|
601
|
+
|
602
|
+
# header parameters
|
603
|
+
header_params = {}
|
604
|
+
# HTTP header 'Accept' (if needed)
|
605
|
+
header_params['Accept'] = api_client.select_header_accept(['application/json'])
|
606
|
+
# HTTP header 'Content-Type'
|
607
|
+
header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
|
608
|
+
|
609
|
+
# form parameters
|
610
|
+
form_params = {}
|
611
|
+
|
612
|
+
# http body (model)
|
613
|
+
post_body = nil
|
614
|
+
auth_names = []
|
615
|
+
data, status_code, headers = api_client.call_api(:GET, local_var_path,
|
616
|
+
:header_params => header_params,
|
617
|
+
:query_params => query_params,
|
618
|
+
:form_params => form_params,
|
619
|
+
:body => post_body,
|
620
|
+
:auth_names => auth_names,
|
621
|
+
:return_type => 'FreeShipping')
|
622
|
+
if api_client.config.debugging
|
623
|
+
api_client.config.logger.debug "API called: FreeShipping#get_free_shipping_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
624
|
+
end
|
625
|
+
return data, status_code, headers
|
626
|
+
end
|
627
|
+
# List FreeShippings
|
628
|
+
# Return a list of FreeShippings
|
629
|
+
# @param [Hash] opts the optional parameters
|
630
|
+
# @option opts [Integer] :page page number
|
631
|
+
# @option opts [Integer] :size page size
|
632
|
+
# @option opts [String] :sort page order
|
633
|
+
# @return [Page<FreeShipping>]
|
634
|
+
def list_all_free_shippings(opts = {})
|
635
|
+
data, _status_code, _headers = list_all_free_shippings_with_http_info(opts)
|
636
|
+
data
|
637
|
+
end
|
638
|
+
|
639
|
+
# List FreeShippings
|
640
|
+
# Return a list of FreeShippings
|
641
|
+
# @param [Hash] opts the optional parameters
|
642
|
+
# @option opts [Integer] :page page number
|
643
|
+
# @option opts [Integer] :size page size
|
644
|
+
# @option opts [String] :sort page order
|
645
|
+
# @return [Array<(Page<FreeShipping>, Fixnum, Hash)>] Page<FreeShipping> data, response status code and response headers
|
646
|
+
def list_all_free_shippings_with_http_info(opts = {})
|
647
|
+
if api_client.config.debugging
|
648
|
+
api_client.config.logger.debug 'Calling API: FreeShipping.list_all_free_shippings ...'
|
649
|
+
end
|
650
|
+
# resource path
|
651
|
+
local_var_path = '/freeShippings'
|
652
|
+
|
653
|
+
# query parameters
|
654
|
+
query_params = opts
|
655
|
+
# query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
656
|
+
# query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
|
657
|
+
# query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
|
658
|
+
|
659
|
+
# header parameters
|
660
|
+
header_params = {}
|
661
|
+
# HTTP header 'Accept' (if needed)
|
662
|
+
header_params['Accept'] = api_client.select_header_accept(['application/json'])
|
663
|
+
# HTTP header 'Content-Type'
|
664
|
+
header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
|
665
|
+
|
666
|
+
# form parameters
|
667
|
+
form_params = {}
|
668
|
+
|
669
|
+
# http body (model)
|
670
|
+
post_body = nil
|
671
|
+
auth_names = []
|
672
|
+
data, status_code, headers = api_client.call_api(:GET, local_var_path,
|
673
|
+
:header_params => header_params,
|
674
|
+
:query_params => query_params,
|
675
|
+
:form_params => form_params,
|
676
|
+
:body => post_body,
|
677
|
+
:auth_names => auth_names,
|
678
|
+
:return_type => 'Page<FreeShipping>')
|
679
|
+
if api_client.config.debugging
|
680
|
+
api_client.config.logger.debug "API called: FreeShipping#list_all_free_shippings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
681
|
+
end
|
682
|
+
return data, status_code, headers
|
683
|
+
end
|
684
|
+
# Replace FreeShipping
|
685
|
+
# Replace all attributes of FreeShipping
|
686
|
+
# @param free_shipping_id ID of freeShipping to replace
|
687
|
+
# @param free_shipping Attributes of freeShipping to replace
|
688
|
+
# @param [Hash] opts the optional parameters
|
689
|
+
# @return [FreeShipping]
|
690
|
+
def replace_free_shipping_by_id(free_shipping_id, free_shipping, opts = {})
|
691
|
+
data, _status_code, _headers = replace_free_shipping_by_id_with_http_info(free_shipping_id, free_shipping, opts)
|
692
|
+
data
|
693
|
+
end
|
694
|
+
|
695
|
+
# Replace FreeShipping
|
696
|
+
# Replace all attributes of FreeShipping
|
697
|
+
# @param free_shipping_id ID of freeShipping to replace
|
698
|
+
# @param free_shipping Attributes of freeShipping to replace
|
699
|
+
# @param [Hash] opts the optional parameters
|
700
|
+
# @return [Array<(FreeShipping, Fixnum, Hash)>] FreeShipping data, response status code and response headers
|
701
|
+
def replace_free_shipping_by_id_with_http_info(free_shipping_id, free_shipping, opts = {})
|
702
|
+
if api_client.config.debugging
|
703
|
+
api_client.config.logger.debug 'Calling API: FreeShipping.replace_free_shipping_by_id ...'
|
704
|
+
end
|
705
|
+
# verify the required parameter 'free_shipping_id' is set
|
706
|
+
if api_client.config.client_side_validation && free_shipping_id.nil?
|
707
|
+
fail ArgumentError, "Missing the required parameter 'free_shipping_id' when calling FreeShipping.replace_free_shipping_by_id"
|
708
|
+
end
|
709
|
+
# verify the required parameter 'free_shipping' is set
|
710
|
+
if api_client.config.client_side_validation && free_shipping.nil?
|
711
|
+
fail ArgumentError, "Missing the required parameter 'free_shipping' when calling FreeShipping.replace_free_shipping_by_id"
|
712
|
+
end
|
713
|
+
# resource path
|
714
|
+
local_var_path = '/freeShippings/{freeShippingId}'.sub('{' + 'freeShippingId' + '}', free_shipping_id.to_s)
|
715
|
+
|
716
|
+
# query parameters
|
717
|
+
query_params = opts
|
718
|
+
|
719
|
+
# header parameters
|
720
|
+
header_params = {}
|
721
|
+
# HTTP header 'Accept' (if needed)
|
722
|
+
header_params['Accept'] = api_client.select_header_accept(['application/json'])
|
723
|
+
# HTTP header 'Content-Type'
|
724
|
+
header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
|
725
|
+
|
726
|
+
# form parameters
|
727
|
+
form_params = {}
|
728
|
+
|
729
|
+
# http body (model)
|
730
|
+
post_body = api_client.object_to_http_body(free_shipping)
|
731
|
+
auth_names = []
|
732
|
+
data, status_code, headers = api_client.call_api(:PUT, local_var_path,
|
733
|
+
:header_params => header_params,
|
734
|
+
:query_params => query_params,
|
735
|
+
:form_params => form_params,
|
736
|
+
:body => post_body,
|
737
|
+
:auth_names => auth_names,
|
738
|
+
:return_type => 'FreeShipping')
|
739
|
+
if api_client.config.debugging
|
740
|
+
api_client.config.logger.debug "API called: FreeShipping#replace_free_shipping_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
741
|
+
end
|
742
|
+
return data, status_code, headers
|
743
|
+
end
|
744
|
+
# Update FreeShipping
|
745
|
+
# Update attributes of FreeShipping
|
746
|
+
# @param free_shipping_id ID of freeShipping to update.
|
747
|
+
# @param free_shipping Attributes of freeShipping to update.
|
748
|
+
# @param [Hash] opts the optional parameters
|
749
|
+
# @return [FreeShipping]
|
750
|
+
def update_free_shipping_by_id(free_shipping_id, free_shipping, opts = {})
|
751
|
+
data, _status_code, _headers = update_free_shipping_by_id_with_http_info(free_shipping_id, free_shipping, opts)
|
752
|
+
data
|
753
|
+
end
|
754
|
+
|
755
|
+
# Update FreeShipping
|
756
|
+
# Update attributes of FreeShipping
|
757
|
+
# @param free_shipping_id ID of freeShipping to update.
|
758
|
+
# @param free_shipping Attributes of freeShipping to update.
|
759
|
+
# @param [Hash] opts the optional parameters
|
760
|
+
# @return [Array<(FreeShipping, Fixnum, Hash)>] FreeShipping data, response status code and response headers
|
761
|
+
def update_free_shipping_by_id_with_http_info(free_shipping_id, free_shipping, opts = {})
|
762
|
+
if api_client.config.debugging
|
763
|
+
api_client.config.logger.debug 'Calling API: FreeShipping.update_free_shipping_by_id ...'
|
764
|
+
end
|
765
|
+
# verify the required parameter 'free_shipping_id' is set
|
766
|
+
if api_client.config.client_side_validation && free_shipping_id.nil?
|
767
|
+
fail ArgumentError, "Missing the required parameter 'free_shipping_id' when calling FreeShipping.update_free_shipping_by_id"
|
768
|
+
end
|
769
|
+
# verify the required parameter 'free_shipping' is set
|
770
|
+
if api_client.config.client_side_validation && free_shipping.nil?
|
771
|
+
fail ArgumentError, "Missing the required parameter 'free_shipping' when calling FreeShipping.update_free_shipping_by_id"
|
772
|
+
end
|
773
|
+
# resource path
|
774
|
+
local_var_path = '/freeShippings/{freeShippingId}'.sub('{' + 'freeShippingId' + '}', free_shipping_id.to_s)
|
775
|
+
|
776
|
+
# query parameters
|
777
|
+
query_params = opts
|
778
|
+
|
779
|
+
# header parameters
|
780
|
+
header_params = {}
|
781
|
+
# HTTP header 'Accept' (if needed)
|
782
|
+
header_params['Accept'] = api_client.select_header_accept(['application/json'])
|
783
|
+
# HTTP header 'Content-Type'
|
784
|
+
header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
|
785
|
+
|
786
|
+
# form parameters
|
787
|
+
form_params = {}
|
788
|
+
|
789
|
+
# http body (model)
|
790
|
+
post_body = api_client.object_to_http_body(free_shipping)
|
791
|
+
auth_names = []
|
792
|
+
data, status_code, headers = api_client.call_api(:PATCH, local_var_path,
|
793
|
+
:header_params => header_params,
|
794
|
+
:query_params => query_params,
|
795
|
+
:form_params => form_params,
|
796
|
+
:body => post_body,
|
797
|
+
:auth_names => auth_names,
|
798
|
+
:return_type => 'FreeShipping')
|
799
|
+
if api_client.config.debugging
|
800
|
+
api_client.config.logger.debug "API called: FreeShipping#update_free_shipping_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
801
|
+
end
|
802
|
+
return data, status_code, headers
|
803
|
+
end
|
804
|
+
end
|
805
|
+
end
|
806
|
+
end
|