squash_matrix_api 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +106 -0
  4. data/Rakefile +8 -0
  5. data/docs/ApiResponseErrors.md +8 -0
  6. data/docs/ApiResponseErrorsErrors.md +10 -0
  7. data/docs/Club.md +10 -0
  8. data/docs/DefaultApi.md +293 -0
  9. data/docs/Game.md +26 -0
  10. data/docs/InlineResponse200.md +8 -0
  11. data/docs/InlineResponse2001.md +8 -0
  12. data/docs/InlineResponse2002.md +8 -0
  13. data/docs/InlineResponse2003.md +8 -0
  14. data/docs/InlineResponse2004.md +8 -0
  15. data/docs/InlineResponse2005.md +8 -0
  16. data/docs/Player.md +12 -0
  17. data/git_push.sh +55 -0
  18. data/lib/squash_matrix_api.rb +51 -0
  19. data/lib/squash_matrix_api/api/default_api.rb +353 -0
  20. data/lib/squash_matrix_api/api_client.rb +388 -0
  21. data/lib/squash_matrix_api/api_error.rb +38 -0
  22. data/lib/squash_matrix_api/configuration.rb +202 -0
  23. data/lib/squash_matrix_api/models/api_response_errors.rb +190 -0
  24. data/lib/squash_matrix_api/models/api_response_errors_errors.rb +216 -0
  25. data/lib/squash_matrix_api/models/club.rb +209 -0
  26. data/lib/squash_matrix_api/models/game.rb +353 -0
  27. data/lib/squash_matrix_api/models/inline_response_200.rb +190 -0
  28. data/lib/squash_matrix_api/models/inline_response_200_1.rb +188 -0
  29. data/lib/squash_matrix_api/models/inline_response_200_2.rb +190 -0
  30. data/lib/squash_matrix_api/models/inline_response_200_3.rb +188 -0
  31. data/lib/squash_matrix_api/models/inline_response_200_4.rb +190 -0
  32. data/lib/squash_matrix_api/models/inline_response_200_5.rb +188 -0
  33. data/lib/squash_matrix_api/models/player.rb +228 -0
  34. data/lib/squash_matrix_api/version.rb +15 -0
  35. data/spec/api/default_api_spec.rb +110 -0
  36. data/spec/api_client_spec.rb +226 -0
  37. data/spec/configuration_spec.rb +42 -0
  38. data/spec/models/api_response_errors_errors_spec.rb +54 -0
  39. data/spec/models/api_response_errors_spec.rb +42 -0
  40. data/spec/models/club_spec.rb +54 -0
  41. data/spec/models/game_spec.rb +150 -0
  42. data/spec/models/inline_response_200_1_spec.rb +42 -0
  43. data/spec/models/inline_response_200_2_spec.rb +42 -0
  44. data/spec/models/inline_response_200_3_spec.rb +42 -0
  45. data/spec/models/inline_response_200_4_spec.rb +42 -0
  46. data/spec/models/inline_response_200_5_spec.rb +42 -0
  47. data/spec/models/inline_response_200_spec.rb +42 -0
  48. data/spec/models/player_spec.rb +66 -0
  49. data/spec/spec_helper.rb +111 -0
  50. data/squash_matrix_api.gemspec +45 -0
  51. metadata +300 -0
