noths 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +69 -0
  4. data/README.md +149 -0
  5. data/Rakefile +8 -0
  6. data/bin/generate_gem +18 -0
  7. data/bin/refresh_schemas +94 -0
  8. data/docs/AcceptanceBulkModel.md +11 -0
  9. data/docs/Currency.md +11 -0
  10. data/docs/DeclineBulkModel.md +9 -0
  11. data/docs/DeliveryAddress.md +13 -0
  12. data/docs/DeliveryService.md +9 -0
  13. data/docs/DeliveryZone.md +9 -0
  14. data/docs/DispatchBulkModel.md +12 -0
  15. data/docs/DispatchNotesBulkModel.md +8 -0
  16. data/docs/Enquiry.md +10 -0
  17. data/docs/EnquiryMessage.md +8 -0
  18. data/docs/Error.md +9 -0
  19. data/docs/Financials.md +25 -0
  20. data/docs/FinancialsDetails.md +10 -0
  21. data/docs/ImageUrl.md +13 -0
  22. data/docs/Item.md +15 -0
  23. data/docs/ItemFinancials.md +13 -0
  24. data/docs/Link.md +10 -0
  25. data/docs/ManualPayment.md +11 -0
  26. data/docs/Money.md +9 -0
  27. data/docs/Order.md +53 -0
  28. data/docs/OrderDetail.md +9 -0
  29. data/docs/OrderDetailsBulkModel.md +8 -0
  30. data/docs/OrderIndex.md +10 -0
  31. data/docs/OrderRefund.md +8 -0
  32. data/docs/OrdersApi.md +796 -0
  33. data/docs/Product.md +12 -0
  34. data/docs/ProductOption.md +9 -0
  35. data/docs/RefundResponse.md +10 -0
  36. data/docs/RefundsApi.md +69 -0
  37. data/docs/SearchResultMeta.md +9 -0
  38. data/docs/User.md +10 -0
  39. data/lib/noths.rb +70 -0
  40. data/lib/noths/api/orders_api.rb +819 -0
  41. data/lib/noths/api/refunds_api.rb +88 -0
  42. data/lib/noths/api_client.rb +389 -0
  43. data/lib/noths/api_error.rb +38 -0
  44. data/lib/noths/configuration.rb +209 -0
  45. data/lib/noths/models/acceptance_bulk_model.rb +233 -0
  46. data/lib/noths/models/currency.rb +235 -0
  47. data/lib/noths/models/decline_bulk_model.rb +208 -0
  48. data/lib/noths/models/delivery_address.rb +263 -0
  49. data/lib/noths/models/delivery_service.rb +207 -0
  50. data/lib/noths/models/delivery_zone.rb +207 -0
  51. data/lib/noths/models/dispatch_bulk_model.rb +236 -0
  52. data/lib/noths/models/dispatch_notes_bulk_model.rb +194 -0
  53. data/lib/noths/models/enquiry.rb +223 -0
  54. data/lib/noths/models/enquiry_message.rb +193 -0
  55. data/lib/noths/models/error.rb +207 -0
  56. data/lib/noths/models/financials.rb +433 -0
  57. data/lib/noths/models/financials_details.rb +221 -0
  58. data/lib/noths/models/image_url.rb +263 -0
  59. data/lib/noths/models/item.rb +293 -0
  60. data/lib/noths/models/item_financials.rb +263 -0
  61. data/lib/noths/models/link.rb +222 -0
  62. data/lib/noths/models/manual_payment.rb +235 -0
  63. data/lib/noths/models/money.rb +207 -0
  64. data/lib/noths/models/order.rb +812 -0
  65. data/lib/noths/models/order_detail.rb +207 -0
  66. data/lib/noths/models/order_details_bulk_model.rb +194 -0
  67. data/lib/noths/models/order_index.rb +225 -0
  68. data/lib/noths/models/order_refund.rb +193 -0
  69. data/lib/noths/models/product.rb +249 -0
  70. data/lib/noths/models/product_option.rb +207 -0
  71. data/lib/noths/models/refund_response.rb +223 -0
  72. data/lib/noths/models/search_result_meta.rb +207 -0
  73. data/lib/noths/models/user.rb +221 -0
  74. data/lib/noths/version.rb +15 -0
  75. data/noths.gemspec +45 -0
  76. data/schemas/api-docs.json +26 -0
  77. data/schemas/orders.json +2013 -0
  78. data/schemas/refunds.json +128 -0
  79. data/spec/api/orders_api_spec.rb +239 -0
  80. data/spec/api/refunds_api_spec.rb +50 -0
  81. data/spec/api_client_spec.rb +226 -0
  82. data/spec/configuration_spec.rb +42 -0
  83. data/spec/models/acceptance_bulk_model_spec.rb +60 -0
  84. data/spec/models/currency_spec.rb +60 -0
  85. data/spec/models/decline_bulk_model_spec.rb +48 -0
  86. data/spec/models/delivery_address_spec.rb +72 -0
  87. data/spec/models/delivery_service_spec.rb +48 -0
  88. data/spec/models/delivery_zone_spec.rb +48 -0
  89. data/spec/models/dispatch_bulk_model_spec.rb +66 -0
  90. data/spec/models/dispatch_notes_bulk_model_spec.rb +42 -0
  91. data/spec/models/enquiry_message_spec.rb +42 -0
  92. data/spec/models/enquiry_spec.rb +54 -0
  93. data/spec/models/error_spec.rb +48 -0
  94. data/spec/models/financials_details_spec.rb +54 -0
  95. data/spec/models/financials_spec.rb +144 -0
  96. data/spec/models/image_url_spec.rb +72 -0
  97. data/spec/models/item_financials_spec.rb +72 -0
  98. data/spec/models/item_spec.rb +84 -0
  99. data/spec/models/link_spec.rb +54 -0
  100. data/spec/models/manual_payment_spec.rb +60 -0
  101. data/spec/models/money_spec.rb +48 -0
  102. data/spec/models/order_detail_spec.rb +48 -0
  103. data/spec/models/order_details_bulk_model_spec.rb +42 -0
  104. data/spec/models/order_index_spec.rb +54 -0
  105. data/spec/models/order_refund_spec.rb +42 -0
  106. data/spec/models/order_spec.rb +312 -0
  107. data/spec/models/product_option_spec.rb +48 -0
  108. data/spec/models/product_spec.rb +66 -0
  109. data/spec/models/refund_response_spec.rb +54 -0
  110. data/spec/models/search_result_meta_spec.rb +48 -0
  111. data/spec/models/user_spec.rb +54 -0
  112. data/spec/spec_helper.rb +111 -0
  113. data/swagger_config.json +16 -0
  114. metadata +370 -0
