ftc_events_client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +236 -0
  4. data/Rakefile +10 -0
  5. data/config.json +8 -0
  6. data/docs/AllianceModelVersion2.md +32 -0
  7. data/docs/AllianceScore2020.md +86 -0
  8. data/docs/AllianceSelectionApi.md +62 -0
  9. data/docs/AllianceSelectionModelVersion2.md +20 -0
  10. data/docs/ApiIndexModel.md +34 -0
  11. data/docs/AwardAssignmentModel.md +38 -0
  12. data/docs/AwardsApi.md +235 -0
  13. data/docs/AwardsModel.md +18 -0
  14. data/docs/EventMatchResultsModelVersion2.md +18 -0
  15. data/docs/EventRankingsModel.md +18 -0
  16. data/docs/EventScheduleHybridModelVersion2.md +18 -0
  17. data/docs/EventScheduleModelVersion2.md +18 -0
  18. data/docs/GeneralApi.md +51 -0
  19. data/docs/MatchResultModelVersion2.md +44 -0
  20. data/docs/MatchResultTeamModelVersion2.md +22 -0
  21. data/docs/MatchResultsApi.md +141 -0
  22. data/docs/MatchScoresModel.md +18 -0
  23. data/docs/MatchScoresModelMatchScoresOneOf.md +51 -0
  24. data/docs/RankingsApi.md +68 -0
  25. data/docs/ScheduleApi.md +135 -0
  26. data/docs/ScheduleHybridModelTeamVersion2.md +26 -0
  27. data/docs/ScheduleHybridModelVersion2.md +44 -0
  28. data/docs/ScheduledMatchModelVersion2.md +32 -0
  29. data/docs/ScheduledMatchTeamModelVersion2.md +24 -0
  30. data/docs/ScoreDetailAllianceModel2020.md +90 -0
  31. data/docs/ScoreDetailModel2019.md +22 -0
  32. data/docs/ScoreDetailModel2020.md +22 -0
  33. data/docs/ScoreDetailModelAlliance2019.md +84 -0
  34. data/docs/ScoreDetailModelSinglePlayer2020.md +24 -0
  35. data/docs/SeasonAwardListingsModel.md +18 -0
  36. data/docs/SeasonAwardsModel.md +24 -0
  37. data/docs/SeasonDataApi.md +182 -0
  38. data/docs/SeasonEventListingsModelVersion2.md +20 -0
  39. data/docs/SeasonEventModelVersion2.md +50 -0
  40. data/docs/SeasonSummaryModelChampionship.md +22 -0
  41. data/docs/SeasonSummaryModelVersion2.md +28 -0
  42. data/docs/SeasonTeamListingsModelVersion2.md +26 -0
  43. data/docs/SeasonTeamModelVersion2.md +40 -0
  44. data/docs/Stone.md +15 -0
  45. data/docs/TeamRankingModel.md +46 -0
  46. data/docs/TournamentLevel.md +15 -0
  47. data/ftc_events_client.gemspec +38 -0
  48. data/git_push.sh +58 -0
  49. data/lib/ftc_events_client.rb +80 -0
  50. data/lib/ftc_events_client/api/alliance_selection_api.rb +87 -0
  51. data/lib/ftc_events_client/api/awards_api.rb +296 -0
  52. data/lib/ftc_events_client/api/general_api.rb +79 -0
  53. data/lib/ftc_events_client/api/match_results_api.rb +185 -0
  54. data/lib/ftc_events_client/api/rankings_api.rb +93 -0
  55. data/lib/ftc_events_client/api/schedule_api.rb +176 -0
  56. data/lib/ftc_events_client/api/season_data_api.rb +229 -0
  57. data/lib/ftc_events_client/api_client.rb +390 -0
  58. data/lib/ftc_events_client/api_error.rb +57 -0
  59. data/lib/ftc_events_client/configuration.rb +275 -0
  60. data/lib/ftc_events_client/models/alliance_model_version2.rb +288 -0
  61. data/lib/ftc_events_client/models/alliance_score2020.rb +524 -0
  62. data/lib/ftc_events_client/models/alliance_selection_model_version2.rb +230 -0
  63. data/lib/ftc_events_client/models/api_index_model.rb +301 -0
  64. data/lib/ftc_events_client/models/award_assignment_model.rb +317 -0
  65. data/lib/ftc_events_client/models/awards_model.rb +221 -0
  66. data/lib/ftc_events_client/models/event_match_results_model_version2.rb +221 -0
  67. data/lib/ftc_events_client/models/event_rankings_model.rb +221 -0
  68. data/lib/ftc_events_client/models/event_schedule_hybrid_model_version2.rb +221 -0
  69. data/lib/ftc_events_client/models/event_schedule_model_version2.rb +221 -0
  70. data/lib/ftc_events_client/models/match_result_model_version2.rb +343 -0
  71. data/lib/ftc_events_client/models/match_result_team_model_version2.rb +237 -0
  72. data/lib/ftc_events_client/models/match_scores_model.rb +221 -0
  73. data/lib/ftc_events_client/models/match_scores_model_match_scores_one_of.rb +106 -0
  74. data/lib/ftc_events_client/models/schedule_hybrid_model_team_version2.rb +257 -0
  75. data/lib/ftc_events_client/models/schedule_hybrid_model_version2.rb +349 -0
  76. data/lib/ftc_events_client/models/scheduled_match_model_version2.rb +289 -0
  77. data/lib/ftc_events_client/models/scheduled_match_team_model_version2.rb +247 -0
  78. data/lib/ftc_events_client/models/score_detail_alliance_model2020.rb +543 -0
  79. data/lib/ftc_events_client/models/score_detail_model2019.rb +239 -0
  80. data/lib/ftc_events_client/models/score_detail_model2020.rb +239 -0
  81. data/lib/ftc_events_client/models/score_detail_model_alliance2019.rb +519 -0
  82. data/lib/ftc_events_client/models/score_detail_model_single_player2020.rb +245 -0
  83. data/lib/ftc_events_client/models/season_award_listings_model.rb +221 -0
  84. data/lib/ftc_events_client/models/season_awards_model.rb +247 -0
  85. data/lib/ftc_events_client/models/season_event_listings_model_version2.rb +230 -0
  86. data/lib/ftc_events_client/models/season_event_model_version2.rb +377 -0
  87. data/lib/ftc_events_client/models/season_summary_model_championship.rb +239 -0
  88. data/lib/ftc_events_client/models/season_summary_model_version2.rb +268 -0
  89. data/lib/ftc_events_client/models/season_team_listings_model_version2.rb +257 -0
  90. data/lib/ftc_events_client/models/season_team_model_version2.rb +328 -0
  91. data/lib/ftc_events_client/models/stone.rb +38 -0
  92. data/lib/ftc_events_client/models/team_ranking_model.rb +344 -0
  93. data/lib/ftc_events_client/models/tournament_level.rb +41 -0
  94. data/lib/ftc_events_client/version.rb +15 -0
  95. data/spec/api/alliance_selection_api_spec.rb +48 -0
  96. data/spec/api/awards_api_spec.rb +89 -0
  97. data/spec/api/general_api_spec.rb +46 -0
  98. data/spec/api/match_results_api_spec.rb +71 -0
  99. data/spec/api/rankings_api_spec.rb +50 -0
  100. data/spec/api/schedule_api_spec.rb +68 -0
  101. data/spec/api/season_data_api_spec.rb +77 -0
  102. data/spec/api_client_spec.rb +226 -0
  103. data/spec/configuration_spec.rb +42 -0
  104. data/spec/models/alliance_model_version2_spec.rb +76 -0
  105. data/spec/models/alliance_score2020_spec.rb +238 -0
  106. data/spec/models/alliance_selection_model_version2_spec.rb +40 -0
  107. data/spec/models/api_index_model_spec.rb +82 -0
  108. data/spec/models/award_assignment_model_spec.rb +94 -0
  109. data/spec/models/awards_model_spec.rb +34 -0
  110. data/spec/models/event_match_results_model_version2_spec.rb +34 -0
  111. data/spec/models/event_rankings_model_spec.rb +34 -0
  112. data/spec/models/event_schedule_hybrid_model_version2_spec.rb +34 -0
  113. data/spec/models/event_schedule_model_version2_spec.rb +34 -0
  114. data/spec/models/match_result_model_version2_spec.rb +112 -0
  115. data/spec/models/match_result_team_model_version2_spec.rb +46 -0
  116. data/spec/models/match_scores_model_match_scores_one_of_spec.rb +31 -0
  117. data/spec/models/match_scores_model_spec.rb +34 -0
  118. data/spec/models/schedule_hybrid_model_team_version2_spec.rb +58 -0
  119. data/spec/models/schedule_hybrid_model_version2_spec.rb +112 -0
  120. data/spec/models/scheduled_match_model_version2_spec.rb +76 -0
  121. data/spec/models/scheduled_match_team_model_version2_spec.rb +52 -0
  122. data/spec/models/score_detail_alliance_model2020_spec.rb +250 -0
  123. data/spec/models/score_detail_model2019_spec.rb +46 -0
  124. data/spec/models/score_detail_model2020_spec.rb +46 -0
  125. data/spec/models/score_detail_model_alliance2019_spec.rb +232 -0
  126. data/spec/models/score_detail_model_single_player2020_spec.rb +52 -0
  127. data/spec/models/season_award_listings_model_spec.rb +34 -0
  128. data/spec/models/season_awards_model_spec.rb +52 -0
  129. data/spec/models/season_event_listings_model_version2_spec.rb +40 -0
  130. data/spec/models/season_event_model_version2_spec.rb +130 -0
  131. data/spec/models/season_summary_model_championship_spec.rb +46 -0
  132. data/spec/models/season_summary_model_version2_spec.rb +64 -0
  133. data/spec/models/season_team_listings_model_version2_spec.rb +58 -0
  134. data/spec/models/season_team_model_version2_spec.rb +100 -0
  135. data/spec/models/stone_spec.rb +28 -0
  136. data/spec/models/team_ranking_model_spec.rb +118 -0
  137. data/spec/models/tournament_level_spec.rb +28 -0
  138. data/spec/spec_helper.rb +111 -0
  139. data/update.sh +8 -0
  140. metadata +265 -0
