deliveree_sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/BUILD_GEM.md +11 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +29 -0
- data/README.md +153 -0
- data/Rakefile +8 -0
- data/deliveree_sdk.gemspec +31 -0
- data/docs/DelivereeApi.md +153 -0
- data/docs/Delivery.md +18 -0
- data/docs/Location.md +19 -0
- data/docs/PositionTracking.md +12 -0
- data/docs/Quote.md +9 -0
- data/lib/deliveree_client/api/deliveree_api.rb +175 -0
- data/lib/deliveree_client/api_client.rb +382 -0
- data/lib/deliveree_client/api_error.rb +32 -0
- data/lib/deliveree_client/configuration.rb +202 -0
- data/lib/deliveree_client/models/delivery.rb +265 -0
- data/lib/deliveree_client/models/location.rb +271 -0
- data/lib/deliveree_client/models/position_tracking.rb +213 -0
- data/lib/deliveree_client/models/quote.rb +189 -0
- data/lib/deliveree_client/models/response_default.rb +324 -0
- data/lib/deliveree_client/models/response_get_quote.rb +204 -0
- data/lib/deliveree_client/models/response_with_data.rb +179 -0
- data/lib/deliveree_client/version.rb +8 -0
- data/lib/deliveree_sdk.rb +41 -0
- metadata +130 -0
@@ -0,0 +1,189 @@
|
|
1
|
+
=begin
|
2
|
+
#Deliveree SDK
|
3
|
+
#With Deliveree API, developers can integrate our on-demand local delivery platform into their applications. The API is designed for developers to check prices, book an immediate or scheduled delivery and follow updates until delivery completion.
|
4
|
+
Contact: duke@deliveree.com
|
5
|
+
=end
|
6
|
+
|
7
|
+
require 'date'
|
8
|
+
|
9
|
+
module Deliveree
|
10
|
+
class Quote
|
11
|
+
# Only accept now or schedule
|
12
|
+
attr_accessor :time_type
|
13
|
+
|
14
|
+
attr_accessor :locations
|
15
|
+
|
16
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
:'time_type' => :'time_type',
|
20
|
+
:'locations' => :'locations'
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
# Attribute type mapping.
|
25
|
+
def self.attribute_types
|
26
|
+
{
|
27
|
+
:'time_type' => :'String',
|
28
|
+
:'locations' => :'Array<Location>'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Initializes the object
|
33
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
34
|
+
def initialize(attributes = {})
|
35
|
+
return unless attributes.is_a?(Hash)
|
36
|
+
|
37
|
+
# convert string to symbol for hash key
|
38
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
39
|
+
|
40
|
+
if attributes.has_key?(:'time_type')
|
41
|
+
self.time_type = attributes[:'time_type']
|
42
|
+
end
|
43
|
+
|
44
|
+
if attributes.has_key?(:'locations')
|
45
|
+
if (value = attributes[:'locations']).is_a?(Array)
|
46
|
+
self.locations = value
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
52
|
+
# @return Array for valid properties with the reasons
|
53
|
+
def list_invalid_properties
|
54
|
+
invalid_properties = Array.new
|
55
|
+
invalid_properties
|
56
|
+
end
|
57
|
+
|
58
|
+
# Check to see if the all the properties in the model are valid
|
59
|
+
# @return true if the model is valid
|
60
|
+
def valid?
|
61
|
+
true
|
62
|
+
end
|
63
|
+
|
64
|
+
# Checks equality by comparing each attribute.
|
65
|
+
# @param [Object] Object to be compared
|
66
|
+
def ==(o)
|
67
|
+
return true if self.equal?(o)
|
68
|
+
self.class == o.class &&
|
69
|
+
time_type == o.time_type &&
|
70
|
+
locations == o.locations
|
71
|
+
end
|
72
|
+
|
73
|
+
# @see the `==` method
|
74
|
+
# @param [Object] Object to be compared
|
75
|
+
def eql?(o)
|
76
|
+
self == o
|
77
|
+
end
|
78
|
+
|
79
|
+
# Calculates hash code according to all attributes.
|
80
|
+
# @return [Fixnum] Hash code
|
81
|
+
def hash
|
82
|
+
[time_type, locations].hash
|
83
|
+
end
|
84
|
+
|
85
|
+
# Builds the object from hash
|
86
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
87
|
+
# @return [Object] Returns the model itself
|
88
|
+
def build_from_hash(attributes)
|
89
|
+
return nil unless attributes.is_a?(Hash)
|
90
|
+
self.class.attribute_types.each_pair do |key, type|
|
91
|
+
if type =~ /\AArray<(.*)>/i
|
92
|
+
# check to ensure the input is an array given that the the attribute
|
93
|
+
# is documented as an array but the input is not
|
94
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
95
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
96
|
+
end
|
97
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
98
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
99
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
100
|
+
end
|
101
|
+
|
102
|
+
self
|
103
|
+
end
|
104
|
+
|
105
|
+
# Deserializes the data based on type
|
106
|
+
# @param string type Data type
|
107
|
+
# @param string value Value to be deserialized
|
108
|
+
# @return [Object] Deserialized data
|
109
|
+
def _deserialize(type, value)
|
110
|
+
case type.to_sym
|
111
|
+
when :DateTime
|
112
|
+
DateTime.parse(value)
|
113
|
+
when :Date
|
114
|
+
Date.parse(value)
|
115
|
+
when :String
|
116
|
+
value.to_s
|
117
|
+
when :Integer
|
118
|
+
value.to_i
|
119
|
+
when :Float
|
120
|
+
value.to_f
|
121
|
+
when :BOOLEAN
|
122
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
123
|
+
true
|
124
|
+
else
|
125
|
+
false
|
126
|
+
end
|
127
|
+
when :Object
|
128
|
+
# generic object (usually a Hash), return directly
|
129
|
+
value
|
130
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
131
|
+
inner_type = Regexp.last_match[:inner_type]
|
132
|
+
value.map { |v| _deserialize(inner_type, v) }
|
133
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
134
|
+
k_type = Regexp.last_match[:k_type]
|
135
|
+
v_type = Regexp.last_match[:v_type]
|
136
|
+
{}.tap do |hash|
|
137
|
+
value.each do |k, v|
|
138
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
else # model
|
142
|
+
temp_model = Deliveree.const_get(type).new
|
143
|
+
temp_model.build_from_hash(value)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Returns the string representation of the object
|
148
|
+
# @return [String] String presentation of the object
|
149
|
+
def to_s
|
150
|
+
to_hash.to_s
|
151
|
+
end
|
152
|
+
|
153
|
+
# to_body is an alias to to_hash (backward compatibility)
|
154
|
+
# @return [Hash] Returns the object in the form of hash
|
155
|
+
def to_body
|
156
|
+
to_hash
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns the object in the form of hash
|
160
|
+
# @return [Hash] Returns the object in the form of hash
|
161
|
+
def to_hash
|
162
|
+
hash = {}
|
163
|
+
self.class.attribute_map.each_pair do |attr, param|
|
164
|
+
value = self.send(attr)
|
165
|
+
next if value.nil?
|
166
|
+
hash[param] = _to_hash(value)
|
167
|
+
end
|
168
|
+
hash
|
169
|
+
end
|
170
|
+
|
171
|
+
# Outputs non-array value in the form of hash
|
172
|
+
# For object, use to_hash. Otherwise, just return the value
|
173
|
+
# @param [Object] value Any valid value
|
174
|
+
# @return [Hash] Returns the value in the form of hash
|
175
|
+
def _to_hash(value)
|
176
|
+
if value.is_a?(Array)
|
177
|
+
value.compact.map { |v| _to_hash(v) }
|
178
|
+
elsif value.is_a?(Hash)
|
179
|
+
{}.tap do |hash|
|
180
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
181
|
+
end
|
182
|
+
elsif value.respond_to? :to_hash
|
183
|
+
value.to_hash
|
184
|
+
else
|
185
|
+
value
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
@@ -0,0 +1,324 @@
|
|
1
|
+
=begin
|
2
|
+
#Deliveree SDK
|
3
|
+
#With Deliveree API, developers can integrate our on-demand local delivery platform into their applications. The API is designed for developers to check prices, book an immediate or scheduled delivery and follow updates until delivery completion.
|
4
|
+
Contact: duke@deliveree.com
|
5
|
+
=end
|
6
|
+
|
7
|
+
require 'date'
|
8
|
+
|
9
|
+
module Deliveree
|
10
|
+
class ResponseDefault
|
11
|
+
attr_accessor :id
|
12
|
+
|
13
|
+
attr_accessor :customer_id
|
14
|
+
|
15
|
+
attr_accessor :driver_id
|
16
|
+
|
17
|
+
attr_accessor :vehicle_type_id
|
18
|
+
|
19
|
+
attr_accessor :company_id
|
20
|
+
|
21
|
+
# Only accept now or schedule
|
22
|
+
attr_accessor :time_type
|
23
|
+
|
24
|
+
attr_accessor :status
|
25
|
+
|
26
|
+
attr_accessor :note
|
27
|
+
|
28
|
+
attr_accessor :total_fees
|
29
|
+
|
30
|
+
attr_accessor :currency
|
31
|
+
|
32
|
+
attr_accessor :tracking_url
|
33
|
+
|
34
|
+
attr_accessor :job_order_number
|
35
|
+
|
36
|
+
attr_accessor :created_at
|
37
|
+
|
38
|
+
attr_accessor :eta_from_driver_to_pickup
|
39
|
+
|
40
|
+
attr_accessor :distance_from_driver_to_pickup
|
41
|
+
|
42
|
+
attr_accessor :pickup_time
|
43
|
+
|
44
|
+
attr_accessor :locations
|
45
|
+
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
+
def self.attribute_map
|
48
|
+
{
|
49
|
+
:'id' => :'id',
|
50
|
+
:'customer_id' => :'customer_id',
|
51
|
+
:'driver_id' => :'driver_id',
|
52
|
+
:'vehicle_type_id' => :'vehicle_type_id',
|
53
|
+
:'company_id' => :'company_id',
|
54
|
+
:'time_type' => :'time_type',
|
55
|
+
:'status' => :'status',
|
56
|
+
:'note' => :'note',
|
57
|
+
:'total_fees' => :'total_fees',
|
58
|
+
:'currency' => :'currency',
|
59
|
+
:'tracking_url' => :'tracking_url',
|
60
|
+
:'job_order_number' => :'job_order_number',
|
61
|
+
:'created_at' => :'created_at',
|
62
|
+
:'eta_from_driver_to_pickup' => :'eta_from_driver_to_pickup',
|
63
|
+
:'distance_from_driver_to_pickup' => :'distance_from_driver_to_pickup',
|
64
|
+
:'pickup_time' => :'pickup_time',
|
65
|
+
:'locations' => :'locations'
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
# Attribute type mapping.
|
70
|
+
def self.attribute_types
|
71
|
+
{
|
72
|
+
:'id' => :'Integer',
|
73
|
+
:'customer_id' => :'Integer',
|
74
|
+
:'driver_id' => :'Integer',
|
75
|
+
:'vehicle_type_id' => :'Integer',
|
76
|
+
:'company_id' => :'Integer',
|
77
|
+
:'time_type' => :'String',
|
78
|
+
:'status' => :'String',
|
79
|
+
:'note' => :'String',
|
80
|
+
:'total_fees' => :'Float',
|
81
|
+
:'currency' => :'String',
|
82
|
+
:'tracking_url' => :'String',
|
83
|
+
:'job_order_number' => :'String',
|
84
|
+
:'created_at' => :'DateTime',
|
85
|
+
:'eta_from_driver_to_pickup' => :'Integer',
|
86
|
+
:'distance_from_driver_to_pickup' => :'Float',
|
87
|
+
:'pickup_time' => :'DateTime',
|
88
|
+
:'locations' => :'Array<Location>'
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
# Initializes the object
|
93
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
94
|
+
def initialize(attributes = {})
|
95
|
+
return unless attributes.is_a?(Hash)
|
96
|
+
|
97
|
+
# convert string to symbol for hash key
|
98
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
99
|
+
|
100
|
+
if attributes.has_key?(:'id')
|
101
|
+
self.id = attributes[:'id']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.has_key?(:'customer_id')
|
105
|
+
self.customer_id = attributes[:'customer_id']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.has_key?(:'driver_id')
|
109
|
+
self.driver_id = attributes[:'driver_id']
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.has_key?(:'vehicle_type_id')
|
113
|
+
self.vehicle_type_id = attributes[:'vehicle_type_id']
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.has_key?(:'company_id')
|
117
|
+
self.company_id = attributes[:'company_id']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.has_key?(:'time_type')
|
121
|
+
self.time_type = attributes[:'time_type']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.has_key?(:'status')
|
125
|
+
self.status = attributes[:'status']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.has_key?(:'note')
|
129
|
+
self.note = attributes[:'note']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.has_key?(:'total_fees')
|
133
|
+
self.total_fees = attributes[:'total_fees']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.has_key?(:'currency')
|
137
|
+
self.currency = attributes[:'currency']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.has_key?(:'tracking_url')
|
141
|
+
self.tracking_url = attributes[:'tracking_url']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.has_key?(:'job_order_number')
|
145
|
+
self.job_order_number = attributes[:'job_order_number']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.has_key?(:'created_at')
|
149
|
+
self.created_at = attributes[:'created_at']
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.has_key?(:'eta_from_driver_to_pickup')
|
153
|
+
self.eta_from_driver_to_pickup = attributes[:'eta_from_driver_to_pickup']
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.has_key?(:'distance_from_driver_to_pickup')
|
157
|
+
self.distance_from_driver_to_pickup = attributes[:'distance_from_driver_to_pickup']
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes.has_key?(:'pickup_time')
|
161
|
+
self.pickup_time = attributes[:'pickup_time']
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.has_key?(:'locations')
|
165
|
+
if (value = attributes[:'locations']).is_a?(Array)
|
166
|
+
self.locations = value
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
172
|
+
# @return Array for valid properties with the reasons
|
173
|
+
def list_invalid_properties
|
174
|
+
invalid_properties = Array.new
|
175
|
+
invalid_properties
|
176
|
+
end
|
177
|
+
|
178
|
+
# Check to see if the all the properties in the model are valid
|
179
|
+
# @return true if the model is valid
|
180
|
+
def valid?
|
181
|
+
true
|
182
|
+
end
|
183
|
+
|
184
|
+
# Checks equality by comparing each attribute.
|
185
|
+
# @param [Object] Object to be compared
|
186
|
+
def ==(o)
|
187
|
+
return true if self.equal?(o)
|
188
|
+
self.class == o.class &&
|
189
|
+
id == o.id &&
|
190
|
+
customer_id == o.customer_id &&
|
191
|
+
driver_id == o.driver_id &&
|
192
|
+
vehicle_type_id == o.vehicle_type_id &&
|
193
|
+
company_id == o.company_id &&
|
194
|
+
time_type == o.time_type &&
|
195
|
+
status == o.status &&
|
196
|
+
note == o.note &&
|
197
|
+
total_fees == o.total_fees &&
|
198
|
+
currency == o.currency &&
|
199
|
+
tracking_url == o.tracking_url &&
|
200
|
+
job_order_number == o.job_order_number &&
|
201
|
+
created_at == o.created_at &&
|
202
|
+
eta_from_driver_to_pickup == o.eta_from_driver_to_pickup &&
|
203
|
+
distance_from_driver_to_pickup == o.distance_from_driver_to_pickup &&
|
204
|
+
pickup_time == o.pickup_time &&
|
205
|
+
locations == o.locations
|
206
|
+
end
|
207
|
+
|
208
|
+
# @see the `==` method
|
209
|
+
# @param [Object] Object to be compared
|
210
|
+
def eql?(o)
|
211
|
+
self == o
|
212
|
+
end
|
213
|
+
|
214
|
+
# Calculates hash code according to all attributes.
|
215
|
+
# @return [Fixnum] Hash code
|
216
|
+
def hash
|
217
|
+
[id, customer_id, driver_id, vehicle_type_id, company_id, time_type, status, note, total_fees, currency, tracking_url, job_order_number, created_at, eta_from_driver_to_pickup, distance_from_driver_to_pickup, pickup_time, locations].hash
|
218
|
+
end
|
219
|
+
|
220
|
+
# Builds the object from hash
|
221
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
222
|
+
# @return [Object] Returns the model itself
|
223
|
+
def build_from_hash(attributes)
|
224
|
+
return nil unless attributes.is_a?(Hash)
|
225
|
+
self.class.attribute_types.each_pair do |key, type|
|
226
|
+
if type =~ /\AArray<(.*)>/i
|
227
|
+
# check to ensure the input is an array given that the the attribute
|
228
|
+
# is documented as an array but the input is not
|
229
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
230
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
231
|
+
end
|
232
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
233
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
234
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
235
|
+
end
|
236
|
+
|
237
|
+
self
|
238
|
+
end
|
239
|
+
|
240
|
+
# Deserializes the data based on type
|
241
|
+
# @param string type Data type
|
242
|
+
# @param string value Value to be deserialized
|
243
|
+
# @return [Object] Deserialized data
|
244
|
+
def _deserialize(type, value)
|
245
|
+
case type.to_sym
|
246
|
+
when :DateTime
|
247
|
+
DateTime.parse(value)
|
248
|
+
when :Date
|
249
|
+
Date.parse(value)
|
250
|
+
when :String
|
251
|
+
value.to_s
|
252
|
+
when :Integer
|
253
|
+
value.to_i
|
254
|
+
when :Float
|
255
|
+
value.to_f
|
256
|
+
when :BOOLEAN
|
257
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
258
|
+
true
|
259
|
+
else
|
260
|
+
false
|
261
|
+
end
|
262
|
+
when :Object
|
263
|
+
# generic object (usually a Hash), return directly
|
264
|
+
value
|
265
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
266
|
+
inner_type = Regexp.last_match[:inner_type]
|
267
|
+
value.map { |v| _deserialize(inner_type, v) }
|
268
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
269
|
+
k_type = Regexp.last_match[:k_type]
|
270
|
+
v_type = Regexp.last_match[:v_type]
|
271
|
+
{}.tap do |hash|
|
272
|
+
value.each do |k, v|
|
273
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
274
|
+
end
|
275
|
+
end
|
276
|
+
else # model
|
277
|
+
temp_model = Deliveree.const_get(type).new
|
278
|
+
temp_model.build_from_hash(value)
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
# Returns the string representation of the object
|
283
|
+
# @return [String] String presentation of the object
|
284
|
+
def to_s
|
285
|
+
to_hash.to_s
|
286
|
+
end
|
287
|
+
|
288
|
+
# to_body is an alias to to_hash (backward compatibility)
|
289
|
+
# @return [Hash] Returns the object in the form of hash
|
290
|
+
def to_body
|
291
|
+
to_hash
|
292
|
+
end
|
293
|
+
|
294
|
+
# Returns the object in the form of hash
|
295
|
+
# @return [Hash] Returns the object in the form of hash
|
296
|
+
def to_hash
|
297
|
+
hash = {}
|
298
|
+
self.class.attribute_map.each_pair do |attr, param|
|
299
|
+
value = self.send(attr)
|
300
|
+
next if value.nil?
|
301
|
+
hash[param] = _to_hash(value)
|
302
|
+
end
|
303
|
+
hash
|
304
|
+
end
|
305
|
+
|
306
|
+
# Outputs non-array value in the form of hash
|
307
|
+
# For object, use to_hash. Otherwise, just return the value
|
308
|
+
# @param [Object] value Any valid value
|
309
|
+
# @return [Hash] Returns the value in the form of hash
|
310
|
+
def _to_hash(value)
|
311
|
+
if value.is_a?(Array)
|
312
|
+
value.compact.map { |v| _to_hash(v) }
|
313
|
+
elsif value.is_a?(Hash)
|
314
|
+
{}.tap do |hash|
|
315
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
316
|
+
end
|
317
|
+
elsif value.respond_to? :to_hash
|
318
|
+
value.to_hash
|
319
|
+
else
|
320
|
+
value
|
321
|
+
end
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|