@@ -0,0 +1,353 @@
1
+ =begin
2
+ #Squash Matrix API
3
+
4
+ ## Endeavor The squash matrix API enables clubs, players, and regions to own their information, with results being updated weekly. The API information sits ontop of squash matrix australia website [https://squashmatrix.com](https://squashmatrix.com) # API Aside from the documentation provided below, there is also a `{json:api}` available and can be accessed in the same manner, with the addition of the accept header `{accept: application/vnd.api+json}`. More information about json api can be viewed on their website at [http://jsonapi.org/](http://jsonapi.org/) # Squash Matrix Scrapper There is a ruby SDK for retrieving information from [https://squashmatrix.com](https://squashmatrix.com) which can be found at https://rubygems.org/gems/squash_matrix # SDK's Please stay posted! Client sdk's for the following will be provided shortly: - Javascript - Java - Ruby # Blog Find relevent and interesting media on [wilkosz.com.au](http://wilkosz.com.au) # Contact Join this endeavor and be appart of the community [https://www.facebook.com/squashmatrixapi](https://www.facebook.com/squashmatrixapi) <hr />
5
+
6
+ OpenAPI spec version: 1.0.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 SquashMatrixAPI
16
+
17
+ class Game
18
+ attr_accessor :id
19
+
20
+ attr_accessor :date
21
+
22
+ attr_accessor :division
23
+
24
+ attr_accessor :event
25
+
26
+ attr_accessor :round
27
+
28
+ attr_accessor :position
29
+
30
+ attr_accessor :player_a_name
31
+
32
+ attr_accessor :player_b_name
33
+
34
+ # Player association
35
+ attr_accessor :player_a_id
36
+
37
+ # Player association
38
+ attr_accessor :player_b_id
39
+
40
+ attr_accessor :player_a_points
41
+
42
+ attr_accessor :player_b_points
43
+
44
+ attr_accessor :player_a_games
45
+
46
+ attr_accessor :player_b_games
47
+
48
+ attr_accessor :player_a_rating
49
+
50
+ attr_accessor :player_b_rating
51
+
52
+ attr_accessor :player_a_rating_adjustment
53
+
54
+ attr_accessor :player_b_rating_adjustment
55
+
56
+ # Squash Matrix mathch id
57
+ attr_accessor :match_id
58
+
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'id' => :'id',
64
+ :'date' => :'date',
65
+ :'division' => :'division',
66
+ :'event' => :'event',
67
+ :'round' => :'round',
68
+ :'position' => :'position',
69
+ :'player_a_name' => :'player_a_name',
70
+ :'player_b_name' => :'player_b_name',
71
+ :'player_a_id' => :'player_a_id',
72
+ :'player_b_id' => :'player_b_id',
73
+ :'player_a_points' => :'player_a_points',
74
+ :'player_b_points' => :'player_b_points',
75
+ :'player_a_games' => :'player_a_games',
76
+ :'player_b_games' => :'player_b_games',
77
+ :'player_a_rating' => :'player_a_rating',
78
+ :'player_b_rating' => :'player_b_rating',
79
+ :'player_a_rating_adjustment' => :'player_a_rating_adjustment',
80
+ :'player_b_rating_adjustment' => :'player_b_rating_adjustment',
81
+ :'match_id' => :'match_id'
82
+ }
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.swagger_types
87
+ {
88
+ :'id' => :'Integer',
89
+ :'date' => :'Date',
90
+ :'division' => :'String',
91
+ :'event' => :'String',
92
+ :'round' => :'String',
93
+ :'position' => :'String',
94
+ :'player_a_name' => :'String',
95
+ :'player_b_name' => :'String',
96
+ :'player_a_id' => :'Integer',
97
+ :'player_b_id' => :'Integer',
98
+ :'player_a_points' => :'Integer',
99
+ :'player_b_points' => :'Integer',
100
+ :'player_a_games' => :'Integer',
101
+ :'player_b_games' => :'Integer',
102
+ :'player_a_rating' => :'Float',
103
+ :'player_b_rating' => :'Float',
104
+ :'player_a_rating_adjustment' => :'Float',
105
+ :'player_b_rating_adjustment' => :'Float',
106
+ :'match_id' => :'Integer'
107
+ }
108
+ end
109
+
110
+ # Initializes the object
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ def initialize(attributes = {})
113
+ return unless attributes.is_a?(Hash)
114
+
115
+ # convert string to symbol for hash key
116
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
117
+
118
+ if attributes.has_key?(:'id')
119
+ self.id = attributes[:'id']
120
+ end
121
+
122
+ if attributes.has_key?(:'date')
123
+ self.date = attributes[:'date']
124
+ end
125
+
126
+ if attributes.has_key?(:'division')
127
+ self.division = attributes[:'division']
128
+ end
129
+
130
+ if attributes.has_key?(:'event')
131
+ self.event = attributes[:'event']
132
+ end
133
+
134
+ if attributes.has_key?(:'round')
135
+ self.round = attributes[:'round']
136
+ end
137
+
138
+ if attributes.has_key?(:'position')
139
+ self.position = attributes[:'position']
140
+ end
141
+
142
+ if attributes.has_key?(:'player_a_name')
143
+ self.player_a_name = attributes[:'player_a_name']
144
+ end
145
+
146
+ if attributes.has_key?(:'player_b_name')
147
+ self.player_b_name = attributes[:'player_b_name']
148
+ end
149
+
150
+ if attributes.has_key?(:'player_a_id')
151
+ self.player_a_id = attributes[:'player_a_id']
152
+ end
153
+
154
+ if attributes.has_key?(:'player_b_id')
155
+ self.player_b_id = attributes[:'player_b_id']
156
+ end
157
+
158
+ if attributes.has_key?(:'player_a_points')
159
+ self.player_a_points = attributes[:'player_a_points']
160
+ end
161
+
162
+ if attributes.has_key?(:'player_b_points')
163
+ self.player_b_points = attributes[:'player_b_points']
164
+ end
165
+
166
+ if attributes.has_key?(:'player_a_games')
167
+ self.player_a_games = attributes[:'player_a_games']
168
+ end
169
+
170
+ if attributes.has_key?(:'player_b_games')
171
+ self.player_b_games = attributes[:'player_b_games']
172
+ end
173
+
174
+ if attributes.has_key?(:'player_a_rating')
175
+ self.player_a_rating = attributes[:'player_a_rating']
176
+ end
177
+
178
+ if attributes.has_key?(:'player_b_rating')
179
+ self.player_b_rating = attributes[:'player_b_rating']
180
+ end
181
+
182
+ if attributes.has_key?(:'player_a_rating_adjustment')
183
+ self.player_a_rating_adjustment = attributes[:'player_a_rating_adjustment']
184
+ end
185
+
186
+ if attributes.has_key?(:'player_b_rating_adjustment')
187
+ self.player_b_rating_adjustment = attributes[:'player_b_rating_adjustment']
188
+ end
189
+
190
+ if attributes.has_key?(:'match_id')
191
+ self.match_id = attributes[:'match_id']
192
+ end
193
+
194
+ end
195
+
196
+ # Show invalid properties with the reasons. Usually used together with valid?
197
+ # @return Array for valid properties with the reasons
198
+ def list_invalid_properties
199
+ invalid_properties = Array.new
200
+ return invalid_properties
201
+ end
202
+
203
+ # Check to see if the all the properties in the model are valid
204
+ # @return true if the model is valid
205
+ def valid?
206
+ return true
207
+ end
208
+
209
+ # Checks equality by comparing each attribute.
210
+ # @param [Object] Object to be compared
211
+ def ==(o)
212
+ return true if self.equal?(o)
213
+ self.class == o.class &&
214
+ id == o.id &&
215
+ date == o.date &&
216
+ division == o.division &&
217
+ event == o.event &&
218
+ round == o.round &&
219
+ position == o.position &&
220
+ player_a_name == o.player_a_name &&
221
+ player_b_name == o.player_b_name &&
222
+ player_a_id == o.player_a_id &&
223
+ player_b_id == o.player_b_id &&
224
+ player_a_points == o.player_a_points &&
225
+ player_b_points == o.player_b_points &&
226
+ player_a_games == o.player_a_games &&
227
+ player_b_games == o.player_b_games &&
228
+ player_a_rating == o.player_a_rating &&
229
+ player_b_rating == o.player_b_rating &&
230
+ player_a_rating_adjustment == o.player_a_rating_adjustment &&
231
+ player_b_rating_adjustment == o.player_b_rating_adjustment &&
232
+ match_id == o.match_id
233
+ end
234
+
235
+ # @see the `==` method
236
+ # @param [Object] Object to be compared
237
+ def eql?(o)
238
+ self == o
239
+ end
240
+
241
+ # Calculates hash code according to all attributes.
242
+ # @return [Fixnum] Hash code
243
+ def hash
244
+ [id, date, division, event, round, position, player_a_name, player_b_name, player_a_id, player_b_id, player_a_points, player_b_points, player_a_games, player_b_games, player_a_rating, player_b_rating, player_a_rating_adjustment, player_b_rating_adjustment, match_id].hash
245
+ end
246
+
247
+ # Builds the object from hash
248
+ # @param [Hash] attributes Model attributes in the form of hash
249
+ # @return [Object] Returns the model itself
250
+ def build_from_hash(attributes)
251
+ return nil unless attributes.is_a?(Hash)
252
+ self.class.swagger_types.each_pair do |key, type|
253
+ if type =~ /\AArray<(.*)>/i
254
+ # check to ensure the input is an array given that the the attribute
255
+ # is documented as an array but the input is not
256
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
257
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
258
+ end
259
+ elsif !attributes[self.class.attribute_map[key]].nil?
260
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
261
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
262
+ end
263
+
264
+ self
265
+ end
266
+
267
+ # Deserializes the data based on type
268
+ # @param string type Data type
269
+ # @param string value Value to be deserialized
270
+ # @return [Object] Deserialized data
271
+ def _deserialize(type, value)
272
+ case type.to_sym
273
+ when :DateTime
274
+ DateTime.parse(value)
275
+ when :Date
276
+ Date.parse(value)
277
+ when :String
278
+ value.to_s
279
+ when :Integer
280
+ value.to_i
281
+ when :Float
282
+ value.to_f
283
+ when :BOOLEAN
284
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
285
+ true
286
+ else
287
+ false
288
+ end
289
+ when :Object
290
+ # generic object (usually a Hash), return directly
291
+ value
292
+ when /\AArray<(?<inner_type>.+)>\z/
293
+ inner_type = Regexp.last_match[:inner_type]
294
+ value.map { |v| _deserialize(inner_type, v) }
295
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
296
+ k_type = Regexp.last_match[:k_type]
297
+ v_type = Regexp.last_match[:v_type]
298
+ {}.tap do |hash|
299
+ value.each do |k, v|
300
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
301
+ end
302
+ end
303
+ else # model
304
+ temp_model = SquashMatrixAPI.const_get(type).new
305
+ temp_model.build_from_hash(value)
306
+ end
307
+ end
308
+
309
+ # Returns the string representation of the object
310
+ # @return [String] String presentation of the object
311
+ def to_s
312
+ to_hash.to_s
313
+ end
314
+
315
+ # to_body is an alias to to_hash (backward compatibility)
316
+ # @return [Hash] Returns the object in the form of hash
317
+ def to_body
318
+ to_hash
319
+ end
320
+
321
+ # Returns the object in the form of hash
322
+ # @return [Hash] Returns the object in the form of hash
323
+ def to_hash
324
+ hash = {}
325
+ self.class.attribute_map.each_pair do |attr, param|
326
+ value = self.send(attr)
327
+ next if value.nil?
328
+ hash[param] = _to_hash(value)
329
+ end
330
+ hash
331
+ end
332
+
333
+ # Outputs non-array value in the form of hash
334
+ # For object, use to_hash. Otherwise, just return the value
335
+ # @param [Object] value Any valid value
336
+ # @return [Hash] Returns the value in the form of hash
337
+ def _to_hash(value)
338
+ if value.is_a?(Array)
339
+ value.compact.map{ |v| _to_hash(v) }
340
+ elsif value.is_a?(Hash)
341
+ {}.tap do |hash|
342
+ value.each { |k, v| hash[k] = _to_hash(v) }
343
+ end
344
+ elsif value.respond_to? :to_hash
345
+ value.to_hash
346
+ else
347
+ value
348
+ end
349
+ end
350
+
351
+ end
352
+
353
+ end
@@ -0,0 +1,190 @@
1
+ =begin
2
+ #Squash Matrix API
3
+
4
+ ## Endeavor The squash matrix API enables clubs, players, and regions to own their information, with results being updated weekly. The API information sits ontop of squash matrix australia website [https://squashmatrix.com](https://squashmatrix.com) # API Aside from the documentation provided below, there is also a `{json:api}` available and can be accessed in the same manner, with the addition of the accept header `{accept: application/vnd.api+json}`. More information about json api can be viewed on their website at [http://jsonapi.org/](http://jsonapi.org/) # Squash Matrix Scrapper There is a ruby SDK for retrieving information from [https://squashmatrix.com](https://squashmatrix.com) which can be found at https://rubygems.org/gems/squash_matrix # SDK's Please stay posted! Client sdk's for the following will be provided shortly: - Javascript - Java - Ruby # Blog Find relevent and interesting media on [wilkosz.com.au](http://wilkosz.com.au) # Contact Join this endeavor and be appart of the community [https://www.facebook.com/squashmatrixapi](https://www.facebook.com/squashmatrixapi) <hr />
5
+
6
+ OpenAPI spec version: 1.0.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 SquashMatrixAPI
16
+
17
+ class InlineResponse200
18
+ attr_accessor :data
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'data' => :'data'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'data' => :'Array<Club>'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
42
+
43
+ if attributes.has_key?(:'data')
44
+ if (value = attributes[:'data']).is_a?(Array)
45
+ self.data = value
46
+ end
47
+ end
48
+
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
+ return 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
+ return 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
+ data == o.data
70
+ end
71
+
72
+ # @see the `==` method
73
+ # @param [Object] Object to be compared
74
+ def eql?(o)
75
+ self == o
76
+ end
77
+
78
+ # Calculates hash code according to all attributes.
79
+ # @return [Fixnum] Hash code
80
+ def hash
81
+ [data].hash
82
+ end
83
+
84
+ # Builds the object from hash
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ # @return [Object] Returns the model itself
87
+ def build_from_hash(attributes)
88
+ return nil unless attributes.is_a?(Hash)
89
+ self.class.swagger_types.each_pair do |key, type|
90
+ if type =~ /\AArray<(.*)>/i
91
+ # check to ensure the input is an array given that the the attribute
92
+ # is documented as an array but the input is not
93
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
94
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
95
+ end
96
+ elsif !attributes[self.class.attribute_map[key]].nil?
97
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
98
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
99
+ end
100
+
101
+ self
102
+ end
103
+
104
+ # Deserializes the data based on type
105
+ # @param string type Data type
106
+ # @param string value Value to be deserialized
107
+ # @return [Object] Deserialized data
108
+ def _deserialize(type, value)
109
+ case type.to_sym
110
+ when :DateTime
111
+ DateTime.parse(value)
112
+ when :Date
113
+ Date.parse(value)
114
+ when :String
115
+ value.to_s
116
+ when :Integer
117
+ value.to_i
118
+ when :Float
119
+ value.to_f
120
+ when :BOOLEAN
121
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
122
+ true
123
+ else
124
+ false
125
+ end
126
+ when :Object
127
+ # generic object (usually a Hash), return directly
128
+ value
129
+ when /\AArray<(?<inner_type>.+)>\z/
130
+ inner_type = Regexp.last_match[:inner_type]
131
+ value.map { |v| _deserialize(inner_type, v) }
132
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
133
+ k_type = Regexp.last_match[:k_type]
134
+ v_type = Regexp.last_match[:v_type]
135
+ {}.tap do |hash|
136
+ value.each do |k, v|
137
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
138
+ end
139
+ end
140
+ else # model
141
+ temp_model = SquashMatrixAPI.const_get(type).new
142
+ temp_model.build_from_hash(value)
143
+ end
144
+ end
145
+
146
+ # Returns the string representation of the object
147
+ # @return [String] String presentation of the object
148
+ def to_s
149
+ to_hash.to_s
150
+ end
151
+
152
+ # to_body is an alias to to_hash (backward compatibility)
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_body
155
+ to_hash
156
+ end
157
+
158
+ # Returns the object in the form of hash
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_hash
161
+ hash = {}
162
+ self.class.attribute_map.each_pair do |attr, param|
163
+ value = self.send(attr)
164
+ next if value.nil?
165
+ hash[param] = _to_hash(value)
166
+ end
167
+ hash
168
+ end
169
+
170
+ # Outputs non-array value in the form of hash
171
+ # For object, use to_hash. Otherwise, just return the value
172
+ # @param [Object] value Any valid value
173
+ # @return [Hash] Returns the value in the form of hash
174
+ def _to_hash(value)
175
+ if value.is_a?(Array)
176
+ value.compact.map{ |v| _to_hash(v) }
177
+ elsif value.is_a?(Hash)
178
+ {}.tap do |hash|
179
+ value.each { |k, v| hash[k] = _to_hash(v) }
180
+ end
181
+ elsif value.respond_to? :to_hash
182
+ value.to_hash
183
+ else
184
+ value
185
+ end
186
+ end
187
+
188
+ end
189
+
190
+ end