@@ -0,0 +1,519 @@
1
+ =begin
2
+ #FTC Events API
3
+
4
+ #FTC Events API is a service to return relevant information about the _FIRST_ Tech Challenge (FTC). Information is made available from events operating around the world Information is currently made available after the conclusion of the tournament. The API will provide data as soon as it has synced, and we do not add any artificial delays. ## Documentation Notes ### Timezones All times are listed in the local time to the event venue. HTTP-date values will show their timezone. ### Query Parameters If you specify a parameter, but no value for that parameter, it will be ignored. For example, if you request `URL?teamNumber=` the `teamNumber` parameter would be ignored. For all APIs that accept a query string in addition to the base URI, the order of parameters do not matter, but the name shown in the documentation must match exactly, as does the associated value format as described in details. For response codes that are not HTTP 200 (OK), the documentation will show a body message that represents a possible response value. While the \"title\" of the HTTP Status Code will match those shown in the response codes documentation section exactly, the body of the response will be a more detailed explanation of why that status code is being returned and may not always be exactly as shown in the examples. ### Experimenting with the API This documentation is rendered at both [api-docs](https://ftc-events.firstinspires.org/api-docs) and [try-it-out](https://ftc-events.firstinspires.org/try-it-out). [api-docs](https://ftc-events.firstinspires.org/api-docs) has a three panel, easy to read layout, while [try-it-out](https://ftc-events.firstinspires.org/try-it-out) has a feature that allows you try out endpoints from within the page. Additionally, the Open API Json is availabe at [Open API](https://ftc-events.firstinspires.org/swagger/v2.0/swagger.json). This can be imported into a tool such as [Postman](https://www.postman.com) for experimentation as well. ### Last-Modified, FMS-OnlyModifiedSince, and If-Modified-Since Headers The FTC Events API utilizes the `Last-Modified` and `If-Modified-Since` Headers to communicate with consumers regarding the age of the data they are requesting. With a couple of exceptions, all calls will return a `Last-Modified` Header set with the time at which the data at that endpoint was last modified. The Header will always be set in the HTTP-date format, as described in the HTTP Protocol. There are two exceptions: the `Last-Modified` Header is not set if the endpoint returns no results (such as a request for a schedule with no matches). Consumers should keep track of the `Last-Modified` Header, and return it on subsequent calls to the same endpoint as the If-Modified-Since. The server will recognize this request, and will only return a result if the data has been modified since the last request. If no changes have been made, an HTTP 304 will be returned. If data has been modified, ALL data on that call will be returned (for \"only modified\" data, see below). The FTC Events API also allows a custom header used to filter the return data to a specific subset. This is done by specifying a `FMS-OnlyModifiedSince` header with each call. As with the `If-Modified-Since` header, consumers should keep track of the Last-Modified Header, and return it on subsequent calls to the same endpoint as the `FMS-OnlyModifiedSince` Header. The server will recognize this request, and will only return a result if the data has been modified since the last request, and, if returned, the data will only be those portions modified since the included date. If no changes, have been made, an HTTP 304 will be returned. Using this method, the server and consumer save processing time by only receiving modified data that is in need of update on the consumer side. If the Headers are improperly passed (such as the wrong Day of Week for the matching date, or a date in the future), the endpoint will simply ignore the Header and return all results. If both headers are specified, the request will be denied. ## Response Codes The FTC Events API HTTP Status Codes correspond with the [common codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html), but occasionally with different \"titles\". The \"title\" used by the API is shown next to each of the below possible response HTTP Status Codes. Throughout the documentation, Apiary may automatically show the common \"title\" in example returns (like \"Not Found\" for 404) but on the production server, the \"title\" will instead match those listed below. ### HTTP 200 - \"OK\" The request has succeeded. An entity corresponding to the requested resource is sent in the response. This will be returned as the HTTP Status Code for all request that succeed, even if the body is empty (such as an event that has no rankings, but with a valid season and event code were used) ### HTTP 304 - \"Not Modified\" When utilizing a Header that allows filtered data returns, such as `If-Modified-Since`, this response indicates that no data meets the request. ### HTTP 400 - \"Invalid Season Requested\"/\"Malformed Parameter Format In Request\"/\"Missing Parameter In Request\"/\"Invalid API Version Requested\": The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications. Specifically for this API, a 400 response indicates that the requested URI matches with a valid API, but one or more required parameter was malformed or invalid. Examples include an event code that is too short or team number that contains a letter. ### HTTP 401 - \"Unauthorized\" All requests against the API require authentication via a valid user token. Failing to provide one, or providing an invalid one, will warrant a 401 response. The client MAY repeat the request with a suitable Authorization header field. ### HTTP 404 - \"Invalid Event Requested\" Even though the 404 code usually indicates any not found status, a 404 will only be issued in this API when an event cannot be found for the requested season and event code. If the request didn't match a valid API or there were malformed parameters, the response would not receive a 404 but rather a 400 or 501. If this HTTP code is received, the season was a valid season and the event code matched the acceptable style of an event code, but there were no records of an event matching the combination of that season and event code. For example, HTTP 404 would be issued when the event had a different code in the requested season (the codes can change year to year based on event location). ### HTTP 500 - \"Internal Server Error\" The server encountered an unexpected condition which prevented it from fulfilling the request. This is a code sent directly by the server, and has no special alternate definition specific to this API. ### HTTP 501 - \"Request Did Not Match Any Current API Pattern\" The server does not support the functionality required to fulfill the request. Specifically, the request pattern did not match any of the possible APIs, and thus processing was discontinued. This code is also issued when too many optional parameters were included in a single request and fulfilling it would make the result confusing or misleading. Each API will specify which parameters or combination of parameters can be used at the same time. ### HTTP 503 - \"Service Unavailable\" The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a `Retry-After` header. This code will not always appear, sometimes the server may outright refuse the connection instead. This is a code sent directly by the server, and has no special alternate definition specific to this API. ## Authorization In order to make calls against the FTC Events API, you must include an HTTP Header called `Authorization` with the value set as specified below. If a request is made without this header, processing stops and an HTTP 401 is issued. All `Authorization` headers follow the same format: ``` Authorization: Basic 000000000000000000000000000000000000000000000000000000000000 ``` Where the Zeros are replaced by your Token. The Token can be formed by taking your username and your AuthorizationKey and adding a colon. For example, if your username is `sampleuser` and your AuthorizationKey is `7eaa6338-a097-4221-ac04-b6120fcc4d49` you would have this string: ``` sampleuser:7eaa6338-a097-4221-ac04-b6120fcc4d49 ``` This string must then be encoded using Base64 Encoded to form the Token, which will be the same length as the example above, but include letters and numbers. For our example, we would have: ``` c2FtcGxldXNlcjo3ZWFhNjMzOC1hMDk3LTQyMjEtYWMwNC1iNjEyMGZjYzRkNDk= ``` Most API client libraries can handle computing the authorization header using a username and password for you NOTICE: Publicly distributing an application, code snippet, etc, that has your username and token in it, encoded or not, WILL result in your token being blocked from the API. Each user should apply for their own token. If you wish to acquire a token for your development, you may do so by requesting a token through our automated system on this website.
5
+
6
+ The version of the OpenAPI document: v2.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FtcEventsClient
17
+ class ScoreDetailModelAlliance2019
18
+ attr_accessor :alliance
19
+
20
+ attr_accessor :robot1_navigated
21
+
22
+ attr_accessor :robot1_parked
23
+
24
+ attr_accessor :robot1_capstone_level
25
+
26
+ attr_accessor :robot2_navigated
27
+
28
+ attr_accessor :robot2_parked
29
+
30
+ attr_accessor :robot2_capstone_level
31
+
32
+ attr_accessor :auto_stones
33
+
34
+ attr_accessor :auto_delivered
35
+
36
+ attr_accessor :auto_returned
37
+
38
+ attr_accessor :first_returned_is_skystone
39
+
40
+ attr_accessor :auto_placed
41
+
42
+ attr_accessor :foundation_repositioned
43
+
44
+ attr_accessor :foundation_moved
45
+
46
+ attr_accessor :driver_controlled_delivered
47
+
48
+ attr_accessor :driver_controlled_returned
49
+
50
+ attr_accessor :driver_controlled_placed
51
+
52
+ attr_accessor :tallest_skyscraper
53
+
54
+ attr_accessor :auto_delivery_points
55
+
56
+ attr_accessor :auto_placed_points
57
+
58
+ attr_accessor :autonomous_points
59
+
60
+ attr_accessor :repositioned_points
61
+
62
+ attr_accessor :navigation_points
63
+
64
+ attr_accessor :driver_controlled_delivery_points
65
+
66
+ attr_accessor :driver_controlled_placed_points
67
+
68
+ attr_accessor :skyscraper_bonus_points
69
+
70
+ attr_accessor :capstone_points
71
+
72
+ attr_accessor :driver_controlled_points
73
+
74
+ attr_accessor :parking_points
75
+
76
+ attr_accessor :end_game_points
77
+
78
+ attr_accessor :minor_penalties
79
+
80
+ attr_accessor :major_penalties
81
+
82
+ attr_accessor :penalty_points
83
+
84
+ attr_accessor :total_points
85
+
86
+ # Attribute mapping from ruby-style variable name to JSON key.
87
+ def self.attribute_map
88
+ {
89
+ :'alliance' => :'alliance',
90
+ :'robot1_navigated' => :'robot1Navigated',
91
+ :'robot1_parked' => :'robot1Parked',
92
+ :'robot1_capstone_level' => :'robot1CapstoneLevel',
93
+ :'robot2_navigated' => :'robot2Navigated',
94
+ :'robot2_parked' => :'robot2Parked',
95
+ :'robot2_capstone_level' => :'robot2CapstoneLevel',
96
+ :'auto_stones' => :'autoStones',
97
+ :'auto_delivered' => :'autoDelivered',
98
+ :'auto_returned' => :'autoReturned',
99
+ :'first_returned_is_skystone' => :'firstReturnedIsSkystone',
100
+ :'auto_placed' => :'autoPlaced',
101
+ :'foundation_repositioned' => :'foundationRepositioned',
102
+ :'foundation_moved' => :'foundationMoved',
103
+ :'driver_controlled_delivered' => :'driverControlledDelivered',
104
+ :'driver_controlled_returned' => :'driverControlledReturned',
105
+ :'driver_controlled_placed' => :'driverControlledPlaced',
106
+ :'tallest_skyscraper' => :'tallestSkyscraper',
107
+ :'auto_delivery_points' => :'autoDeliveryPoints',
108
+ :'auto_placed_points' => :'autoPlacedPoints',
109
+ :'autonomous_points' => :'autonomousPoints',
110
+ :'repositioned_points' => :'repositionedPoints',
111
+ :'navigation_points' => :'navigationPoints',
112
+ :'driver_controlled_delivery_points' => :'driverControlledDeliveryPoints',
113
+ :'driver_controlled_placed_points' => :'driverControlledPlacedPoints',
114
+ :'skyscraper_bonus_points' => :'skyscraperBonusPoints',
115
+ :'capstone_points' => :'capstonePoints',
116
+ :'driver_controlled_points' => :'driverControlledPoints',
117
+ :'parking_points' => :'parkingPoints',
118
+ :'end_game_points' => :'endGamePoints',
119
+ :'minor_penalties' => :'minorPenalties',
120
+ :'major_penalties' => :'majorPenalties',
121
+ :'penalty_points' => :'penaltyPoints',
122
+ :'total_points' => :'totalPoints'
123
+ }
124
+ end
125
+
126
+ # Returns all the JSON keys this model knows about
127
+ def self.acceptable_attributes
128
+ attribute_map.values
129
+ end
130
+
131
+ # Attribute type mapping.
132
+ def self.openapi_types
133
+ {
134
+ :'alliance' => :'String',
135
+ :'robot1_navigated' => :'Boolean',
136
+ :'robot1_parked' => :'Boolean',
137
+ :'robot1_capstone_level' => :'Integer',
138
+ :'robot2_navigated' => :'Boolean',
139
+ :'robot2_parked' => :'Boolean',
140
+ :'robot2_capstone_level' => :'Integer',
141
+ :'auto_stones' => :'Array<Stone>',
142
+ :'auto_delivered' => :'Integer',
143
+ :'auto_returned' => :'Integer',
144
+ :'first_returned_is_skystone' => :'Boolean',
145
+ :'auto_placed' => :'Integer',
146
+ :'foundation_repositioned' => :'Boolean',
147
+ :'foundation_moved' => :'Boolean',
148
+ :'driver_controlled_delivered' => :'Integer',
149
+ :'driver_controlled_returned' => :'Integer',
150
+ :'driver_controlled_placed' => :'Integer',
151
+ :'tallest_skyscraper' => :'Integer',
152
+ :'auto_delivery_points' => :'Integer',
153
+ :'auto_placed_points' => :'Integer',
154
+ :'autonomous_points' => :'Integer',
155
+ :'repositioned_points' => :'Integer',
156
+ :'navigation_points' => :'Integer',
157
+ :'driver_controlled_delivery_points' => :'Integer',
158
+ :'driver_controlled_placed_points' => :'Integer',
159
+ :'skyscraper_bonus_points' => :'Integer',
160
+ :'capstone_points' => :'Integer',
161
+ :'driver_controlled_points' => :'Integer',
162
+ :'parking_points' => :'Integer',
163
+ :'end_game_points' => :'Integer',
164
+ :'minor_penalties' => :'Integer',
165
+ :'major_penalties' => :'Integer',
166
+ :'penalty_points' => :'Integer',
167
+ :'total_points' => :'Integer'
168
+ }
169
+ end
170
+
171
+ # List of attributes with nullable: true
172
+ def self.openapi_nullable
173
+ Set.new([
174
+ :'alliance',
175
+ :'auto_stones',
176
+ ])
177
+ end
178
+
179
+ # Initializes the object
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ def initialize(attributes = {})
182
+ if (!attributes.is_a?(Hash))
183
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FtcEventsClient::ScoreDetailModelAlliance2019` initialize method"
184
+ end
185
+
186
+ # check to see if the attribute exists and convert string to symbol for hash key
187
+ attributes = attributes.each_with_object({}) { |(k, v), h|
188
+ if (!self.class.attribute_map.key?(k.to_sym))
189
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FtcEventsClient::ScoreDetailModelAlliance2019`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
190
+ end
191
+ h[k.to_sym] = v
192
+ }
193
+
194
+ if attributes.key?(:'alliance')
195
+ self.alliance = attributes[:'alliance']
196
+ end
197
+
198
+ if attributes.key?(:'robot1_navigated')
199
+ self.robot1_navigated = attributes[:'robot1_navigated']
200
+ end
201
+
202
+ if attributes.key?(:'robot1_parked')
203
+ self.robot1_parked = attributes[:'robot1_parked']
204
+ end
205
+
206
+ if attributes.key?(:'robot1_capstone_level')
207
+ self.robot1_capstone_level = attributes[:'robot1_capstone_level']
208
+ end
209
+
210
+ if attributes.key?(:'robot2_navigated')
211
+ self.robot2_navigated = attributes[:'robot2_navigated']
212
+ end
213
+
214
+ if attributes.key?(:'robot2_parked')
215
+ self.robot2_parked = attributes[:'robot2_parked']
216
+ end
217
+
218
+ if attributes.key?(:'robot2_capstone_level')
219
+ self.robot2_capstone_level = attributes[:'robot2_capstone_level']
220
+ end
221
+
222
+ if attributes.key?(:'auto_stones')
223
+ if (value = attributes[:'auto_stones']).is_a?(Array)
224
+ self.auto_stones = value
225
+ end
226
+ end
227
+
228
+ if attributes.key?(:'auto_delivered')
229
+ self.auto_delivered = attributes[:'auto_delivered']
230
+ end
231
+
232
+ if attributes.key?(:'auto_returned')
233
+ self.auto_returned = attributes[:'auto_returned']
234
+ end
235
+
236
+ if attributes.key?(:'first_returned_is_skystone')
237
+ self.first_returned_is_skystone = attributes[:'first_returned_is_skystone']
238
+ end
239
+
240
+ if attributes.key?(:'auto_placed')
241
+ self.auto_placed = attributes[:'auto_placed']
242
+ end
243
+
244
+ if attributes.key?(:'foundation_repositioned')
245
+ self.foundation_repositioned = attributes[:'foundation_repositioned']
246
+ end
247
+
248
+ if attributes.key?(:'foundation_moved')
249
+ self.foundation_moved = attributes[:'foundation_moved']
250
+ end
251
+
252
+ if attributes.key?(:'driver_controlled_delivered')
253
+ self.driver_controlled_delivered = attributes[:'driver_controlled_delivered']
254
+ end
255
+
256
+ if attributes.key?(:'driver_controlled_returned')
257
+ self.driver_controlled_returned = attributes[:'driver_controlled_returned']
258
+ end
259
+
260
+ if attributes.key?(:'driver_controlled_placed')
261
+ self.driver_controlled_placed = attributes[:'driver_controlled_placed']
262
+ end
263
+
264
+ if attributes.key?(:'tallest_skyscraper')
265
+ self.tallest_skyscraper = attributes[:'tallest_skyscraper']
266
+ end
267
+
268
+ if attributes.key?(:'auto_delivery_points')
269
+ self.auto_delivery_points = attributes[:'auto_delivery_points']
270
+ end
271
+
272
+ if attributes.key?(:'auto_placed_points')
273
+ self.auto_placed_points = attributes[:'auto_placed_points']
274
+ end
275
+
276
+ if attributes.key?(:'autonomous_points')
277
+ self.autonomous_points = attributes[:'autonomous_points']
278
+ end
279
+
280
+ if attributes.key?(:'repositioned_points')
281
+ self.repositioned_points = attributes[:'repositioned_points']
282
+ end
283
+
284
+ if attributes.key?(:'navigation_points')
285
+ self.navigation_points = attributes[:'navigation_points']
286
+ end
287
+
288
+ if attributes.key?(:'driver_controlled_delivery_points')
289
+ self.driver_controlled_delivery_points = attributes[:'driver_controlled_delivery_points']
290
+ end
291
+
292
+ if attributes.key?(:'driver_controlled_placed_points')
293
+ self.driver_controlled_placed_points = attributes[:'driver_controlled_placed_points']
294
+ end
295
+
296
+ if attributes.key?(:'skyscraper_bonus_points')
297
+ self.skyscraper_bonus_points = attributes[:'skyscraper_bonus_points']
298
+ end
299
+
300
+ if attributes.key?(:'capstone_points')
301
+ self.capstone_points = attributes[:'capstone_points']
302
+ end
303
+
304
+ if attributes.key?(:'driver_controlled_points')
305
+ self.driver_controlled_points = attributes[:'driver_controlled_points']
306
+ end
307
+
308
+ if attributes.key?(:'parking_points')
309
+ self.parking_points = attributes[:'parking_points']
310
+ end
311
+
312
+ if attributes.key?(:'end_game_points')
313
+ self.end_game_points = attributes[:'end_game_points']
314
+ end
315
+
316
+ if attributes.key?(:'minor_penalties')
317
+ self.minor_penalties = attributes[:'minor_penalties']
318
+ end
319
+
320
+ if attributes.key?(:'major_penalties')
321
+ self.major_penalties = attributes[:'major_penalties']
322
+ end
323
+
324
+ if attributes.key?(:'penalty_points')
325
+ self.penalty_points = attributes[:'penalty_points']
326
+ end
327
+
328
+ if attributes.key?(:'total_points')
329
+ self.total_points = attributes[:'total_points']
330
+ end
331
+ end
332
+
333
+ # Show invalid properties with the reasons. Usually used together with valid?
334
+ # @return Array for valid properties with the reasons
335
+ def list_invalid_properties
336
+ invalid_properties = Array.new
337
+ invalid_properties
338
+ end
339
+
340
+ # Check to see if the all the properties in the model are valid
341
+ # @return true if the model is valid
342
+ def valid?
343
+ true
344
+ end
345
+
346
+ # Checks equality by comparing each attribute.
347
+ # @param [Object] Object to be compared
348
+ def ==(o)
349
+ return true if self.equal?(o)
350
+ self.class == o.class &&
351
+ alliance == o.alliance &&
352
+ robot1_navigated == o.robot1_navigated &&
353
+ robot1_parked == o.robot1_parked &&
354
+ robot1_capstone_level == o.robot1_capstone_level &&
355
+ robot2_navigated == o.robot2_navigated &&
356
+ robot2_parked == o.robot2_parked &&
357
+ robot2_capstone_level == o.robot2_capstone_level &&
358
+ auto_stones == o.auto_stones &&
359
+ auto_delivered == o.auto_delivered &&
360
+ auto_returned == o.auto_returned &&
361
+ first_returned_is_skystone == o.first_returned_is_skystone &&
362
+ auto_placed == o.auto_placed &&
363
+ foundation_repositioned == o.foundation_repositioned &&
364
+ foundation_moved == o.foundation_moved &&
365
+ driver_controlled_delivered == o.driver_controlled_delivered &&
366
+ driver_controlled_returned == o.driver_controlled_returned &&
367
+ driver_controlled_placed == o.driver_controlled_placed &&
368
+ tallest_skyscraper == o.tallest_skyscraper &&
369
+ auto_delivery_points == o.auto_delivery_points &&
370
+ auto_placed_points == o.auto_placed_points &&
371
+ autonomous_points == o.autonomous_points &&
372
+ repositioned_points == o.repositioned_points &&
373
+ navigation_points == o.navigation_points &&
374
+ driver_controlled_delivery_points == o.driver_controlled_delivery_points &&
375
+ driver_controlled_placed_points == o.driver_controlled_placed_points &&
376
+ skyscraper_bonus_points == o.skyscraper_bonus_points &&
377
+ capstone_points == o.capstone_points &&
378
+ driver_controlled_points == o.driver_controlled_points &&
379
+ parking_points == o.parking_points &&
380
+ end_game_points == o.end_game_points &&
381
+ minor_penalties == o.minor_penalties &&
382
+ major_penalties == o.major_penalties &&
383
+ penalty_points == o.penalty_points &&
384
+ total_points == o.total_points
385
+ end
386
+
387
+ # @see the `==` method
388
+ # @param [Object] Object to be compared
389
+ def eql?(o)
390
+ self == o
391
+ end
392
+
393
+ # Calculates hash code according to all attributes.
394
+ # @return [Integer] Hash code
395
+ def hash
396
+ [alliance, robot1_navigated, robot1_parked, robot1_capstone_level, robot2_navigated, robot2_parked, robot2_capstone_level, auto_stones, auto_delivered, auto_returned, first_returned_is_skystone, auto_placed, foundation_repositioned, foundation_moved, driver_controlled_delivered, driver_controlled_returned, driver_controlled_placed, tallest_skyscraper, auto_delivery_points, auto_placed_points, autonomous_points, repositioned_points, navigation_points, driver_controlled_delivery_points, driver_controlled_placed_points, skyscraper_bonus_points, capstone_points, driver_controlled_points, parking_points, end_game_points, minor_penalties, major_penalties, penalty_points, total_points].hash
397
+ end
398
+
399
+ # Builds the object from hash
400
+ # @param [Hash] attributes Model attributes in the form of hash
401
+ # @return [Object] Returns the model itself
402
+ def self.build_from_hash(attributes)
403
+ new.build_from_hash(attributes)
404
+ end
405
+
406
+ # Builds the object from hash
407
+ # @param [Hash] attributes Model attributes in the form of hash
408
+ # @return [Object] Returns the model itself
409
+ def build_from_hash(attributes)
410
+ return nil unless attributes.is_a?(Hash)
411
+ self.class.openapi_types.each_pair do |key, type|
412
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
413
+ self.send("#{key}=", nil)
414
+ elsif type =~ /\AArray<(.*)>/i
415
+ # check to ensure the input is an array given that the attribute
416
+ # is documented as an array but the input is not
417
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
418
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
419
+ end
420
+ elsif !attributes[self.class.attribute_map[key]].nil?
421
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
422
+ end
423
+ end
424
+
425
+ self
426
+ end
427
+
428
+ # Deserializes the data based on type
429
+ # @param string type Data type
430
+ # @param string value Value to be deserialized
431
+ # @return [Object] Deserialized data
432
+ def _deserialize(type, value)
433
+ case type.to_sym
434
+ when :Time
435
+ Time.parse(value)
436
+ when :Date
437
+ Date.parse(value)
438
+ when :String
439
+ value.to_s
440
+ when :Integer
441
+ value.to_i
442
+ when :Float
443
+ value.to_f
444
+ when :Boolean
445
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
446
+ true
447
+ else
448
+ false
449
+ end
450
+ when :Object
451
+ # generic object (usually a Hash), return directly
452
+ value
453
+ when /\AArray<(?<inner_type>.+)>\z/
454
+ inner_type = Regexp.last_match[:inner_type]
455
+ value.map { |v| _deserialize(inner_type, v) }
456
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
457
+ k_type = Regexp.last_match[:k_type]
458
+ v_type = Regexp.last_match[:v_type]
459
+ {}.tap do |hash|
460
+ value.each do |k, v|
461
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
462
+ end
463
+ end
464
+ else # model
465
+ # models (e.g. Pet) or oneOf
466
+ klass = FtcEventsClient.const_get(type)
467
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
468
+ end
469
+ end
470
+
471
+ # Returns the string representation of the object
472
+ # @return [String] String presentation of the object
473
+ def to_s
474
+ to_hash.to_s
475
+ end
476
+
477
+ # to_body is an alias to to_hash (backward compatibility)
478
+ # @return [Hash] Returns the object in the form of hash
479
+ def to_body
480
+ to_hash
481
+ end
482
+
483
+ # Returns the object in the form of hash
484
+ # @return [Hash] Returns the object in the form of hash
485
+ def to_hash
486
+ hash = {}
487
+ self.class.attribute_map.each_pair do |attr, param|
488
+ value = self.send(attr)
489
+ if value.nil?
490
+ is_nullable = self.class.openapi_nullable.include?(attr)
491
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
492
+ end
493
+
494
+ hash[param] = _to_hash(value)
495
+ end
496
+ hash
497
+ end
498
+
499
+ # Outputs non-array value in the form of hash
500
+ # For object, use to_hash. Otherwise, just return the value
501
+ # @param [Object] value Any valid value
502
+ # @return [Hash] Returns the value in the form of hash
503
+ def _to_hash(value)
504
+ if value.is_a?(Array)
505
+ value.compact.map { |v| _to_hash(v) }
506
+ elsif value.is_a?(Hash)
507
+ {}.tap do |hash|
508
+ value.each { |k, v| hash[k] = _to_hash(v) }
509
+ end
510
+ elsif value.respond_to? :to_hash
511
+ value.to_hash
512
+ else
513
+ value
514
+ end
515
+ end
516
+
517
+ end
518
+
519
+ end