noths 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/README.md +149 -0
- data/Rakefile +8 -0
- data/bin/generate_gem +18 -0
- data/bin/refresh_schemas +94 -0
- data/docs/AcceptanceBulkModel.md +11 -0
- data/docs/Currency.md +11 -0
- data/docs/DeclineBulkModel.md +9 -0
- data/docs/DeliveryAddress.md +13 -0
- data/docs/DeliveryService.md +9 -0
- data/docs/DeliveryZone.md +9 -0
- data/docs/DispatchBulkModel.md +12 -0
- data/docs/DispatchNotesBulkModel.md +8 -0
- data/docs/Enquiry.md +10 -0
- data/docs/EnquiryMessage.md +8 -0
- data/docs/Error.md +9 -0
- data/docs/Financials.md +25 -0
- data/docs/FinancialsDetails.md +10 -0
- data/docs/ImageUrl.md +13 -0
- data/docs/Item.md +15 -0
- data/docs/ItemFinancials.md +13 -0
- data/docs/Link.md +10 -0
- data/docs/ManualPayment.md +11 -0
- data/docs/Money.md +9 -0
- data/docs/Order.md +53 -0
- data/docs/OrderDetail.md +9 -0
- data/docs/OrderDetailsBulkModel.md +8 -0
- data/docs/OrderIndex.md +10 -0
- data/docs/OrderRefund.md +8 -0
- data/docs/OrdersApi.md +796 -0
- data/docs/Product.md +12 -0
- data/docs/ProductOption.md +9 -0
- data/docs/RefundResponse.md +10 -0
- data/docs/RefundsApi.md +69 -0
- data/docs/SearchResultMeta.md +9 -0
- data/docs/User.md +10 -0
- data/lib/noths.rb +70 -0
- data/lib/noths/api/orders_api.rb +819 -0
- data/lib/noths/api/refunds_api.rb +88 -0
- data/lib/noths/api_client.rb +389 -0
- data/lib/noths/api_error.rb +38 -0
- data/lib/noths/configuration.rb +209 -0
- data/lib/noths/models/acceptance_bulk_model.rb +233 -0
- data/lib/noths/models/currency.rb +235 -0
- data/lib/noths/models/decline_bulk_model.rb +208 -0
- data/lib/noths/models/delivery_address.rb +263 -0
- data/lib/noths/models/delivery_service.rb +207 -0
- data/lib/noths/models/delivery_zone.rb +207 -0
- data/lib/noths/models/dispatch_bulk_model.rb +236 -0
- data/lib/noths/models/dispatch_notes_bulk_model.rb +194 -0
- data/lib/noths/models/enquiry.rb +223 -0
- data/lib/noths/models/enquiry_message.rb +193 -0
- data/lib/noths/models/error.rb +207 -0
- data/lib/noths/models/financials.rb +433 -0
- data/lib/noths/models/financials_details.rb +221 -0
- data/lib/noths/models/image_url.rb +263 -0
- data/lib/noths/models/item.rb +293 -0
- data/lib/noths/models/item_financials.rb +263 -0
- data/lib/noths/models/link.rb +222 -0
- data/lib/noths/models/manual_payment.rb +235 -0
- data/lib/noths/models/money.rb +207 -0
- data/lib/noths/models/order.rb +812 -0
- data/lib/noths/models/order_detail.rb +207 -0
- data/lib/noths/models/order_details_bulk_model.rb +194 -0
- data/lib/noths/models/order_index.rb +225 -0
- data/lib/noths/models/order_refund.rb +193 -0
- data/lib/noths/models/product.rb +249 -0
- data/lib/noths/models/product_option.rb +207 -0
- data/lib/noths/models/refund_response.rb +223 -0
- data/lib/noths/models/search_result_meta.rb +207 -0
- data/lib/noths/models/user.rb +221 -0
- data/lib/noths/version.rb +15 -0
- data/noths.gemspec +45 -0
- data/schemas/api-docs.json +26 -0
- data/schemas/orders.json +2013 -0
- data/schemas/refunds.json +128 -0
- data/spec/api/orders_api_spec.rb +239 -0
- data/spec/api/refunds_api_spec.rb +50 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/acceptance_bulk_model_spec.rb +60 -0
- data/spec/models/currency_spec.rb +60 -0
- data/spec/models/decline_bulk_model_spec.rb +48 -0
- data/spec/models/delivery_address_spec.rb +72 -0
- data/spec/models/delivery_service_spec.rb +48 -0
- data/spec/models/delivery_zone_spec.rb +48 -0
- data/spec/models/dispatch_bulk_model_spec.rb +66 -0
- data/spec/models/dispatch_notes_bulk_model_spec.rb +42 -0
- data/spec/models/enquiry_message_spec.rb +42 -0
- data/spec/models/enquiry_spec.rb +54 -0
- data/spec/models/error_spec.rb +48 -0
- data/spec/models/financials_details_spec.rb +54 -0
- data/spec/models/financials_spec.rb +144 -0
- data/spec/models/image_url_spec.rb +72 -0
- data/spec/models/item_financials_spec.rb +72 -0
- data/spec/models/item_spec.rb +84 -0
- data/spec/models/link_spec.rb +54 -0
- data/spec/models/manual_payment_spec.rb +60 -0
- data/spec/models/money_spec.rb +48 -0
- data/spec/models/order_detail_spec.rb +48 -0
- data/spec/models/order_details_bulk_model_spec.rb +42 -0
- data/spec/models/order_index_spec.rb +54 -0
- data/spec/models/order_refund_spec.rb +42 -0
- data/spec/models/order_spec.rb +312 -0
- data/spec/models/product_option_spec.rb +48 -0
- data/spec/models/product_spec.rb +66 -0
- data/spec/models/refund_response_spec.rb +54 -0
- data/spec/models/search_result_meta_spec.rb +48 -0
- data/spec/models/user_spec.rb +54 -0
- data/spec/spec_helper.rb +111 -0
- data/swagger_config.json +16 -0
- 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 Money
|
18
|
+
attr_accessor :cents
|
19
|
+
|
20
|
+
attr_accessor :currency
|
21
|
+
|
22
|
+
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
24
|
+
def self.attribute_map
|
25
|
+
{
|
26
|
+
:'cents' => :'cents',
|
27
|
+
:'currency' => :'currency'
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Attribute type mapping.
|
32
|
+
def self.swagger_types
|
33
|
+
{
|
34
|
+
:'cents' => :'Integer',
|
35
|
+
:'currency' => :'Currency'
|
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?(:'cents')
|
48
|
+
self.cents = attributes[:'cents']
|
49
|
+
end
|
50
|
+
|
51
|
+
if attributes.has_key?(:'currency')
|
52
|
+
self.currency = attributes[:'currency']
|
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 @cents.nil?
|
62
|
+
invalid_properties.push("invalid value for 'cents', cents cannot be nil.")
|
63
|
+
end
|
64
|
+
|
65
|
+
if @currency.nil?
|
66
|
+
invalid_properties.push("invalid value for 'currency', currency 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 @cents.nil?
|
76
|
+
return false if @currency.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
|
+
cents == o.cents &&
|
86
|
+
currency == o.currency
|
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
|
+
[cents, currency].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,812 @@
|
|
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 Order
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
attr_accessor :state
|
21
|
+
|
22
|
+
attr_accessor :confirm_by
|
23
|
+
|
24
|
+
attr_accessor :estimated_dispatch_at
|
25
|
+
|
26
|
+
attr_accessor :placed_at
|
27
|
+
|
28
|
+
attr_accessor :expired_at
|
29
|
+
|
30
|
+
attr_accessor :declined_at
|
31
|
+
|
32
|
+
attr_accessor :accepted_at
|
33
|
+
|
34
|
+
attr_accessor :dispatched_at
|
35
|
+
|
36
|
+
attr_accessor :archived_at
|
37
|
+
|
38
|
+
attr_accessor :repeat_customer
|
39
|
+
|
40
|
+
attr_accessor :customer_expected_delivery_date
|
41
|
+
|
42
|
+
attr_accessor :number
|
43
|
+
|
44
|
+
attr_accessor :dispatch_note_viewed
|
45
|
+
|
46
|
+
attr_accessor :express
|
47
|
+
|
48
|
+
attr_accessor :partner_name
|
49
|
+
|
50
|
+
attr_accessor :delivery_recipient_name
|
51
|
+
|
52
|
+
attr_accessor :delivery_recipient_first_name
|
53
|
+
|
54
|
+
attr_accessor :delivery_recipient_last_name
|
55
|
+
|
56
|
+
attr_accessor :international
|
57
|
+
|
58
|
+
attr_accessor :dispatch_overdue
|
59
|
+
|
60
|
+
attr_accessor :gift
|
61
|
+
|
62
|
+
attr_accessor :gift_message
|
63
|
+
|
64
|
+
attr_accessor :gift_wrap
|
65
|
+
|
66
|
+
attr_accessor :gift_receipt
|
67
|
+
|
68
|
+
attr_accessor :delivery_note
|
69
|
+
|
70
|
+
attr_accessor :has_enquiry
|
71
|
+
|
72
|
+
attr_accessor :estimated_delivery_date
|
73
|
+
|
74
|
+
# null in sites where rebates are not offered
|
75
|
+
attr_accessor :rebate_qualified
|
76
|
+
|
77
|
+
# null in sites where rebates are not offered
|
78
|
+
attr_accessor :rebate_achieved
|
79
|
+
|
80
|
+
attr_accessor :financials
|
81
|
+
|
82
|
+
attr_accessor :promotion_discount
|
83
|
+
|
84
|
+
attr_accessor :promotion_present
|
85
|
+
|
86
|
+
attr_accessor :remaining_refund_amount
|
87
|
+
|
88
|
+
attr_accessor :refund_total
|
89
|
+
|
90
|
+
attr_accessor :extra_refund_amount
|
91
|
+
|
92
|
+
attr_accessor :user
|
93
|
+
|
94
|
+
attr_accessor :delivery_address
|
95
|
+
|
96
|
+
attr_accessor :delivery_zone
|
97
|
+
|
98
|
+
attr_accessor :delivery_service
|
99
|
+
|
100
|
+
attr_accessor :order_detail
|
101
|
+
|
102
|
+
attr_accessor :order_total
|
103
|
+
|
104
|
+
attr_accessor :delivery_total
|
105
|
+
|
106
|
+
attr_accessor :enquiry
|
107
|
+
|
108
|
+
attr_accessor :items
|
109
|
+
|
110
|
+
attr_accessor :links
|
111
|
+
|
112
|
+
|
113
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
114
|
+
def self.attribute_map
|
115
|
+
{
|
116
|
+
:'id' => :'id',
|
117
|
+
:'state' => :'state',
|
118
|
+
:'confirm_by' => :'confirm_by',
|
119
|
+
:'estimated_dispatch_at' => :'estimated_dispatch_at',
|
120
|
+
:'placed_at' => :'placed_at',
|
121
|
+
:'expired_at' => :'expired_at',
|
122
|
+
:'declined_at' => :'declined_at',
|
123
|
+
:'accepted_at' => :'accepted_at',
|
124
|
+
:'dispatched_at' => :'dispatched_at',
|
125
|
+
:'archived_at' => :'archived_at',
|
126
|
+
:'repeat_customer' => :'repeat_customer',
|
127
|
+
:'customer_expected_delivery_date' => :'customer_expected_delivery_date',
|
128
|
+
:'number' => :'number',
|
129
|
+
:'dispatch_note_viewed' => :'dispatch_note_viewed',
|
130
|
+
:'express' => :'express',
|
131
|
+
:'partner_name' => :'partner_name',
|
132
|
+
:'delivery_recipient_name' => :'delivery_recipient_name',
|
133
|
+
:'delivery_recipient_first_name' => :'delivery_recipient_first_name',
|
134
|
+
:'delivery_recipient_last_name' => :'delivery_recipient_last_name',
|
135
|
+
:'international' => :'international',
|
136
|
+
:'dispatch_overdue' => :'dispatch_overdue',
|
137
|
+
:'gift' => :'gift',
|
138
|
+
:'gift_message' => :'gift_message',
|
139
|
+
:'gift_wrap' => :'gift_wrap',
|
140
|
+
:'gift_receipt' => :'gift_receipt',
|
141
|
+
:'delivery_note' => :'delivery_note',
|
142
|
+
:'has_enquiry' => :'has_enquiry',
|
143
|
+
:'estimated_delivery_date' => :'estimated_delivery_date',
|
144
|
+
:'rebate_qualified' => :'rebate_qualified',
|
145
|
+
:'rebate_achieved' => :'rebate_achieved',
|
146
|
+
:'financials' => :'financials',
|
147
|
+
:'promotion_discount' => :'promotion_discount',
|
148
|
+
:'promotion_present' => :'promotion_present',
|
149
|
+
:'remaining_refund_amount' => :'remaining_refund_amount',
|
150
|
+
:'refund_total' => :'refund_total',
|
151
|
+
:'extra_refund_amount' => :'extra_refund_amount',
|
152
|
+
:'user' => :'user',
|
153
|
+
:'delivery_address' => :'delivery_address',
|
154
|
+
:'delivery_zone' => :'delivery_zone',
|
155
|
+
:'delivery_service' => :'delivery_service',
|
156
|
+
:'order_detail' => :'order_detail',
|
157
|
+
:'order_total' => :'order_total',
|
158
|
+
:'delivery_total' => :'delivery_total',
|
159
|
+
:'enquiry' => :'enquiry',
|
160
|
+
:'items' => :'items',
|
161
|
+
:'links' => :'links'
|
162
|
+
}
|
163
|
+
end
|
164
|
+
|
165
|
+
# Attribute type mapping.
|
166
|
+
def self.swagger_types
|
167
|
+
{
|
168
|
+
:'id' => :'Integer',
|
169
|
+
:'state' => :'String',
|
170
|
+
:'confirm_by' => :'Date',
|
171
|
+
:'estimated_dispatch_at' => :'Date',
|
172
|
+
:'placed_at' => :'Date',
|
173
|
+
:'expired_at' => :'Date',
|
174
|
+
:'declined_at' => :'Date',
|
175
|
+
:'accepted_at' => :'Date',
|
176
|
+
:'dispatched_at' => :'Date',
|
177
|
+
:'archived_at' => :'Date',
|
178
|
+
:'repeat_customer' => :'BOOLEAN',
|
179
|
+
:'customer_expected_delivery_date' => :'Date',
|
180
|
+
:'number' => :'String',
|
181
|
+
:'dispatch_note_viewed' => :'BOOLEAN',
|
182
|
+
:'express' => :'BOOLEAN',
|
183
|
+
:'partner_name' => :'String',
|
184
|
+
:'delivery_recipient_name' => :'String',
|
185
|
+
:'delivery_recipient_first_name' => :'String',
|
186
|
+
:'delivery_recipient_last_name' => :'String',
|
187
|
+
:'international' => :'BOOLEAN',
|
188
|
+
:'dispatch_overdue' => :'BOOLEAN',
|
189
|
+
:'gift' => :'BOOLEAN',
|
190
|
+
:'gift_message' => :'String',
|
191
|
+
:'gift_wrap' => :'BOOLEAN',
|
192
|
+
:'gift_receipt' => :'BOOLEAN',
|
193
|
+
:'delivery_note' => :'String',
|
194
|
+
:'has_enquiry' => :'BOOLEAN',
|
195
|
+
:'estimated_delivery_date' => :'Date',
|
196
|
+
:'rebate_qualified' => :'BOOLEAN',
|
197
|
+
:'rebate_achieved' => :'BOOLEAN',
|
198
|
+
:'financials' => :'Financials',
|
199
|
+
:'promotion_discount' => :'Integer',
|
200
|
+
:'promotion_present' => :'BOOLEAN',
|
201
|
+
:'remaining_refund_amount' => :'Money',
|
202
|
+
:'refund_total' => :'Money',
|
203
|
+
:'extra_refund_amount' => :'Money',
|
204
|
+
:'user' => :'User',
|
205
|
+
:'delivery_address' => :'DeliveryAddress',
|
206
|
+
:'delivery_zone' => :'DeliveryZone',
|
207
|
+
:'delivery_service' => :'DeliveryService',
|
208
|
+
:'order_detail' => :'OrderDetail',
|
209
|
+
:'order_total' => :'Money',
|
210
|
+
:'delivery_total' => :'Money',
|
211
|
+
:'enquiry' => :'Enquiry',
|
212
|
+
:'items' => :'Item',
|
213
|
+
:'links' => :'Array<Link>'
|
214
|
+
}
|
215
|
+
end
|
216
|
+
|
217
|
+
# Initializes the object
|
218
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
219
|
+
def initialize(attributes = {})
|
220
|
+
return unless attributes.is_a?(Hash)
|
221
|
+
|
222
|
+
# convert string to symbol for hash key
|
223
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
224
|
+
|
225
|
+
if attributes.has_key?(:'id')
|
226
|
+
self.id = attributes[:'id']
|
227
|
+
end
|
228
|
+
|
229
|
+
if attributes.has_key?(:'state')
|
230
|
+
self.state = attributes[:'state']
|
231
|
+
end
|
232
|
+
|
233
|
+
if attributes.has_key?(:'confirm_by')
|
234
|
+
self.confirm_by = attributes[:'confirm_by']
|
235
|
+
end
|
236
|
+
|
237
|
+
if attributes.has_key?(:'estimated_dispatch_at')
|
238
|
+
self.estimated_dispatch_at = attributes[:'estimated_dispatch_at']
|
239
|
+
end
|
240
|
+
|
241
|
+
if attributes.has_key?(:'placed_at')
|
242
|
+
self.placed_at = attributes[:'placed_at']
|
243
|
+
end
|
244
|
+
|
245
|
+
if attributes.has_key?(:'expired_at')
|
246
|
+
self.expired_at = attributes[:'expired_at']
|
247
|
+
end
|
248
|
+
|
249
|
+
if attributes.has_key?(:'declined_at')
|
250
|
+
self.declined_at = attributes[:'declined_at']
|
251
|
+
end
|
252
|
+
|
253
|
+
if attributes.has_key?(:'accepted_at')
|
254
|
+
self.accepted_at = attributes[:'accepted_at']
|
255
|
+
end
|
256
|
+
|
257
|
+
if attributes.has_key?(:'dispatched_at')
|
258
|
+
self.dispatched_at = attributes[:'dispatched_at']
|
259
|
+
end
|
260
|
+
|
261
|
+
if attributes.has_key?(:'archived_at')
|
262
|
+
self.archived_at = attributes[:'archived_at']
|
263
|
+
end
|
264
|
+
|
265
|
+
if attributes.has_key?(:'repeat_customer')
|
266
|
+
self.repeat_customer = attributes[:'repeat_customer']
|
267
|
+
end
|
268
|
+
|
269
|
+
if attributes.has_key?(:'customer_expected_delivery_date')
|
270
|
+
self.customer_expected_delivery_date = attributes[:'customer_expected_delivery_date']
|
271
|
+
end
|
272
|
+
|
273
|
+
if attributes.has_key?(:'number')
|
274
|
+
self.number = attributes[:'number']
|
275
|
+
end
|
276
|
+
|
277
|
+
if attributes.has_key?(:'dispatch_note_viewed')
|
278
|
+
self.dispatch_note_viewed = attributes[:'dispatch_note_viewed']
|
279
|
+
end
|
280
|
+
|
281
|
+
if attributes.has_key?(:'express')
|
282
|
+
self.express = attributes[:'express']
|
283
|
+
end
|
284
|
+
|
285
|
+
if attributes.has_key?(:'partner_name')
|
286
|
+
self.partner_name = attributes[:'partner_name']
|
287
|
+
end
|
288
|
+
|
289
|
+
if attributes.has_key?(:'delivery_recipient_name')
|
290
|
+
self.delivery_recipient_name = attributes[:'delivery_recipient_name']
|
291
|
+
end
|
292
|
+
|
293
|
+
if attributes.has_key?(:'delivery_recipient_first_name')
|
294
|
+
self.delivery_recipient_first_name = attributes[:'delivery_recipient_first_name']
|
295
|
+
end
|
296
|
+
|
297
|
+
if attributes.has_key?(:'delivery_recipient_last_name')
|
298
|
+
self.delivery_recipient_last_name = attributes[:'delivery_recipient_last_name']
|
299
|
+
end
|
300
|
+
|
301
|
+
if attributes.has_key?(:'international')
|
302
|
+
self.international = attributes[:'international']
|
303
|
+
end
|
304
|
+
|
305
|
+
if attributes.has_key?(:'dispatch_overdue')
|
306
|
+
self.dispatch_overdue = attributes[:'dispatch_overdue']
|
307
|
+
end
|
308
|
+
|
309
|
+
if attributes.has_key?(:'gift')
|
310
|
+
self.gift = attributes[:'gift']
|
311
|
+
end
|
312
|
+
|
313
|
+
if attributes.has_key?(:'gift_message')
|
314
|
+
self.gift_message = attributes[:'gift_message']
|
315
|
+
end
|
316
|
+
|
317
|
+
if attributes.has_key?(:'gift_wrap')
|
318
|
+
self.gift_wrap = attributes[:'gift_wrap']
|
319
|
+
end
|
320
|
+
|
321
|
+
if attributes.has_key?(:'gift_receipt')
|
322
|
+
self.gift_receipt = attributes[:'gift_receipt']
|
323
|
+
end
|
324
|
+
|
325
|
+
if attributes.has_key?(:'delivery_note')
|
326
|
+
self.delivery_note = attributes[:'delivery_note']
|
327
|
+
end
|
328
|
+
|
329
|
+
if attributes.has_key?(:'has_enquiry')
|
330
|
+
self.has_enquiry = attributes[:'has_enquiry']
|
331
|
+
end
|
332
|
+
|
333
|
+
if attributes.has_key?(:'estimated_delivery_date')
|
334
|
+
self.estimated_delivery_date = attributes[:'estimated_delivery_date']
|
335
|
+
end
|
336
|
+
|
337
|
+
if attributes.has_key?(:'rebate_qualified')
|
338
|
+
self.rebate_qualified = attributes[:'rebate_qualified']
|
339
|
+
end
|
340
|
+
|
341
|
+
if attributes.has_key?(:'rebate_achieved')
|
342
|
+
self.rebate_achieved = attributes[:'rebate_achieved']
|
343
|
+
end
|
344
|
+
|
345
|
+
if attributes.has_key?(:'financials')
|
346
|
+
self.financials = attributes[:'financials']
|
347
|
+
end
|
348
|
+
|
349
|
+
if attributes.has_key?(:'promotion_discount')
|
350
|
+
self.promotion_discount = attributes[:'promotion_discount']
|
351
|
+
end
|
352
|
+
|
353
|
+
if attributes.has_key?(:'promotion_present')
|
354
|
+
self.promotion_present = attributes[:'promotion_present']
|
355
|
+
end
|
356
|
+
|
357
|
+
if attributes.has_key?(:'remaining_refund_amount')
|
358
|
+
self.remaining_refund_amount = attributes[:'remaining_refund_amount']
|
359
|
+
end
|
360
|
+
|
361
|
+
if attributes.has_key?(:'refund_total')
|
362
|
+
self.refund_total = attributes[:'refund_total']
|
363
|
+
end
|
364
|
+
|
365
|
+
if attributes.has_key?(:'extra_refund_amount')
|
366
|
+
self.extra_refund_amount = attributes[:'extra_refund_amount']
|
367
|
+
end
|
368
|
+
|
369
|
+
if attributes.has_key?(:'user')
|
370
|
+
self.user = attributes[:'user']
|
371
|
+
end
|
372
|
+
|
373
|
+
if attributes.has_key?(:'delivery_address')
|
374
|
+
self.delivery_address = attributes[:'delivery_address']
|
375
|
+
end
|
376
|
+
|
377
|
+
if attributes.has_key?(:'delivery_zone')
|
378
|
+
self.delivery_zone = attributes[:'delivery_zone']
|
379
|
+
end
|
380
|
+
|
381
|
+
if attributes.has_key?(:'delivery_service')
|
382
|
+
self.delivery_service = attributes[:'delivery_service']
|
383
|
+
end
|
384
|
+
|
385
|
+
if attributes.has_key?(:'order_detail')
|
386
|
+
self.order_detail = attributes[:'order_detail']
|
387
|
+
end
|
388
|
+
|
389
|
+
if attributes.has_key?(:'order_total')
|
390
|
+
self.order_total = attributes[:'order_total']
|
391
|
+
end
|
392
|
+
|
393
|
+
if attributes.has_key?(:'delivery_total')
|
394
|
+
self.delivery_total = attributes[:'delivery_total']
|
395
|
+
end
|
396
|
+
|
397
|
+
if attributes.has_key?(:'enquiry')
|
398
|
+
self.enquiry = attributes[:'enquiry']
|
399
|
+
end
|
400
|
+
|
401
|
+
if attributes.has_key?(:'items')
|
402
|
+
self.items = attributes[:'items']
|
403
|
+
end
|
404
|
+
|
405
|
+
if attributes.has_key?(:'links')
|
406
|
+
if (value = attributes[:'links']).is_a?(Array)
|
407
|
+
self.links = value
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
end
|
412
|
+
|
413
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
414
|
+
# @return Array for valid properties with the reasons
|
415
|
+
def list_invalid_properties
|
416
|
+
invalid_properties = Array.new
|
417
|
+
if @id.nil?
|
418
|
+
invalid_properties.push("invalid value for 'id', id cannot be nil.")
|
419
|
+
end
|
420
|
+
|
421
|
+
if @state.nil?
|
422
|
+
invalid_properties.push("invalid value for 'state', state cannot be nil.")
|
423
|
+
end
|
424
|
+
|
425
|
+
if @confirm_by.nil?
|
426
|
+
invalid_properties.push("invalid value for 'confirm_by', confirm_by cannot be nil.")
|
427
|
+
end
|
428
|
+
|
429
|
+
if @estimated_dispatch_at.nil?
|
430
|
+
invalid_properties.push("invalid value for 'estimated_dispatch_at', estimated_dispatch_at cannot be nil.")
|
431
|
+
end
|
432
|
+
|
433
|
+
if @placed_at.nil?
|
434
|
+
invalid_properties.push("invalid value for 'placed_at', placed_at cannot be nil.")
|
435
|
+
end
|
436
|
+
|
437
|
+
if @expired_at.nil?
|
438
|
+
invalid_properties.push("invalid value for 'expired_at', expired_at cannot be nil.")
|
439
|
+
end
|
440
|
+
|
441
|
+
if @declined_at.nil?
|
442
|
+
invalid_properties.push("invalid value for 'declined_at', declined_at cannot be nil.")
|
443
|
+
end
|
444
|
+
|
445
|
+
if @accepted_at.nil?
|
446
|
+
invalid_properties.push("invalid value for 'accepted_at', accepted_at cannot be nil.")
|
447
|
+
end
|
448
|
+
|
449
|
+
if @dispatched_at.nil?
|
450
|
+
invalid_properties.push("invalid value for 'dispatched_at', dispatched_at cannot be nil.")
|
451
|
+
end
|
452
|
+
|
453
|
+
if @repeat_customer.nil?
|
454
|
+
invalid_properties.push("invalid value for 'repeat_customer', repeat_customer cannot be nil.")
|
455
|
+
end
|
456
|
+
|
457
|
+
if @customer_expected_delivery_date.nil?
|
458
|
+
invalid_properties.push("invalid value for 'customer_expected_delivery_date', customer_expected_delivery_date cannot be nil.")
|
459
|
+
end
|
460
|
+
|
461
|
+
if @number.nil?
|
462
|
+
invalid_properties.push("invalid value for 'number', number cannot be nil.")
|
463
|
+
end
|
464
|
+
|
465
|
+
if @dispatch_note_viewed.nil?
|
466
|
+
invalid_properties.push("invalid value for 'dispatch_note_viewed', dispatch_note_viewed cannot be nil.")
|
467
|
+
end
|
468
|
+
|
469
|
+
if @express.nil?
|
470
|
+
invalid_properties.push("invalid value for 'express', express cannot be nil.")
|
471
|
+
end
|
472
|
+
|
473
|
+
if @partner_name.nil?
|
474
|
+
invalid_properties.push("invalid value for 'partner_name', partner_name cannot be nil.")
|
475
|
+
end
|
476
|
+
|
477
|
+
if @delivery_recipient_name.nil?
|
478
|
+
invalid_properties.push("invalid value for 'delivery_recipient_name', delivery_recipient_name cannot be nil.")
|
479
|
+
end
|
480
|
+
|
481
|
+
if @delivery_recipient_first_name.nil?
|
482
|
+
invalid_properties.push("invalid value for 'delivery_recipient_first_name', delivery_recipient_first_name cannot be nil.")
|
483
|
+
end
|
484
|
+
|
485
|
+
if @delivery_recipient_last_name.nil?
|
486
|
+
invalid_properties.push("invalid value for 'delivery_recipient_last_name', delivery_recipient_last_name cannot be nil.")
|
487
|
+
end
|
488
|
+
|
489
|
+
if @international.nil?
|
490
|
+
invalid_properties.push("invalid value for 'international', international cannot be nil.")
|
491
|
+
end
|
492
|
+
|
493
|
+
if @dispatch_overdue.nil?
|
494
|
+
invalid_properties.push("invalid value for 'dispatch_overdue', dispatch_overdue cannot be nil.")
|
495
|
+
end
|
496
|
+
|
497
|
+
if @gift.nil?
|
498
|
+
invalid_properties.push("invalid value for 'gift', gift cannot be nil.")
|
499
|
+
end
|
500
|
+
|
501
|
+
if @gift_message.nil?
|
502
|
+
invalid_properties.push("invalid value for 'gift_message', gift_message cannot be nil.")
|
503
|
+
end
|
504
|
+
|
505
|
+
if @gift_wrap.nil?
|
506
|
+
invalid_properties.push("invalid value for 'gift_wrap', gift_wrap cannot be nil.")
|
507
|
+
end
|
508
|
+
|
509
|
+
if @gift_receipt.nil?
|
510
|
+
invalid_properties.push("invalid value for 'gift_receipt', gift_receipt cannot be nil.")
|
511
|
+
end
|
512
|
+
|
513
|
+
if @delivery_note.nil?
|
514
|
+
invalid_properties.push("invalid value for 'delivery_note', delivery_note cannot be nil.")
|
515
|
+
end
|
516
|
+
|
517
|
+
if @has_enquiry.nil?
|
518
|
+
invalid_properties.push("invalid value for 'has_enquiry', has_enquiry cannot be nil.")
|
519
|
+
end
|
520
|
+
|
521
|
+
if @estimated_delivery_date.nil?
|
522
|
+
invalid_properties.push("invalid value for 'estimated_delivery_date', estimated_delivery_date cannot be nil.")
|
523
|
+
end
|
524
|
+
|
525
|
+
if @financials.nil?
|
526
|
+
invalid_properties.push("invalid value for 'financials', financials cannot be nil.")
|
527
|
+
end
|
528
|
+
|
529
|
+
if @promotion_discount.nil?
|
530
|
+
invalid_properties.push("invalid value for 'promotion_discount', promotion_discount cannot be nil.")
|
531
|
+
end
|
532
|
+
|
533
|
+
if @promotion_present.nil?
|
534
|
+
invalid_properties.push("invalid value for 'promotion_present', promotion_present cannot be nil.")
|
535
|
+
end
|
536
|
+
|
537
|
+
if @remaining_refund_amount.nil?
|
538
|
+
invalid_properties.push("invalid value for 'remaining_refund_amount', remaining_refund_amount cannot be nil.")
|
539
|
+
end
|
540
|
+
|
541
|
+
if @refund_total.nil?
|
542
|
+
invalid_properties.push("invalid value for 'refund_total', refund_total cannot be nil.")
|
543
|
+
end
|
544
|
+
|
545
|
+
if @extra_refund_amount.nil?
|
546
|
+
invalid_properties.push("invalid value for 'extra_refund_amount', extra_refund_amount cannot be nil.")
|
547
|
+
end
|
548
|
+
|
549
|
+
if @user.nil?
|
550
|
+
invalid_properties.push("invalid value for 'user', user cannot be nil.")
|
551
|
+
end
|
552
|
+
|
553
|
+
if @delivery_address.nil?
|
554
|
+
invalid_properties.push("invalid value for 'delivery_address', delivery_address cannot be nil.")
|
555
|
+
end
|
556
|
+
|
557
|
+
if @delivery_zone.nil?
|
558
|
+
invalid_properties.push("invalid value for 'delivery_zone', delivery_zone cannot be nil.")
|
559
|
+
end
|
560
|
+
|
561
|
+
if @delivery_service.nil?
|
562
|
+
invalid_properties.push("invalid value for 'delivery_service', delivery_service cannot be nil.")
|
563
|
+
end
|
564
|
+
|
565
|
+
if @order_detail.nil?
|
566
|
+
invalid_properties.push("invalid value for 'order_detail', order_detail cannot be nil.")
|
567
|
+
end
|
568
|
+
|
569
|
+
if @order_total.nil?
|
570
|
+
invalid_properties.push("invalid value for 'order_total', order_total cannot be nil.")
|
571
|
+
end
|
572
|
+
|
573
|
+
if @delivery_total.nil?
|
574
|
+
invalid_properties.push("invalid value for 'delivery_total', delivery_total cannot be nil.")
|
575
|
+
end
|
576
|
+
|
577
|
+
if @enquiry.nil?
|
578
|
+
invalid_properties.push("invalid value for 'enquiry', enquiry cannot be nil.")
|
579
|
+
end
|
580
|
+
|
581
|
+
if @items.nil?
|
582
|
+
invalid_properties.push("invalid value for 'items', items cannot be nil.")
|
583
|
+
end
|
584
|
+
|
585
|
+
if @links.nil?
|
586
|
+
invalid_properties.push("invalid value for 'links', links cannot be nil.")
|
587
|
+
end
|
588
|
+
|
589
|
+
return invalid_properties
|
590
|
+
end
|
591
|
+
|
592
|
+
# Check to see if the all the properties in the model are valid
|
593
|
+
# @return true if the model is valid
|
594
|
+
def valid?
|
595
|
+
return false if @id.nil?
|
596
|
+
return false if @state.nil?
|
597
|
+
return false if @confirm_by.nil?
|
598
|
+
return false if @estimated_dispatch_at.nil?
|
599
|
+
return false if @placed_at.nil?
|
600
|
+
return false if @expired_at.nil?
|
601
|
+
return false if @declined_at.nil?
|
602
|
+
return false if @accepted_at.nil?
|
603
|
+
return false if @dispatched_at.nil?
|
604
|
+
return false if @repeat_customer.nil?
|
605
|
+
return false if @customer_expected_delivery_date.nil?
|
606
|
+
return false if @number.nil?
|
607
|
+
return false if @dispatch_note_viewed.nil?
|
608
|
+
return false if @express.nil?
|
609
|
+
return false if @partner_name.nil?
|
610
|
+
return false if @delivery_recipient_name.nil?
|
611
|
+
return false if @delivery_recipient_first_name.nil?
|
612
|
+
return false if @delivery_recipient_last_name.nil?
|
613
|
+
return false if @international.nil?
|
614
|
+
return false if @dispatch_overdue.nil?
|
615
|
+
return false if @gift.nil?
|
616
|
+
return false if @gift_message.nil?
|
617
|
+
return false if @gift_wrap.nil?
|
618
|
+
return false if @gift_receipt.nil?
|
619
|
+
return false if @delivery_note.nil?
|
620
|
+
return false if @has_enquiry.nil?
|
621
|
+
return false if @estimated_delivery_date.nil?
|
622
|
+
return false if @financials.nil?
|
623
|
+
return false if @promotion_discount.nil?
|
624
|
+
return false if @promotion_present.nil?
|
625
|
+
return false if @remaining_refund_amount.nil?
|
626
|
+
return false if @refund_total.nil?
|
627
|
+
return false if @extra_refund_amount.nil?
|
628
|
+
return false if @user.nil?
|
629
|
+
return false if @delivery_address.nil?
|
630
|
+
return false if @delivery_zone.nil?
|
631
|
+
return false if @delivery_service.nil?
|
632
|
+
return false if @order_detail.nil?
|
633
|
+
return false if @order_total.nil?
|
634
|
+
return false if @delivery_total.nil?
|
635
|
+
return false if @enquiry.nil?
|
636
|
+
return false if @items.nil?
|
637
|
+
return false if @links.nil?
|
638
|
+
return true
|
639
|
+
end
|
640
|
+
|
641
|
+
# Checks equality by comparing each attribute.
|
642
|
+
# @param [Object] Object to be compared
|
643
|
+
def ==(o)
|
644
|
+
return true if self.equal?(o)
|
645
|
+
self.class == o.class &&
|
646
|
+
id == o.id &&
|
647
|
+
state == o.state &&
|
648
|
+
confirm_by == o.confirm_by &&
|
649
|
+
estimated_dispatch_at == o.estimated_dispatch_at &&
|
650
|
+
placed_at == o.placed_at &&
|
651
|
+
expired_at == o.expired_at &&
|
652
|
+
declined_at == o.declined_at &&
|
653
|
+
accepted_at == o.accepted_at &&
|
654
|
+
dispatched_at == o.dispatched_at &&
|
655
|
+
archived_at == o.archived_at &&
|
656
|
+
repeat_customer == o.repeat_customer &&
|
657
|
+
customer_expected_delivery_date == o.customer_expected_delivery_date &&
|
658
|
+
number == o.number &&
|
659
|
+
dispatch_note_viewed == o.dispatch_note_viewed &&
|
660
|
+
express == o.express &&
|
661
|
+
partner_name == o.partner_name &&
|
662
|
+
delivery_recipient_name == o.delivery_recipient_name &&
|
663
|
+
delivery_recipient_first_name == o.delivery_recipient_first_name &&
|
664
|
+
delivery_recipient_last_name == o.delivery_recipient_last_name &&
|
665
|
+
international == o.international &&
|
666
|
+
dispatch_overdue == o.dispatch_overdue &&
|
667
|
+
gift == o.gift &&
|
668
|
+
gift_message == o.gift_message &&
|
669
|
+
gift_wrap == o.gift_wrap &&
|
670
|
+
gift_receipt == o.gift_receipt &&
|
671
|
+
delivery_note == o.delivery_note &&
|
672
|
+
has_enquiry == o.has_enquiry &&
|
673
|
+
estimated_delivery_date == o.estimated_delivery_date &&
|
674
|
+
rebate_qualified == o.rebate_qualified &&
|
675
|
+
rebate_achieved == o.rebate_achieved &&
|
676
|
+
financials == o.financials &&
|
677
|
+
promotion_discount == o.promotion_discount &&
|
678
|
+
promotion_present == o.promotion_present &&
|
679
|
+
remaining_refund_amount == o.remaining_refund_amount &&
|
680
|
+
refund_total == o.refund_total &&
|
681
|
+
extra_refund_amount == o.extra_refund_amount &&
|
682
|
+
user == o.user &&
|
683
|
+
delivery_address == o.delivery_address &&
|
684
|
+
delivery_zone == o.delivery_zone &&
|
685
|
+
delivery_service == o.delivery_service &&
|
686
|
+
order_detail == o.order_detail &&
|
687
|
+
order_total == o.order_total &&
|
688
|
+
delivery_total == o.delivery_total &&
|
689
|
+
enquiry == o.enquiry &&
|
690
|
+
items == o.items &&
|
691
|
+
links == o.links
|
692
|
+
end
|
693
|
+
|
694
|
+
# @see the `==` method
|
695
|
+
# @param [Object] Object to be compared
|
696
|
+
def eql?(o)
|
697
|
+
self == o
|
698
|
+
end
|
699
|
+
|
700
|
+
# Calculates hash code according to all attributes.
|
701
|
+
# @return [Fixnum] Hash code
|
702
|
+
def hash
|
703
|
+
[id, state, confirm_by, estimated_dispatch_at, placed_at, expired_at, declined_at, accepted_at, dispatched_at, archived_at, repeat_customer, customer_expected_delivery_date, number, dispatch_note_viewed, express, partner_name, delivery_recipient_name, delivery_recipient_first_name, delivery_recipient_last_name, international, dispatch_overdue, gift, gift_message, gift_wrap, gift_receipt, delivery_note, has_enquiry, estimated_delivery_date, rebate_qualified, rebate_achieved, financials, promotion_discount, promotion_present, remaining_refund_amount, refund_total, extra_refund_amount, user, delivery_address, delivery_zone, delivery_service, order_detail, order_total, delivery_total, enquiry, items, links].hash
|
704
|
+
end
|
705
|
+
|
706
|
+
# Builds the object from hash
|
707
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
708
|
+
# @return [Object] Returns the model itself
|
709
|
+
def build_from_hash(attributes)
|
710
|
+
return nil unless attributes.is_a?(Hash)
|
711
|
+
self.class.swagger_types.each_pair do |key, type|
|
712
|
+
if type =~ /\AArray<(.*)>/i
|
713
|
+
# check to ensure the input is an array given that the the attribute
|
714
|
+
# is documented as an array but the input is not
|
715
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
716
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
717
|
+
end
|
718
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
719
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
720
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
721
|
+
end
|
722
|
+
|
723
|
+
self
|
724
|
+
end
|
725
|
+
|
726
|
+
# Deserializes the data based on type
|
727
|
+
# @param string type Data type
|
728
|
+
# @param string value Value to be deserialized
|
729
|
+
# @return [Object] Deserialized data
|
730
|
+
def _deserialize(type, value)
|
731
|
+
case type.to_sym
|
732
|
+
when :DateTime
|
733
|
+
DateTime.parse(value)
|
734
|
+
when :Date
|
735
|
+
Date.parse(value)
|
736
|
+
when :String
|
737
|
+
value.to_s
|
738
|
+
when :Integer
|
739
|
+
value.to_i
|
740
|
+
when :Float
|
741
|
+
value.to_f
|
742
|
+
when :BOOLEAN
|
743
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
744
|
+
true
|
745
|
+
else
|
746
|
+
false
|
747
|
+
end
|
748
|
+
when :Object
|
749
|
+
# generic object (usually a Hash), return directly
|
750
|
+
value
|
751
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
752
|
+
inner_type = Regexp.last_match[:inner_type]
|
753
|
+
value.map { |v| _deserialize(inner_type, v) }
|
754
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
755
|
+
k_type = Regexp.last_match[:k_type]
|
756
|
+
v_type = Regexp.last_match[:v_type]
|
757
|
+
{}.tap do |hash|
|
758
|
+
value.each do |k, v|
|
759
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
760
|
+
end
|
761
|
+
end
|
762
|
+
else # model
|
763
|
+
temp_model = Noths.const_get(type).new
|
764
|
+
temp_model.build_from_hash(value)
|
765
|
+
end
|
766
|
+
end
|
767
|
+
|
768
|
+
# Returns the string representation of the object
|
769
|
+
# @return [String] String presentation of the object
|
770
|
+
def to_s
|
771
|
+
to_hash.to_s
|
772
|
+
end
|
773
|
+
|
774
|
+
# to_body is an alias to to_hash (backward compatibility)
|
775
|
+
# @return [Hash] Returns the object in the form of hash
|
776
|
+
def to_body
|
777
|
+
to_hash
|
778
|
+
end
|
779
|
+
|
780
|
+
# Returns the object in the form of hash
|
781
|
+
# @return [Hash] Returns the object in the form of hash
|
782
|
+
def to_hash
|
783
|
+
hash = {}
|
784
|
+
self.class.attribute_map.each_pair do |attr, param|
|
785
|
+
value = self.send(attr)
|
786
|
+
next if value.nil?
|
787
|
+
hash[param] = _to_hash(value)
|
788
|
+
end
|
789
|
+
hash
|
790
|
+
end
|
791
|
+
|
792
|
+
# Outputs non-array value in the form of hash
|
793
|
+
# For object, use to_hash. Otherwise, just return the value
|
794
|
+
# @param [Object] value Any valid value
|
795
|
+
# @return [Hash] Returns the value in the form of hash
|
796
|
+
def _to_hash(value)
|
797
|
+
if value.is_a?(Array)
|
798
|
+
value.compact.map{ |v| _to_hash(v) }
|
799
|
+
elsif value.is_a?(Hash)
|
800
|
+
{}.tap do |hash|
|
801
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
802
|
+
end
|
803
|
+
elsif value.respond_to? :to_hash
|
804
|
+
value.to_hash
|
805
|
+
else
|
806
|
+
value
|
807
|
+
end
|
808
|
+
end
|
809
|
+
|
810
|
+
end
|
811
|
+
|
812
|
+
end
|