@@ -0,0 +1,207 @@
1
+ =begin
2
+ #Noths
3
+
4
+ #www.notonthehighstreet.com API client
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Noths
16
+
17
+ class Error
18
+ attr_accessor :code
19
+
20
+ attr_accessor :title
21
+
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'code' => :'code',
27
+ :'title' => :'title'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.swagger_types
33
+ {
34
+ :'code' => :'String',
35
+ :'title' => :'String'
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ return unless attributes.is_a?(Hash)
43
+
44
+ # convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
46
+
47
+ if attributes.has_key?(:'code')
48
+ self.code = attributes[:'code']
49
+ end
50
+
51
+ if attributes.has_key?(:'title')
52
+ self.title = attributes[:'title']
53
+ end
54
+
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ if @code.nil?
62
+ invalid_properties.push("invalid value for 'code', code cannot be nil.")
63
+ end
64
+
65
+ if @title.nil?
66
+ invalid_properties.push("invalid value for 'title', title cannot be nil.")
67
+ end
68
+
69
+ return invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ return false if @code.nil?
76
+ return false if @title.nil?
77
+ return true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ code == o.code &&
86
+ title == o.title
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Fixnum] Hash code
97
+ def hash
98
+ [code, title].hash
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.swagger_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the 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
+ temp_model = Noths.const_get(type).new
159
+ temp_model.build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map{ |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+
205
+ end
206
+
207
+ end
@@ -0,0 +1,433 @@
1
+ =begin
2
+ #Noths
3
+
4
+ #www.notonthehighstreet.com API client
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Noths
16
+
17
+ class Financials
18
+ attr_accessor :commission
19
+
20
+ attr_accessor :delivery_commission
21
+
22
+ attr_accessor :items_commission
23
+
24
+ attr_accessor :listing_delivery
25
+
26
+ attr_accessor :listing_discount
27
+
28
+ attr_accessor :listing_items
29
+
30
+ attr_accessor :listing_subtotal
31
+
32
+ attr_accessor :listing_total
33
+
34
+ attr_accessor :manual_payment_total
35
+
36
+ attr_accessor :purchase_delivery
37
+
38
+ attr_accessor :purchase_discount
39
+
40
+ attr_accessor :purchase_items
41
+
42
+ attr_accessor :purchase_subtotal
43
+
44
+ attr_accessor :purchase_total
45
+
46
+ attr_accessor :partner_total
47
+
48
+ attr_accessor :listing_items_discounted
49
+
50
+ attr_accessor :listing_total_with_discount
51
+
52
+ attr_accessor :manual_payments
53
+
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'commission' => :'commission',
59
+ :'delivery_commission' => :'delivery_commission',
60
+ :'items_commission' => :'items_commission',
61
+ :'listing_delivery' => :'listing_delivery',
62
+ :'listing_discount' => :'listing_discount',
63
+ :'listing_items' => :'listing_items',
64
+ :'listing_subtotal' => :'listing_subtotal',
65
+ :'listing_total' => :'listing_total',
66
+ :'manual_payment_total' => :'manual_payment_total',
67
+ :'purchase_delivery' => :'purchase_delivery',
68
+ :'purchase_discount' => :'purchase_discount',
69
+ :'purchase_items' => :'purchase_items',
70
+ :'purchase_subtotal' => :'purchase_subtotal',
71
+ :'purchase_total' => :'purchase_total',
72
+ :'partner_total' => :'partner_total',
73
+ :'listing_items_discounted' => :'listing_items_discounted',
74
+ :'listing_total_with_discount' => :'listing_total_with_discount',
75
+ :'manual_payments' => :'manual_payments'
76
+ }
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.swagger_types
81
+ {
82
+ :'commission' => :'FinancialsDetails',
83
+ :'delivery_commission' => :'FinancialsDetails',
84
+ :'items_commission' => :'FinancialsDetails',
85
+ :'listing_delivery' => :'FinancialsDetails',
86
+ :'listing_discount' => :'FinancialsDetails',
87
+ :'listing_items' => :'FinancialsDetails',
88
+ :'listing_subtotal' => :'FinancialsDetails',
89
+ :'listing_total' => :'FinancialsDetails',
90
+ :'manual_payment_total' => :'FinancialsDetails',
91
+ :'purchase_delivery' => :'FinancialsDetails',
92
+ :'purchase_discount' => :'FinancialsDetails',
93
+ :'purchase_items' => :'FinancialsDetails',
94
+ :'purchase_subtotal' => :'FinancialsDetails',
95
+ :'purchase_total' => :'FinancialsDetails',
96
+ :'partner_total' => :'FinancialsDetails',
97
+ :'listing_items_discounted' => :'FinancialsDetails',
98
+ :'listing_total_with_discount' => :'FinancialsDetails',
99
+ :'manual_payments' => :'Array<ManualPayment>'
100
+ }
101
+ end
102
+
103
+ # Initializes the object
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ def initialize(attributes = {})
106
+ return unless attributes.is_a?(Hash)
107
+
108
+ # convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
110
+
111
+ if attributes.has_key?(:'commission')
112
+ self.commission = attributes[:'commission']
113
+ end
114
+
115
+ if attributes.has_key?(:'delivery_commission')
116
+ self.delivery_commission = attributes[:'delivery_commission']
117
+ end
118
+
119
+ if attributes.has_key?(:'items_commission')
120
+ self.items_commission = attributes[:'items_commission']
121
+ end
122
+
123
+ if attributes.has_key?(:'listing_delivery')
124
+ self.listing_delivery = attributes[:'listing_delivery']
125
+ end
126
+
127
+ if attributes.has_key?(:'listing_discount')
128
+ self.listing_discount = attributes[:'listing_discount']
129
+ end
130
+
131
+ if attributes.has_key?(:'listing_items')
132
+ self.listing_items = attributes[:'listing_items']
133
+ end
134
+
135
+ if attributes.has_key?(:'listing_subtotal')
136
+ self.listing_subtotal = attributes[:'listing_subtotal']
137
+ end
138
+
139
+ if attributes.has_key?(:'listing_total')
140
+ self.listing_total = attributes[:'listing_total']
141
+ end
142
+
143
+ if attributes.has_key?(:'manual_payment_total')
144
+ self.manual_payment_total = attributes[:'manual_payment_total']
145
+ end
146
+
147
+ if attributes.has_key?(:'purchase_delivery')
148
+ self.purchase_delivery = attributes[:'purchase_delivery']
149
+ end
150
+
151
+ if attributes.has_key?(:'purchase_discount')
152
+ self.purchase_discount = attributes[:'purchase_discount']
153
+ end
154
+
155
+ if attributes.has_key?(:'purchase_items')
156
+ self.purchase_items = attributes[:'purchase_items']
157
+ end
158
+
159
+ if attributes.has_key?(:'purchase_subtotal')
160
+ self.purchase_subtotal = attributes[:'purchase_subtotal']
161
+ end
162
+
163
+ if attributes.has_key?(:'purchase_total')
164
+ self.purchase_total = attributes[:'purchase_total']
165
+ end
166
+
167
+ if attributes.has_key?(:'partner_total')
168
+ self.partner_total = attributes[:'partner_total']
169
+ end
170
+
171
+ if attributes.has_key?(:'listing_items_discounted')
172
+ self.listing_items_discounted = attributes[:'listing_items_discounted']
173
+ end
174
+
175
+ if attributes.has_key?(:'listing_total_with_discount')
176
+ self.listing_total_with_discount = attributes[:'listing_total_with_discount']
177
+ end
178
+
179
+ if attributes.has_key?(:'manual_payments')
180
+ if (value = attributes[:'manual_payments']).is_a?(Array)
181
+ self.manual_payments = value
182
+ end
183
+ end
184
+
185
+ end
186
+
187
+ # Show invalid properties with the reasons. Usually used together with valid?
188
+ # @return Array for valid properties with the reasons
189
+ def list_invalid_properties
190
+ invalid_properties = Array.new
191
+ if @commission.nil?
192
+ invalid_properties.push("invalid value for 'commission', commission cannot be nil.")
193
+ end
194
+
195
+ if @delivery_commission.nil?
196
+ invalid_properties.push("invalid value for 'delivery_commission', delivery_commission cannot be nil.")
197
+ end
198
+
199
+ if @items_commission.nil?
200
+ invalid_properties.push("invalid value for 'items_commission', items_commission cannot be nil.")
201
+ end
202
+
203
+ if @listing_delivery.nil?
204
+ invalid_properties.push("invalid value for 'listing_delivery', listing_delivery cannot be nil.")
205
+ end
206
+
207
+ if @listing_discount.nil?
208
+ invalid_properties.push("invalid value for 'listing_discount', listing_discount cannot be nil.")
209
+ end
210
+
211
+ if @listing_items.nil?
212
+ invalid_properties.push("invalid value for 'listing_items', listing_items cannot be nil.")
213
+ end
214
+
215
+ if @listing_subtotal.nil?
216
+ invalid_properties.push("invalid value for 'listing_subtotal', listing_subtotal cannot be nil.")
217
+ end
218
+
219
+ if @listing_total.nil?
220
+ invalid_properties.push("invalid value for 'listing_total', listing_total cannot be nil.")
221
+ end
222
+
223
+ if @manual_payment_total.nil?
224
+ invalid_properties.push("invalid value for 'manual_payment_total', manual_payment_total cannot be nil.")
225
+ end
226
+
227
+ if @purchase_delivery.nil?
228
+ invalid_properties.push("invalid value for 'purchase_delivery', purchase_delivery cannot be nil.")
229
+ end
230
+
231
+ if @purchase_discount.nil?
232
+ invalid_properties.push("invalid value for 'purchase_discount', purchase_discount cannot be nil.")
233
+ end
234
+
235
+ if @purchase_items.nil?
236
+ invalid_properties.push("invalid value for 'purchase_items', purchase_items cannot be nil.")
237
+ end
238
+
239
+ if @purchase_subtotal.nil?
240
+ invalid_properties.push("invalid value for 'purchase_subtotal', purchase_subtotal cannot be nil.")
241
+ end
242
+
243
+ if @purchase_total.nil?
244
+ invalid_properties.push("invalid value for 'purchase_total', purchase_total cannot be nil.")
245
+ end
246
+
247
+ if @partner_total.nil?
248
+ invalid_properties.push("invalid value for 'partner_total', partner_total cannot be nil.")
249
+ end
250
+
251
+ if @listing_items_discounted.nil?
252
+ invalid_properties.push("invalid value for 'listing_items_discounted', listing_items_discounted cannot be nil.")
253
+ end
254
+
255
+ if @listing_total_with_discount.nil?
256
+ invalid_properties.push("invalid value for 'listing_total_with_discount', listing_total_with_discount cannot be nil.")
257
+ end
258
+
259
+ if @manual_payments.nil?
260
+ invalid_properties.push("invalid value for 'manual_payments', manual_payments cannot be nil.")
261
+ end
262
+
263
+ return invalid_properties
264
+ end
265
+
266
+ # Check to see if the all the properties in the model are valid
267
+ # @return true if the model is valid
268
+ def valid?
269
+ return false if @commission.nil?
270
+ return false if @delivery_commission.nil?
271
+ return false if @items_commission.nil?
272
+ return false if @listing_delivery.nil?
273
+ return false if @listing_discount.nil?
274
+ return false if @listing_items.nil?
275
+ return false if @listing_subtotal.nil?
276
+ return false if @listing_total.nil?
277
+ return false if @manual_payment_total.nil?
278
+ return false if @purchase_delivery.nil?
279
+ return false if @purchase_discount.nil?
280
+ return false if @purchase_items.nil?
281
+ return false if @purchase_subtotal.nil?
282
+ return false if @purchase_total.nil?
283
+ return false if @partner_total.nil?
284
+ return false if @listing_items_discounted.nil?
285
+ return false if @listing_total_with_discount.nil?
286
+ return false if @manual_payments.nil?
287
+ return true
288
+ end
289
+
290
+ # Checks equality by comparing each attribute.
291
+ # @param [Object] Object to be compared
292
+ def ==(o)
293
+ return true if self.equal?(o)
294
+ self.class == o.class &&
295
+ commission == o.commission &&
296
+ delivery_commission == o.delivery_commission &&
297
+ items_commission == o.items_commission &&
298
+ listing_delivery == o.listing_delivery &&
299
+ listing_discount == o.listing_discount &&
300
+ listing_items == o.listing_items &&
301
+ listing_subtotal == o.listing_subtotal &&
302
+ listing_total == o.listing_total &&
303
+ manual_payment_total == o.manual_payment_total &&
304
+ purchase_delivery == o.purchase_delivery &&
305
+ purchase_discount == o.purchase_discount &&
306
+ purchase_items == o.purchase_items &&
307
+ purchase_subtotal == o.purchase_subtotal &&
308
+ purchase_total == o.purchase_total &&
309
+ partner_total == o.partner_total &&
310
+ listing_items_discounted == o.listing_items_discounted &&
311
+ listing_total_with_discount == o.listing_total_with_discount &&
312
+ manual_payments == o.manual_payments
313
+ end
314
+
315
+ # @see the `==` method
316
+ # @param [Object] Object to be compared
317
+ def eql?(o)
318
+ self == o
319
+ end
320
+
321
+ # Calculates hash code according to all attributes.
322
+ # @return [Fixnum] Hash code
323
+ def hash
324
+ [commission, delivery_commission, items_commission, listing_delivery, listing_discount, listing_items, listing_subtotal, listing_total, manual_payment_total, purchase_delivery, purchase_discount, purchase_items, purchase_subtotal, purchase_total, partner_total, listing_items_discounted, listing_total_with_discount, manual_payments].hash
325
+ end
326
+
327
+ # Builds the object from hash
328
+ # @param [Hash] attributes Model attributes in the form of hash
329
+ # @return [Object] Returns the model itself
330
+ def build_from_hash(attributes)
331
+ return nil unless attributes.is_a?(Hash)
332
+ self.class.swagger_types.each_pair do |key, type|
333
+ if type =~ /\AArray<(.*)>/i
334
+ # check to ensure the input is an array given that the the attribute
335
+ # is documented as an array but the input is not
336
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
337
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
338
+ end
339
+ elsif !attributes[self.class.attribute_map[key]].nil?
340
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
341
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
342
+ end
343
+
344
+ self
345
+ end
346
+
347
+ # Deserializes the data based on type
348
+ # @param string type Data type
349
+ # @param string value Value to be deserialized
350
+ # @return [Object] Deserialized data
351
+ def _deserialize(type, value)
352
+ case type.to_sym
353
+ when :DateTime
354
+ DateTime.parse(value)
355
+ when :Date
356
+ Date.parse(value)
357
+ when :String
358
+ value.to_s
359
+ when :Integer
360
+ value.to_i
361
+ when :Float
362
+ value.to_f
363
+ when :BOOLEAN
364
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
365
+ true
366
+ else
367
+ false
368
+ end
369
+ when :Object
370
+ # generic object (usually a Hash), return directly
371
+ value
372
+ when /\AArray<(?<inner_type>.+)>\z/
373
+ inner_type = Regexp.last_match[:inner_type]
374
+ value.map { |v| _deserialize(inner_type, v) }
375
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
376
+ k_type = Regexp.last_match[:k_type]
377
+ v_type = Regexp.last_match[:v_type]
378
+ {}.tap do |hash|
379
+ value.each do |k, v|
380
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
381
+ end
382
+ end
383
+ else # model
384
+ temp_model = Noths.const_get(type).new
385
+ temp_model.build_from_hash(value)
386
+ end
387
+ end
388
+
389
+ # Returns the string representation of the object
390
+ # @return [String] String presentation of the object
391
+ def to_s
392
+ to_hash.to_s
393
+ end
394
+
395
+ # to_body is an alias to to_hash (backward compatibility)
396
+ # @return [Hash] Returns the object in the form of hash
397
+ def to_body
398
+ to_hash
399
+ end
400
+
401
+ # Returns the object in the form of hash
402
+ # @return [Hash] Returns the object in the form of hash
403
+ def to_hash
404
+ hash = {}
405
+ self.class.attribute_map.each_pair do |attr, param|
406
+ value = self.send(attr)
407
+ next if value.nil?
408
+ hash[param] = _to_hash(value)
409
+ end
410
+ hash
411
+ end
412
+
413
+ # Outputs non-array value in the form of hash
414
+ # For object, use to_hash. Otherwise, just return the value
415
+ # @param [Object] value Any valid value
416
+ # @return [Hash] Returns the value in the form of hash
417
+ def _to_hash(value)
418
+ if value.is_a?(Array)
419
+ value.compact.map{ |v| _to_hash(v) }
420
+ elsif value.is_a?(Hash)
421
+ {}.tap do |hash|
422
+ value.each { |k, v| hash[k] = _to_hash(v) }
423
+ end
424
+ elsif value.respond_to? :to_hash
425
+ value.to_hash
426
+ else
427
+ value
428
+ end
429
+ end
430
+
431
+ end
432
+
433
+ end