api_geo_client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,284 @@
1
+ =begin
2
+ #API Référentiels géographiques
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0-beta
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.5
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module ApiGeoClient
16
+ class Commune
17
+ # Code INSEE de la commune
18
+ attr_accessor :code
19
+
20
+ # Nom de la commune
21
+ attr_accessor :nom
22
+
23
+ # Liste des codes postaux associés à la commune
24
+ attr_accessor :codes_postaux
25
+
26
+ # Code du département associé à la commune
27
+ attr_accessor :code_departement
28
+
29
+ # Code de la région associée à la commune
30
+ attr_accessor :code_region
31
+
32
+ attr_accessor :departement
33
+
34
+ attr_accessor :region
35
+
36
+ # Population municipale
37
+ attr_accessor :population
38
+
39
+ # Surface de la commune, en mètres-carrés
40
+ attr_accessor :surface
41
+
42
+ # Centre de la commune (Point GeoJSON)
43
+ attr_accessor :centre
44
+
45
+ # Contour de la commune (Polygon GeoJSON)
46
+ attr_accessor :contour
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'code' => :'code',
52
+ :'nom' => :'nom',
53
+ :'codes_postaux' => :'codesPostaux',
54
+ :'code_departement' => :'codeDepartement',
55
+ :'code_region' => :'codeRegion',
56
+ :'departement' => :'departement',
57
+ :'region' => :'region',
58
+ :'population' => :'population',
59
+ :'surface' => :'surface',
60
+ :'centre' => :'centre',
61
+ :'contour' => :'contour'
62
+ }
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.swagger_types
67
+ {
68
+ :'code' => :'String',
69
+ :'nom' => :'String',
70
+ :'codes_postaux' => :'Array<String>',
71
+ :'code_departement' => :'String',
72
+ :'code_region' => :'String',
73
+ :'departement' => :'Departement',
74
+ :'region' => :'Region',
75
+ :'population' => :'Integer',
76
+ :'surface' => :'Float',
77
+ :'centre' => :'Object',
78
+ :'contour' => :'Object'
79
+ }
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ return unless attributes.is_a?(Hash)
86
+
87
+ # convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
89
+
90
+ if attributes.has_key?(:'code')
91
+ self.code = attributes[:'code']
92
+ end
93
+
94
+ if attributes.has_key?(:'nom')
95
+ self.nom = attributes[:'nom']
96
+ end
97
+
98
+ if attributes.has_key?(:'codesPostaux')
99
+ if (value = attributes[:'codesPostaux']).is_a?(Array)
100
+ self.codes_postaux = value
101
+ end
102
+ end
103
+
104
+ if attributes.has_key?(:'codeDepartement')
105
+ self.code_departement = attributes[:'codeDepartement']
106
+ end
107
+
108
+ if attributes.has_key?(:'codeRegion')
109
+ self.code_region = attributes[:'codeRegion']
110
+ end
111
+
112
+ if attributes.has_key?(:'departement')
113
+ self.departement = attributes[:'departement']
114
+ end
115
+
116
+ if attributes.has_key?(:'region')
117
+ self.region = attributes[:'region']
118
+ end
119
+
120
+ if attributes.has_key?(:'population')
121
+ self.population = attributes[:'population']
122
+ end
123
+
124
+ if attributes.has_key?(:'surface')
125
+ self.surface = attributes[:'surface']
126
+ end
127
+
128
+ if attributes.has_key?(:'centre')
129
+ self.centre = attributes[:'centre']
130
+ end
131
+
132
+ if attributes.has_key?(:'contour')
133
+ self.contour = attributes[:'contour']
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ invalid_properties = Array.new
141
+ invalid_properties
142
+ end
143
+
144
+ # Check to see if the all the properties in the model are valid
145
+ # @return true if the model is valid
146
+ def valid?
147
+ true
148
+ end
149
+
150
+ # Checks equality by comparing each attribute.
151
+ # @param [Object] Object to be compared
152
+ def ==(o)
153
+ return true if self.equal?(o)
154
+ self.class == o.class &&
155
+ code == o.code &&
156
+ nom == o.nom &&
157
+ codes_postaux == o.codes_postaux &&
158
+ code_departement == o.code_departement &&
159
+ code_region == o.code_region &&
160
+ departement == o.departement &&
161
+ region == o.region &&
162
+ population == o.population &&
163
+ surface == o.surface &&
164
+ centre == o.centre &&
165
+ contour == o.contour
166
+ end
167
+
168
+ # @see the `==` method
169
+ # @param [Object] Object to be compared
170
+ def eql?(o)
171
+ self == o
172
+ end
173
+
174
+ # Calculates hash code according to all attributes.
175
+ # @return [Fixnum] Hash code
176
+ def hash
177
+ [code, nom, codes_postaux, code_departement, code_region, departement, region, population, surface, centre, contour].hash
178
+ end
179
+
180
+ # Builds the object from hash
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ # @return [Object] Returns the model itself
183
+ def build_from_hash(attributes)
184
+ return nil unless attributes.is_a?(Hash)
185
+ self.class.swagger_types.each_pair do |key, type|
186
+ if type =~ /\AArray<(.*)>/i
187
+ # check to ensure the input is an array given that the the attribute
188
+ # is documented as an array but the input is not
189
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
190
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
191
+ end
192
+ elsif !attributes[self.class.attribute_map[key]].nil?
193
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
194
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
195
+ end
196
+
197
+ self
198
+ end
199
+
200
+ # Deserializes the data based on type
201
+ # @param string type Data type
202
+ # @param string value Value to be deserialized
203
+ # @return [Object] Deserialized data
204
+ def _deserialize(type, value)
205
+ case type.to_sym
206
+ when :DateTime
207
+ DateTime.parse(value)
208
+ when :Date
209
+ Date.parse(value)
210
+ when :String
211
+ value.to_s
212
+ when :Integer
213
+ value.to_i
214
+ when :Float
215
+ value.to_f
216
+ when :BOOLEAN
217
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
218
+ true
219
+ else
220
+ false
221
+ end
222
+ when :Object
223
+ # generic object (usually a Hash), return directly
224
+ value
225
+ when /\AArray<(?<inner_type>.+)>\z/
226
+ inner_type = Regexp.last_match[:inner_type]
227
+ value.map { |v| _deserialize(inner_type, v) }
228
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
229
+ k_type = Regexp.last_match[:k_type]
230
+ v_type = Regexp.last_match[:v_type]
231
+ {}.tap do |hash|
232
+ value.each do |k, v|
233
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
234
+ end
235
+ end
236
+ else # model
237
+ temp_model = ApiGeoClient.const_get(type).new
238
+ temp_model.build_from_hash(value)
239
+ end
240
+ end
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # to_body is an alias to to_hash (backward compatibility)
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_body
251
+ to_hash
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = {}
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = self.send(attr)
260
+ next if value.nil?
261
+ hash[param] = _to_hash(value)
262
+ end
263
+ hash
264
+ end
265
+
266
+ # Outputs non-array value in the form of hash
267
+ # For object, use to_hash. Otherwise, just return the value
268
+ # @param [Object] value Any valid value
269
+ # @return [Hash] Returns the value in the form of hash
270
+ def _to_hash(value)
271
+ if value.is_a?(Array)
272
+ value.compact.map { |v| _to_hash(v) }
273
+ elsif value.is_a?(Hash)
274
+ {}.tap do |hash|
275
+ value.each { |k, v| hash[k] = _to_hash(v) }
276
+ end
277
+ elsif value.respond_to? :to_hash
278
+ value.to_hash
279
+ else
280
+ value
281
+ end
282
+ end
283
+ end
284
+ end
@@ -0,0 +1,213 @@
1
+ =begin
2
+ #API Référentiels géographiques
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0-beta
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.5
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module ApiGeoClient
16
+ class Departement
17
+ # Code du département
18
+ attr_accessor :code
19
+
20
+ # Nom du département
21
+ attr_accessor :nom
22
+
23
+ # Code de la région
24
+ attr_accessor :code_region
25
+
26
+ attr_accessor :region
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'code' => :'code',
32
+ :'nom' => :'nom',
33
+ :'code_region' => :'codeRegion',
34
+ :'region' => :'region'
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.swagger_types
40
+ {
41
+ :'code' => :'String',
42
+ :'nom' => :'String',
43
+ :'code_region' => :'String',
44
+ :'region' => :'Region'
45
+ }
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ return unless attributes.is_a?(Hash)
52
+
53
+ # convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
55
+
56
+ if attributes.has_key?(:'code')
57
+ self.code = attributes[:'code']
58
+ end
59
+
60
+ if attributes.has_key?(:'nom')
61
+ self.nom = attributes[:'nom']
62
+ end
63
+
64
+ if attributes.has_key?(:'codeRegion')
65
+ self.code_region = attributes[:'codeRegion']
66
+ end
67
+
68
+ if attributes.has_key?(:'region')
69
+ self.region = attributes[:'region']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ code == o.code &&
92
+ nom == o.nom &&
93
+ code_region == o.code_region &&
94
+ region == o.region
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Fixnum] Hash code
105
+ def hash
106
+ [code, nom, code_region, region].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ self.class.swagger_types.each_pair do |key, type|
115
+ if type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that the the attribute
117
+ # is documented as an array but the input is not
118
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
119
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
120
+ end
121
+ elsif !attributes[self.class.attribute_map[key]].nil?
122
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def _deserialize(type, value)
134
+ case type.to_sym
135
+ when :DateTime
136
+ DateTime.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :BOOLEAN
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ temp_model = ApiGeoClient.const_get(type).new
167
+ temp_model.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ next if value.nil?
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+ end
213
+ end