deliveree_sdk 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,204 @@
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 ResponseGetQuote
11
+ attr_accessor :vehicle_type_id
12
+
13
+ attr_accessor :vehicle_type_name
14
+
15
+ attr_accessor :total_fees
16
+
17
+ attr_accessor :currency
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'vehicle_type_id' => :'vehicle_type_id',
23
+ :'vehicle_type_name' => :'vehicle_type_name',
24
+ :'total_fees' => :'total_fees',
25
+ :'currency' => :'currency'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.attribute_types
31
+ {
32
+ :'vehicle_type_id' => :'Integer',
33
+ :'vehicle_type_name' => :'String',
34
+ :'total_fees' => :'String',
35
+ :'currency' => :'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?(:'vehicle_type_id')
48
+ self.vehicle_type_id = attributes[:'vehicle_type_id']
49
+ end
50
+
51
+ if attributes.has_key?(:'vehicle_type_name')
52
+ self.vehicle_type_name = attributes[:'vehicle_type_name']
53
+ end
54
+
55
+ if attributes.has_key?(:'total_fees')
56
+ self.total_fees = attributes[:'total_fees']
57
+ end
58
+
59
+ if attributes.has_key?(:'currency')
60
+ self.currency = attributes[:'currency']
61
+ end
62
+ end
63
+
64
+ # Show invalid properties with the reasons. Usually used together with valid?
65
+ # @return Array for valid properties with the reasons
66
+ def list_invalid_properties
67
+ invalid_properties = Array.new
68
+ invalid_properties
69
+ end
70
+
71
+ # Check to see if the all the properties in the model are valid
72
+ # @return true if the model is valid
73
+ def valid?
74
+ true
75
+ end
76
+
77
+ # Checks equality by comparing each attribute.
78
+ # @param [Object] Object to be compared
79
+ def ==(o)
80
+ return true if self.equal?(o)
81
+ self.class == o.class &&
82
+ vehicle_type_id == o.vehicle_type_id &&
83
+ vehicle_type_name == o.vehicle_type_name &&
84
+ total_fees == o.total_fees &&
85
+ currency == o.currency
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Fixnum] Hash code
96
+ def hash
97
+ [vehicle_type_id, vehicle_type_name, total_fees, currency].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ self.class.attribute_types.each_pair do |key, type|
106
+ if type =~ /\AArray<(.*)>/i
107
+ # check to ensure the input is an array given that the the attribute
108
+ # is documented as an array but the input is not
109
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
110
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
111
+ end
112
+ elsif !attributes[self.class.attribute_map[key]].nil?
113
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
115
+ end
116
+
117
+ self
118
+ end
119
+
120
+ # Deserializes the data based on type
121
+ # @param string type Data type
122
+ # @param string value Value to be deserialized
123
+ # @return [Object] Deserialized data
124
+ def _deserialize(type, value)
125
+ case type.to_sym
126
+ when :DateTime
127
+ DateTime.parse(value)
128
+ when :Date
129
+ Date.parse(value)
130
+ when :String
131
+ value.to_s
132
+ when :Integer
133
+ value.to_i
134
+ when :Float
135
+ value.to_f
136
+ when :BOOLEAN
137
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
+ true
139
+ else
140
+ false
141
+ end
142
+ when :Object
143
+ # generic object (usually a Hash), return directly
144
+ value
145
+ when /\AArray<(?<inner_type>.+)>\z/
146
+ inner_type = Regexp.last_match[:inner_type]
147
+ value.map { |v| _deserialize(inner_type, v) }
148
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
+ k_type = Regexp.last_match[:k_type]
150
+ v_type = Regexp.last_match[:v_type]
151
+ {}.tap do |hash|
152
+ value.each do |k, v|
153
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
+ end
155
+ end
156
+ else # model
157
+ temp_model = Deliveree.const_get(type).new
158
+ temp_model.build_from_hash(value)
159
+ end
160
+ end
161
+
162
+ # Returns the string representation of the object
163
+ # @return [String] String presentation of the object
164
+ def to_s
165
+ to_hash.to_s
166
+ end
167
+
168
+ # to_body is an alias to to_hash (backward compatibility)
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_body
171
+ to_hash
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ next if value.nil?
181
+ hash[param] = _to_hash(value)
182
+ end
183
+ hash
184
+ end
185
+
186
+ # Outputs non-array value in the form of hash
187
+ # For object, use to_hash. Otherwise, just return the value
188
+ # @param [Object] value Any valid value
189
+ # @return [Hash] Returns the value in the form of hash
190
+ def _to_hash(value)
191
+ if value.is_a?(Array)
192
+ value.compact.map { |v| _to_hash(v) }
193
+ elsif value.is_a?(Hash)
194
+ {}.tap do |hash|
195
+ value.each { |k, v| hash[k] = _to_hash(v) }
196
+ end
197
+ elsif value.respond_to? :to_hash
198
+ value.to_hash
199
+ else
200
+ value
201
+ end
202
+ end
203
+ end
204
+ end
@@ -0,0 +1,179 @@
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 ResponseWithData
11
+ attr_accessor :data
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ :'data' => :'data'
17
+ }
18
+ end
19
+
20
+ # Attribute type mapping.
21
+ def self.attribute_types
22
+ {
23
+ :'data' => :'Array<ResponseGetQuote>'
24
+ }
25
+ end
26
+
27
+ # Initializes the object
28
+ # @param [Hash] attributes Model attributes in the form of hash
29
+ def initialize(attributes = {})
30
+ return unless attributes.is_a?(Hash)
31
+
32
+ # convert string to symbol for hash key
33
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
34
+
35
+ if attributes.has_key?(:'data')
36
+ if (value = attributes[:'data']).is_a?(Array)
37
+ self.data = value
38
+ end
39
+ end
40
+ end
41
+
42
+ # Show invalid properties with the reasons. Usually used together with valid?
43
+ # @return Array for valid properties with the reasons
44
+ def list_invalid_properties
45
+ invalid_properties = Array.new
46
+ invalid_properties
47
+ end
48
+
49
+ # Check to see if the all the properties in the model are valid
50
+ # @return true if the model is valid
51
+ def valid?
52
+ true
53
+ end
54
+
55
+ # Checks equality by comparing each attribute.
56
+ # @param [Object] Object to be compared
57
+ def ==(o)
58
+ return true if self.equal?(o)
59
+ self.class == o.class &&
60
+ data == o.data
61
+ end
62
+
63
+ # @see the `==` method
64
+ # @param [Object] Object to be compared
65
+ def eql?(o)
66
+ self == o
67
+ end
68
+
69
+ # Calculates hash code according to all attributes.
70
+ # @return [Fixnum] Hash code
71
+ def hash
72
+ [data].hash
73
+ end
74
+
75
+ # Builds the object from hash
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ # @return [Object] Returns the model itself
78
+ def build_from_hash(attributes)
79
+ return nil unless attributes.is_a?(Hash)
80
+ self.class.attribute_types.each_pair do |key, type|
81
+ if type =~ /\AArray<(.*)>/i
82
+ # check to ensure the input is an array given that the the attribute
83
+ # is documented as an array but the input is not
84
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
85
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
86
+ end
87
+ elsif !attributes[self.class.attribute_map[key]].nil?
88
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
89
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
90
+ end
91
+
92
+ self
93
+ end
94
+
95
+ # Deserializes the data based on type
96
+ # @param string type Data type
97
+ # @param string value Value to be deserialized
98
+ # @return [Object] Deserialized data
99
+ def _deserialize(type, value)
100
+ case type.to_sym
101
+ when :DateTime
102
+ DateTime.parse(value)
103
+ when :Date
104
+ Date.parse(value)
105
+ when :String
106
+ value.to_s
107
+ when :Integer
108
+ value.to_i
109
+ when :Float
110
+ value.to_f
111
+ when :BOOLEAN
112
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
113
+ true
114
+ else
115
+ false
116
+ end
117
+ when :Object
118
+ # generic object (usually a Hash), return directly
119
+ value
120
+ when /\AArray<(?<inner_type>.+)>\z/
121
+ inner_type = Regexp.last_match[:inner_type]
122
+ value.map { |v| _deserialize(inner_type, v) }
123
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
124
+ k_type = Regexp.last_match[:k_type]
125
+ v_type = Regexp.last_match[:v_type]
126
+ {}.tap do |hash|
127
+ value.each do |k, v|
128
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
129
+ end
130
+ end
131
+ else # model
132
+ temp_model = Deliveree.const_get(type).new
133
+ temp_model.build_from_hash(value)
134
+ end
135
+ end
136
+
137
+ # Returns the string representation of the object
138
+ # @return [String] String presentation of the object
139
+ def to_s
140
+ to_hash.to_s
141
+ end
142
+
143
+ # to_body is an alias to to_hash (backward compatibility)
144
+ # @return [Hash] Returns the object in the form of hash
145
+ def to_body
146
+ to_hash
147
+ end
148
+
149
+ # Returns the object in the form of hash
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_hash
152
+ hash = {}
153
+ self.class.attribute_map.each_pair do |attr, param|
154
+ value = self.send(attr)
155
+ next if value.nil?
156
+ hash[param] = _to_hash(value)
157
+ end
158
+ hash
159
+ end
160
+
161
+ # Outputs non-array value in the form of hash
162
+ # For object, use to_hash. Otherwise, just return the value
163
+ # @param [Object] value Any valid value
164
+ # @return [Hash] Returns the value in the form of hash
165
+ def _to_hash(value)
166
+ if value.is_a?(Array)
167
+ value.compact.map { |v| _to_hash(v) }
168
+ elsif value.is_a?(Hash)
169
+ {}.tap do |hash|
170
+ value.each { |k, v| hash[k] = _to_hash(v) }
171
+ end
172
+ elsif value.respond_to? :to_hash
173
+ value.to_hash
174
+ else
175
+ value
176
+ end
177
+ end
178
+ end
179
+ end
@@ -0,0 +1,8 @@
1
+ =begin
2
+ #Deliveree SDK
3
+ # Version
4
+ =end
5
+
6
+ module Deliveree
7
+ VERSION = '1.0.0'
8
+ end
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #Deliveree SDK
3
+ #With Deliveree SDK, developers can integrate our on-demand local delivery platform into their applications. The SDK 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
+ # Common files
8
+ require 'deliveree_client/api_client'
9
+ require 'deliveree_client/api_error'
10
+ require 'deliveree_client/version'
11
+ require 'deliveree_client/configuration'
12
+
13
+ # Models
14
+ require 'deliveree_client/models/delivery'
15
+ require 'deliveree_client/models/response_default'
16
+ require 'deliveree_client/models/response_with_data'
17
+ require 'deliveree_client/models/response_get_quote'
18
+ require 'deliveree_client/models/location'
19
+ require 'deliveree_client/models/position_tracking'
20
+ require 'deliveree_client/models/quote'
21
+
22
+ # APIs
23
+ require 'deliveree_client/api/deliveree_api'
24
+
25
+ module Deliveree
26
+ class << self
27
+ # Customize default settings for the SDK using block.
28
+ # Deliveree.configure do |config|
29
+ # config.username = "xxx"
30
+ # config.password = "xxx"
31
+ # end
32
+ # If no block given, return the default Configuration object.
33
+ def configure
34
+ if block_given?
35
+ yield(Configuration.default)
36
+ else
37
+ Configuration.default
38
+ end
39
+ end
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: deliveree_sdk
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - TMA Team
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-12-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: typhoeus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: json
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.1'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.1.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '2.1'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 2.1.0
53
+ - !ruby/object:Gem::Dependency
54
+ name: vcr
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '3.0'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 3.0.1
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.0'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 3.0.1
73
+ description: With Deliveree SDK, developers can integrate our on-demand local delivery
74
+ platform into their applications. The SDK is designed for developers to check prices,
75
+ book an immediate or scheduled delivery and follow updates until delivery completion
76
+ email:
77
+ - duke@deliveree.com
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - BUILD_GEM.md
83
+ - Gemfile
84
+ - Gemfile.lock
85
+ - README.md
86
+ - Rakefile
87
+ - deliveree_sdk.gemspec
88
+ - docs/DelivereeApi.md
89
+ - docs/Delivery.md
90
+ - docs/Location.md
91
+ - docs/PositionTracking.md
92
+ - docs/Quote.md
93
+ - lib/deliveree_client/api/deliveree_api.rb
94
+ - lib/deliveree_client/api_client.rb
95
+ - lib/deliveree_client/api_error.rb
96
+ - lib/deliveree_client/configuration.rb
97
+ - lib/deliveree_client/models/delivery.rb
98
+ - lib/deliveree_client/models/location.rb
99
+ - lib/deliveree_client/models/position_tracking.rb
100
+ - lib/deliveree_client/models/quote.rb
101
+ - lib/deliveree_client/models/response_default.rb
102
+ - lib/deliveree_client/models/response_get_quote.rb
103
+ - lib/deliveree_client/models/response_with_data.rb
104
+ - lib/deliveree_client/version.rb
105
+ - lib/deliveree_sdk.rb
106
+ homepage: http://deliveree.com
107
+ licenses:
108
+ - MIT
109
+ metadata: {}
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '1.9'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubyforge_project:
126
+ rubygems_version: 2.7.7
127
+ signing_key:
128
+ specification_version: 4
129
+ summary: Deliveree SDK
130
+ test_files: []