lishogi 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +661 -0
  4. data/LICENSE~ +1 -0
  5. data/Makefile +39 -0
  6. data/Makefile~ +7 -0
  7. data/README.md +276 -0
  8. data/Rakefile +10 -0
  9. data/docs/Account200Response.md +20 -0
  10. data/docs/AccountApi.md +345 -0
  11. data/docs/AccountEmail200Response.md +18 -0
  12. data/docs/AccountKid200Response.md +18 -0
  13. data/docs/AnalysisApi.md +77 -0
  14. data/docs/ApiStreamEvent200Response.md +53 -0
  15. data/docs/ApiUsersStatus200ResponseInner.md +30 -0
  16. data/docs/ArenaTournaments.md +22 -0
  17. data/docs/ArenaTournamentsApi.md +601 -0
  18. data/docs/BoardApi.md +659 -0
  19. data/docs/BoardGameStream200Response.md +51 -0
  20. data/docs/BoardGameTakebackAcceptParameter.md +15 -0
  21. data/docs/BotApi.md +634 -0
  22. data/docs/ChallengeDeclinedEvent.md +20 -0
  23. data/docs/ChallengeEvent.md +20 -0
  24. data/docs/ChallengeJson.md +42 -0
  25. data/docs/ChallengeJsonPerf.md +20 -0
  26. data/docs/ChallengeJsonTimeControl.md +51 -0
  27. data/docs/ChallengeJsonTimeControlOneOf.md +28 -0
  28. data/docs/ChallengeJsonTimeControlOneOf1.md +20 -0
  29. data/docs/ChallengeJsonTimeControlOneOf2.md +18 -0
  30. data/docs/ChallengeUser.md +30 -0
  31. data/docs/ChallengesApi.md +414 -0
  32. data/docs/ChatLineEvent.md +24 -0
  33. data/docs/Clock.md +24 -0
  34. data/docs/Count.md +38 -0
  35. data/docs/Error.md +18 -0
  36. data/docs/GameEventInfo.md +22 -0
  37. data/docs/GameEventInfoCompat.md +20 -0
  38. data/docs/GameEventPlayer.md +28 -0
  39. data/docs/GameFinishEvent.md +20 -0
  40. data/docs/GameFullEvent.md +42 -0
  41. data/docs/GameFullEventPerf.md +18 -0
  42. data/docs/GameJson.md +50 -0
  43. data/docs/GameJsonAnalysisInner.md +24 -0
  44. data/docs/GameJsonAnalysisInnerJudgment.md +20 -0
  45. data/docs/GameJsonClock.md +26 -0
  46. data/docs/GameJsonPlayers.md +20 -0
  47. data/docs/GameStartEvent.md +20 -0
  48. data/docs/GameStateEvent.md +38 -0
  49. data/docs/GameStatus.md +15 -0
  50. data/docs/GameUser.md +32 -0
  51. data/docs/GameUserAnalysis.md +24 -0
  52. data/docs/GamesApi.md +473 -0
  53. data/docs/LightUser.md +24 -0
  54. data/docs/LightUserTitle.md +49 -0
  55. data/docs/MessagingApi.md +79 -0
  56. data/docs/Move.md +28 -0
  57. data/docs/NotFound.md +18 -0
  58. data/docs/OAuthError.md +20 -0
  59. data/docs/Ok.md +18 -0
  60. data/docs/Perf.md +26 -0
  61. data/docs/PerfType.md +15 -0
  62. data/docs/Perfs.md +30 -0
  63. data/docs/PlayTime.md +20 -0
  64. data/docs/Profile.md +28 -0
  65. data/docs/PuzzleRoundJson.md +24 -0
  66. data/docs/PuzzlesApi.md +211 -0
  67. data/docs/SimulsApi.md +69 -0
  68. data/docs/Speed.md +15 -0
  69. data/docs/StudiesApi.md +233 -0
  70. data/docs/TVApi.md +208 -0
  71. data/docs/Team.md +32 -0
  72. data/docs/TeamAll200Response.md +30 -0
  73. data/docs/TeamRequest.md +24 -0
  74. data/docs/TeamRequestWithUser.md +20 -0
  75. data/docs/TeamsApi.md +702 -0
  76. data/docs/Title.md +15 -0
  77. data/docs/User.md +42 -0
  78. data/docs/UserExtended.md +60 -0
  79. data/docs/UserPreferences.md +72 -0
  80. data/docs/UsersApi.md +667 -0
  81. data/docs/Variant.md +22 -0
  82. data/docs/VariantKey.md +15 -0
  83. data/git_push.sh +57 -0
  84. data/lib/lishogi/api/account_api.rb +314 -0
  85. data/lib/lishogi/api/analysis_api.rb +92 -0
  86. data/lib/lishogi/api/arena_tournaments_api.rb +681 -0
  87. data/lib/lishogi/api/board_api.rb +685 -0
  88. data/lib/lishogi/api/bot_api.rb +608 -0
  89. data/lib/lishogi/api/challenges_api.rb +554 -0
  90. data/lib/lishogi/api/games_api.rb +514 -0
  91. data/lib/lishogi/api/messaging_api.rb +97 -0
  92. data/lib/lishogi/api/puzzles_api.rb +210 -0
  93. data/lib/lishogi/api/simuls_api.rb +79 -0
  94. data/lib/lishogi/api/studies_api.rb +244 -0
  95. data/lib/lishogi/api/teams_api.rb +678 -0
  96. data/lib/lishogi/api/tv_api.rb +222 -0
  97. data/lib/lishogi/api/users_api.rb +677 -0
  98. data/lib/lishogi/api_client.rb +437 -0
  99. data/lib/lishogi/api_error.rb +58 -0
  100. data/lib/lishogi/configuration.rb +392 -0
  101. data/lib/lishogi/models/account200_response.rb +223 -0
  102. data/lib/lishogi/models/account_email200_response.rb +214 -0
  103. data/lib/lishogi/models/account_kid200_response.rb +214 -0
  104. data/lib/lishogi/models/api_stream_event200_response.rb +107 -0
  105. data/lib/lishogi/models/api_users_status200_response_inner.rb +273 -0
  106. data/lib/lishogi/models/arena_tournaments.rb +238 -0
  107. data/lib/lishogi/models/board_game_stream200_response.rb +106 -0
  108. data/lib/lishogi/models/board_game_takeback_accept_parameter.rb +104 -0
  109. data/lib/lishogi/models/challenge_declined_event.rb +257 -0
  110. data/lib/lishogi/models/challenge_event.rb +257 -0
  111. data/lib/lishogi/models/challenge_json.rb +453 -0
  112. data/lib/lishogi/models/challenge_json_perf.rb +223 -0
  113. data/lib/lishogi/models/challenge_json_time_control.rb +106 -0
  114. data/lib/lishogi/models/challenge_json_time_control_one_of.rb +259 -0
  115. data/lib/lishogi/models/challenge_json_time_control_one_of1.rb +223 -0
  116. data/lib/lishogi/models/challenge_json_time_control_one_of2.rb +214 -0
  117. data/lib/lishogi/models/challenge_user.rb +275 -0
  118. data/lib/lishogi/models/chat_line_event.rb +315 -0
  119. data/lib/lishogi/models/clock.rb +242 -0
  120. data/lib/lishogi/models/count.rb +304 -0
  121. data/lib/lishogi/models/error.rb +215 -0
  122. data/lib/lishogi/models/game_event_info.rb +266 -0
  123. data/lib/lishogi/models/game_event_info_compat.rb +223 -0
  124. data/lib/lishogi/models/game_event_player.rb +260 -0
  125. data/lib/lishogi/models/game_finish_event.rb +257 -0
  126. data/lib/lishogi/models/game_full_event.rb +436 -0
  127. data/lib/lishogi/models/game_full_event_perf.rb +215 -0
  128. data/lib/lishogi/models/game_json.rb +457 -0
  129. data/lib/lishogi/models/game_json_analysis_inner.rb +251 -0
  130. data/lib/lishogi/models/game_json_analysis_inner_judgment.rb +258 -0
  131. data/lib/lishogi/models/game_json_clock.rb +250 -0
  132. data/lib/lishogi/models/game_json_players.rb +223 -0
  133. data/lib/lishogi/models/game_start_event.rb +257 -0
  134. data/lib/lishogi/models/game_state_event.rb +396 -0
  135. data/lib/lishogi/models/game_status.rb +52 -0
  136. data/lib/lishogi/models/game_user.rb +277 -0
  137. data/lib/lishogi/models/game_user_analysis.rb +269 -0
  138. data/lib/lishogi/models/light_user.rb +241 -0
  139. data/lib/lishogi/models/light_user_title.rb +105 -0
  140. data/lib/lishogi/models/move.rb +259 -0
  141. data/lib/lishogi/models/not_found.rb +214 -0
  142. data/lib/lishogi/models/o_auth_error.rb +225 -0
  143. data/lib/lishogi/models/ok.rb +214 -0
  144. data/lib/lishogi/models/perf.rb +250 -0
  145. data/lib/lishogi/models/perf_type.rb +49 -0
  146. data/lib/lishogi/models/perfs.rb +268 -0
  147. data/lib/lishogi/models/play_time.rb +223 -0
  148. data/lib/lishogi/models/profile.rb +259 -0
  149. data/lib/lishogi/models/puzzle_round_json.rb +241 -0
  150. data/lib/lishogi/models/speed.rb +44 -0
  151. data/lib/lishogi/models/team.rb +280 -0
  152. data/lib/lishogi/models/team_all200_response.rb +272 -0
  153. data/lib/lishogi/models/team_request.rb +241 -0
  154. data/lib/lishogi/models/team_request_with_user.rb +223 -0
  155. data/lib/lishogi/models/title.rb +64 -0
  156. data/lib/lishogi/models/user.rb +322 -0
  157. data/lib/lishogi/models/user_extended.rb +410 -0
  158. data/lib/lishogi/models/user_preferences.rb +515 -0
  159. data/lib/lishogi/models/variant.rb +256 -0
  160. data/lib/lishogi/models/variant_key.rb +44 -0
  161. data/lib/lishogi/version.rb +15 -0
  162. data/lib/lishogi.rb +112 -0
  163. data/lishogi-api.patched.yaml +5806 -0
  164. data/lishogi-api.yaml +5811 -0
  165. data/lishogi.gemspec +41 -0
  166. data/manifest.scm +1 -0
  167. data/manifest.scm~ +1 -0
  168. data/patch +5 -0
  169. data/patch~ +1 -0
  170. data/pkg/lishogi-0.1.0.gem +0 -0
  171. data/smoke +5 -0
  172. data/smoke~ +2 -0
  173. data/spec/api/account_api_spec.rb +91 -0
  174. data/spec/api/analysis_api_spec.rb +49 -0
  175. data/spec/api/arena_tournaments_api_spec.rb +160 -0
  176. data/spec/api/board_api_spec.rb +154 -0
  177. data/spec/api/bot_api_spec.rb +144 -0
  178. data/spec/api/challenges_api_spec.rb +123 -0
  179. data/spec/api/games_api_spec.rb +135 -0
  180. data/spec/api/messaging_api_spec.rb +48 -0
  181. data/spec/api/puzzles_api_spec.rb +70 -0
  182. data/spec/api/simuls_api_spec.rb +46 -0
  183. data/spec/api/studies_api_spec.rb +81 -0
  184. data/spec/api/teams_api_spec.rb +160 -0
  185. data/spec/api/tv_api_spec.rb +74 -0
  186. data/spec/api/users_api_spec.rb +157 -0
  187. data/spec/models/account200_response_spec.rb +42 -0
  188. data/spec/models/account_email200_response_spec.rb +36 -0
  189. data/spec/models/account_kid200_response_spec.rb +36 -0
  190. data/spec/models/api_stream_event200_response_spec.rb +32 -0
  191. data/spec/models/api_users_status200_response_inner_spec.rb +72 -0
  192. data/spec/models/arena_tournaments_spec.rb +48 -0
  193. data/spec/models/board_game_stream200_response_spec.rb +32 -0
  194. data/spec/models/board_game_takeback_accept_parameter_spec.rb +21 -0
  195. data/spec/models/challenge_declined_event_spec.rb +46 -0
  196. data/spec/models/challenge_event_spec.rb +46 -0
  197. data/spec/models/challenge_json_perf_spec.rb +42 -0
  198. data/spec/models/challenge_json_spec.rb +120 -0
  199. data/spec/models/challenge_json_time_control_one_of1_spec.rb +42 -0
  200. data/spec/models/challenge_json_time_control_one_of2_spec.rb +36 -0
  201. data/spec/models/challenge_json_time_control_one_of_spec.rb +66 -0
  202. data/spec/models/challenge_json_time_control_spec.rb +32 -0
  203. data/spec/models/challenge_user_spec.rb +72 -0
  204. data/spec/models/chat_line_event_spec.rb +62 -0
  205. data/spec/models/clock_spec.rb +54 -0
  206. data/spec/models/count_spec.rb +96 -0
  207. data/spec/models/error_spec.rb +36 -0
  208. data/spec/models/game_event_info_compat_spec.rb +42 -0
  209. data/spec/models/game_event_info_spec.rb +52 -0
  210. data/spec/models/game_event_player_spec.rb +66 -0
  211. data/spec/models/game_finish_event_spec.rb +46 -0
  212. data/spec/models/game_full_event_perf_spec.rb +36 -0
  213. data/spec/models/game_full_event_spec.rb +112 -0
  214. data/spec/models/game_json_analysis_inner_judgment_spec.rb +46 -0
  215. data/spec/models/game_json_analysis_inner_spec.rb +54 -0
  216. data/spec/models/game_json_clock_spec.rb +60 -0
  217. data/spec/models/game_json_players_spec.rb +42 -0
  218. data/spec/models/game_json_spec.rb +136 -0
  219. data/spec/models/game_start_event_spec.rb +46 -0
  220. data/spec/models/game_state_event_spec.rb +100 -0
  221. data/spec/models/game_status_spec.rb +30 -0
  222. data/spec/models/game_user_analysis_spec.rb +54 -0
  223. data/spec/models/game_user_spec.rb +78 -0
  224. data/spec/models/light_user_spec.rb +54 -0
  225. data/spec/models/light_user_title_spec.rb +32 -0
  226. data/spec/models/move_spec.rb +66 -0
  227. data/spec/models/not_found_spec.rb +36 -0
  228. data/spec/models/o_auth_error_spec.rb +42 -0
  229. data/spec/models/ok_spec.rb +36 -0
  230. data/spec/models/perf_spec.rb +60 -0
  231. data/spec/models/perf_type_spec.rb +30 -0
  232. data/spec/models/perfs_spec.rb +72 -0
  233. data/spec/models/play_time_spec.rb +42 -0
  234. data/spec/models/profile_spec.rb +66 -0
  235. data/spec/models/puzzle_round_json_spec.rb +54 -0
  236. data/spec/models/speed_spec.rb +30 -0
  237. data/spec/models/team_all200_response_spec.rb +72 -0
  238. data/spec/models/team_request_spec.rb +54 -0
  239. data/spec/models/team_request_with_user_spec.rb +42 -0
  240. data/spec/models/team_spec.rb +78 -0
  241. data/spec/models/title_spec.rb +30 -0
  242. data/spec/models/user_extended_spec.rb +162 -0
  243. data/spec/models/user_preferences_spec.rb +210 -0
  244. data/spec/models/user_spec.rb +108 -0
  245. data/spec/models/variant_key_spec.rb +30 -0
  246. data/spec/models/variant_spec.rb +48 -0
  247. data/spec/spec_helper.rb +111 -0
  248. metadata +446 -0
@@ -0,0 +1,515 @@
1
+ =begin
2
+ #Lishogi.org API reference
3
+
4
+ ## Introduction Welcome to the reference for the Lishogi API! Lishogi is free/libre, open-source shogi server forked from lichess powered by volunteers and donations. Currently this page is a work in progress, certain information here might be wrong and incorrect! Expect it to be done during 2022. - Get help in the [Lishogi Discord channel](https://discord.gg/YFtpMGg3rR) - [Contribute to this documentation on Github](https://github.com/WandererXII/lishogi/blob/master/public/doc/lishogi-api.yaml) - Check out [Lishogi widgets to embed in your website](https://lishogi.org/developers) ## Endpoint All requests go to `https://lishogi.org` (unless otherwise specified). ## Rate limiting All requests are rate limited using various strategies, to ensure the API remains responsive for everyone. Only make one request at a time. If you receive an HTTP response with a [429 status](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#429), please wait a full minute before resuming API usage. ## Streaming with ND-JSON Some API endpoints stream their responses as [Newline Delimited JSON a.k.a. **nd-json**](http://ndjson.org/), with one JSON object per line. Here's a [JavaScript utility function (for lichess)](https://gist.github.com/ornicar/a097406810939cf7be1df8ea30e94f3e) to help reading NDJSON streamed responses.
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: contact@lishogi.org
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Lishogi
17
+ class UserPreferences
18
+ attr_accessor :dark
19
+
20
+ attr_accessor :transp
21
+
22
+ attr_accessor :bg_img
23
+
24
+ attr_accessor :theme
25
+
26
+ attr_accessor :piece_set
27
+
28
+ attr_accessor :sound_set
29
+
30
+ attr_accessor :blindfold
31
+
32
+ attr_accessor :takeback
33
+
34
+ attr_accessor :moretime
35
+
36
+ attr_accessor :clock_tenths
37
+
38
+ attr_accessor :clock_bar
39
+
40
+ attr_accessor :clock_sound
41
+
42
+ attr_accessor :premove
43
+
44
+ attr_accessor :animation
45
+
46
+ attr_accessor :captured
47
+
48
+ attr_accessor :follow
49
+
50
+ attr_accessor :highlight
51
+
52
+ attr_accessor :destination
53
+
54
+ attr_accessor :coords
55
+
56
+ attr_accessor :replay
57
+
58
+ attr_accessor :challenge
59
+
60
+ attr_accessor :message
61
+
62
+ attr_accessor :coord_color
63
+
64
+ attr_accessor :submit_move
65
+
66
+ attr_accessor :confirm_resign
67
+
68
+ attr_accessor :keyboard_move
69
+
70
+ attr_accessor :zen
71
+
72
+ attr_accessor :move_event
73
+
74
+ class EnumAttributeValidator
75
+ attr_reader :datatype
76
+ attr_reader :allowable_values
77
+
78
+ def initialize(datatype, allowable_values)
79
+ @allowable_values = allowable_values.map do |value|
80
+ case datatype.to_s
81
+ when /Integer/i
82
+ value.to_i
83
+ when /Float/i
84
+ value.to_f
85
+ else
86
+ value
87
+ end
88
+ end
89
+ end
90
+
91
+ def valid?(value)
92
+ !value || allowable_values.include?(value)
93
+ end
94
+ end
95
+
96
+ # Attribute mapping from ruby-style variable name to JSON key.
97
+ def self.attribute_map
98
+ {
99
+ :'dark' => :'dark',
100
+ :'transp' => :'transp',
101
+ :'bg_img' => :'bgImg',
102
+ :'theme' => :'theme',
103
+ :'piece_set' => :'pieceSet',
104
+ :'sound_set' => :'soundSet',
105
+ :'blindfold' => :'blindfold',
106
+ :'takeback' => :'takeback',
107
+ :'moretime' => :'moretime',
108
+ :'clock_tenths' => :'clockTenths',
109
+ :'clock_bar' => :'clockBar',
110
+ :'clock_sound' => :'clockSound',
111
+ :'premove' => :'premove',
112
+ :'animation' => :'animation',
113
+ :'captured' => :'captured',
114
+ :'follow' => :'follow',
115
+ :'highlight' => :'highlight',
116
+ :'destination' => :'destination',
117
+ :'coords' => :'coords',
118
+ :'replay' => :'replay',
119
+ :'challenge' => :'challenge',
120
+ :'message' => :'message',
121
+ :'coord_color' => :'coordColor',
122
+ :'submit_move' => :'submitMove',
123
+ :'confirm_resign' => :'confirmResign',
124
+ :'keyboard_move' => :'keyboardMove',
125
+ :'zen' => :'zen',
126
+ :'move_event' => :'moveEvent'
127
+ }
128
+ end
129
+
130
+ # Returns all the JSON keys this model knows about
131
+ def self.acceptable_attributes
132
+ attribute_map.values
133
+ end
134
+
135
+ # Attribute type mapping.
136
+ def self.openapi_types
137
+ {
138
+ :'dark' => :'Boolean',
139
+ :'transp' => :'Boolean',
140
+ :'bg_img' => :'String',
141
+ :'theme' => :'String',
142
+ :'piece_set' => :'String',
143
+ :'sound_set' => :'String',
144
+ :'blindfold' => :'Integer',
145
+ :'takeback' => :'Integer',
146
+ :'moretime' => :'Integer',
147
+ :'clock_tenths' => :'Integer',
148
+ :'clock_bar' => :'Boolean',
149
+ :'clock_sound' => :'Boolean',
150
+ :'premove' => :'Boolean',
151
+ :'animation' => :'Integer',
152
+ :'captured' => :'Boolean',
153
+ :'follow' => :'Boolean',
154
+ :'highlight' => :'Boolean',
155
+ :'destination' => :'Boolean',
156
+ :'coords' => :'Integer',
157
+ :'replay' => :'Integer',
158
+ :'challenge' => :'Integer',
159
+ :'message' => :'Integer',
160
+ :'coord_color' => :'Integer',
161
+ :'submit_move' => :'Integer',
162
+ :'confirm_resign' => :'Integer',
163
+ :'keyboard_move' => :'Integer',
164
+ :'zen' => :'Integer',
165
+ :'move_event' => :'Integer'
166
+ }
167
+ end
168
+
169
+ # List of attributes with nullable: true
170
+ def self.openapi_nullable
171
+ Set.new([
172
+ ])
173
+ end
174
+
175
+ # Initializes the object
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ def initialize(attributes = {})
178
+ if (!attributes.is_a?(Hash))
179
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Lishogi::UserPreferences` initialize method"
180
+ end
181
+
182
+ # check to see if the attribute exists and convert string to symbol for hash key
183
+ attributes = attributes.each_with_object({}) { |(k, v), h|
184
+ if (!self.class.attribute_map.key?(k.to_sym))
185
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Lishogi::UserPreferences`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
186
+ end
187
+ h[k.to_sym] = v
188
+ }
189
+
190
+ if attributes.key?(:'dark')
191
+ self.dark = attributes[:'dark']
192
+ end
193
+
194
+ if attributes.key?(:'transp')
195
+ self.transp = attributes[:'transp']
196
+ end
197
+
198
+ if attributes.key?(:'bg_img')
199
+ self.bg_img = attributes[:'bg_img']
200
+ end
201
+
202
+ if attributes.key?(:'theme')
203
+ self.theme = attributes[:'theme']
204
+ end
205
+
206
+ if attributes.key?(:'piece_set')
207
+ self.piece_set = attributes[:'piece_set']
208
+ end
209
+
210
+ if attributes.key?(:'sound_set')
211
+ self.sound_set = attributes[:'sound_set']
212
+ end
213
+
214
+ if attributes.key?(:'blindfold')
215
+ self.blindfold = attributes[:'blindfold']
216
+ end
217
+
218
+ if attributes.key?(:'takeback')
219
+ self.takeback = attributes[:'takeback']
220
+ end
221
+
222
+ if attributes.key?(:'moretime')
223
+ self.moretime = attributes[:'moretime']
224
+ end
225
+
226
+ if attributes.key?(:'clock_tenths')
227
+ self.clock_tenths = attributes[:'clock_tenths']
228
+ end
229
+
230
+ if attributes.key?(:'clock_bar')
231
+ self.clock_bar = attributes[:'clock_bar']
232
+ end
233
+
234
+ if attributes.key?(:'clock_sound')
235
+ self.clock_sound = attributes[:'clock_sound']
236
+ end
237
+
238
+ if attributes.key?(:'premove')
239
+ self.premove = attributes[:'premove']
240
+ end
241
+
242
+ if attributes.key?(:'animation')
243
+ self.animation = attributes[:'animation']
244
+ end
245
+
246
+ if attributes.key?(:'captured')
247
+ self.captured = attributes[:'captured']
248
+ end
249
+
250
+ if attributes.key?(:'follow')
251
+ self.follow = attributes[:'follow']
252
+ end
253
+
254
+ if attributes.key?(:'highlight')
255
+ self.highlight = attributes[:'highlight']
256
+ end
257
+
258
+ if attributes.key?(:'destination')
259
+ self.destination = attributes[:'destination']
260
+ end
261
+
262
+ if attributes.key?(:'coords')
263
+ self.coords = attributes[:'coords']
264
+ end
265
+
266
+ if attributes.key?(:'replay')
267
+ self.replay = attributes[:'replay']
268
+ end
269
+
270
+ if attributes.key?(:'challenge')
271
+ self.challenge = attributes[:'challenge']
272
+ end
273
+
274
+ if attributes.key?(:'message')
275
+ self.message = attributes[:'message']
276
+ end
277
+
278
+ if attributes.key?(:'coord_color')
279
+ self.coord_color = attributes[:'coord_color']
280
+ end
281
+
282
+ if attributes.key?(:'submit_move')
283
+ self.submit_move = attributes[:'submit_move']
284
+ end
285
+
286
+ if attributes.key?(:'confirm_resign')
287
+ self.confirm_resign = attributes[:'confirm_resign']
288
+ end
289
+
290
+ if attributes.key?(:'keyboard_move')
291
+ self.keyboard_move = attributes[:'keyboard_move']
292
+ end
293
+
294
+ if attributes.key?(:'zen')
295
+ self.zen = attributes[:'zen']
296
+ end
297
+
298
+ if attributes.key?(:'move_event')
299
+ self.move_event = attributes[:'move_event']
300
+ end
301
+ end
302
+
303
+ # Show invalid properties with the reasons. Usually used together with valid?
304
+ # @return Array for valid properties with the reasons
305
+ def list_invalid_properties
306
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
307
+ invalid_properties = Array.new
308
+ invalid_properties
309
+ end
310
+
311
+ # Check to see if the all the properties in the model are valid
312
+ # @return true if the model is valid
313
+ def valid?
314
+ warn '[DEPRECATED] the `valid?` method is obsolete'
315
+ theme_validator = EnumAttributeValidator.new('String', ["orange", "natural", "wood", "wood1", "kaya1", "kaya2", "oak", "blue", "grey", "painting1", "painting2", "kinkaku", "space", "dobutsu", "custom"])
316
+ return false unless theme_validator.valid?(@theme)
317
+ piece_set_validator = EnumAttributeValidator.new('String', ["kanji_light", "kanji_brown", "Ryoko_1Kanji", "orangain", "kanji_red_wood", "Portella", "Portella_2Kanji", "1Kanji_3D", "2Kanji_3D", "Shogi_cz", "Engraved_cz", "Kanji_Guide_Shadowed", "Valdivia", "Vald_opt", "pixel", "shogi_BnW", "Intl_Colored_2D", "Intl_Colored_3D", "Intl_Shadowed", "Intl_Monochrome_2D", "Intl_Wooden_3D", "Intl_Portella", "international", "simple_kanji", "doubutsu", "Logy_Games", "western"])
318
+ return false unless piece_set_validator.valid?(@piece_set)
319
+ sound_set_validator = EnumAttributeValidator.new('String', ["silent", "chess", "nes", "sfx", "futuristic", "robot", "music", "shogiAlt", "shogi", "speech"])
320
+ return false unless sound_set_validator.valid?(@sound_set)
321
+ true
322
+ end
323
+
324
+ # Custom attribute writer method checking allowed values (enum).
325
+ # @param [Object] theme Object to be assigned
326
+ def theme=(theme)
327
+ validator = EnumAttributeValidator.new('String', ["orange", "natural", "wood", "wood1", "kaya1", "kaya2", "oak", "blue", "grey", "painting1", "painting2", "kinkaku", "space", "dobutsu", "custom"])
328
+ unless validator.valid?(theme)
329
+ fail ArgumentError, "invalid value for \"theme\", must be one of #{validator.allowable_values}."
330
+ end
331
+ @theme = theme
332
+ end
333
+
334
+ # Custom attribute writer method checking allowed values (enum).
335
+ # @param [Object] piece_set Object to be assigned
336
+ def piece_set=(piece_set)
337
+ validator = EnumAttributeValidator.new('String', ["kanji_light", "kanji_brown", "Ryoko_1Kanji", "orangain", "kanji_red_wood", "Portella", "Portella_2Kanji", "1Kanji_3D", "2Kanji_3D", "Shogi_cz", "Engraved_cz", "Kanji_Guide_Shadowed", "Valdivia", "Vald_opt", "pixel", "shogi_BnW", "Intl_Colored_2D", "Intl_Colored_3D", "Intl_Shadowed", "Intl_Monochrome_2D", "Intl_Wooden_3D", "Intl_Portella", "international", "simple_kanji", "doubutsu", "Logy_Games", "western"])
338
+ unless validator.valid?(piece_set)
339
+ fail ArgumentError, "invalid value for \"piece_set\", must be one of #{validator.allowable_values}."
340
+ end
341
+ @piece_set = piece_set
342
+ end
343
+
344
+ # Custom attribute writer method checking allowed values (enum).
345
+ # @param [Object] sound_set Object to be assigned
346
+ def sound_set=(sound_set)
347
+ validator = EnumAttributeValidator.new('String', ["silent", "chess", "nes", "sfx", "futuristic", "robot", "music", "shogiAlt", "shogi", "speech"])
348
+ unless validator.valid?(sound_set)
349
+ fail ArgumentError, "invalid value for \"sound_set\", must be one of #{validator.allowable_values}."
350
+ end
351
+ @sound_set = sound_set
352
+ end
353
+
354
+ # Checks equality by comparing each attribute.
355
+ # @param [Object] Object to be compared
356
+ def ==(o)
357
+ return true if self.equal?(o)
358
+ self.class == o.class &&
359
+ dark == o.dark &&
360
+ transp == o.transp &&
361
+ bg_img == o.bg_img &&
362
+ theme == o.theme &&
363
+ piece_set == o.piece_set &&
364
+ sound_set == o.sound_set &&
365
+ blindfold == o.blindfold &&
366
+ takeback == o.takeback &&
367
+ moretime == o.moretime &&
368
+ clock_tenths == o.clock_tenths &&
369
+ clock_bar == o.clock_bar &&
370
+ clock_sound == o.clock_sound &&
371
+ premove == o.premove &&
372
+ animation == o.animation &&
373
+ captured == o.captured &&
374
+ follow == o.follow &&
375
+ highlight == o.highlight &&
376
+ destination == o.destination &&
377
+ coords == o.coords &&
378
+ replay == o.replay &&
379
+ challenge == o.challenge &&
380
+ message == o.message &&
381
+ coord_color == o.coord_color &&
382
+ submit_move == o.submit_move &&
383
+ confirm_resign == o.confirm_resign &&
384
+ keyboard_move == o.keyboard_move &&
385
+ zen == o.zen &&
386
+ move_event == o.move_event
387
+ end
388
+
389
+ # @see the `==` method
390
+ # @param [Object] Object to be compared
391
+ def eql?(o)
392
+ self == o
393
+ end
394
+
395
+ # Calculates hash code according to all attributes.
396
+ # @return [Integer] Hash code
397
+ def hash
398
+ [dark, transp, bg_img, theme, piece_set, sound_set, blindfold, takeback, moretime, clock_tenths, clock_bar, clock_sound, premove, animation, captured, follow, highlight, destination, coords, replay, challenge, message, coord_color, submit_move, confirm_resign, keyboard_move, zen, move_event].hash
399
+ end
400
+
401
+ # Builds the object from hash
402
+ # @param [Hash] attributes Model attributes in the form of hash
403
+ # @return [Object] Returns the model itself
404
+ def self.build_from_hash(attributes)
405
+ return nil unless attributes.is_a?(Hash)
406
+ attributes = attributes.transform_keys(&:to_sym)
407
+ transformed_hash = {}
408
+ openapi_types.each_pair do |key, type|
409
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
410
+ transformed_hash["#{key}"] = nil
411
+ elsif type =~ /\AArray<(.*)>/i
412
+ # check to ensure the input is an array given that the attribute
413
+ # is documented as an array but the input is not
414
+ if attributes[attribute_map[key]].is_a?(Array)
415
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
416
+ end
417
+ elsif !attributes[attribute_map[key]].nil?
418
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
419
+ end
420
+ end
421
+ new(transformed_hash)
422
+ end
423
+
424
+ # Deserializes the data based on type
425
+ # @param string type Data type
426
+ # @param string value Value to be deserialized
427
+ # @return [Object] Deserialized data
428
+ def self._deserialize(type, value)
429
+ case type.to_sym
430
+ when :Time
431
+ Time.parse(value)
432
+ when :Date
433
+ Date.parse(value)
434
+ when :String
435
+ value.to_s
436
+ when :Integer
437
+ value.to_i
438
+ when :Float
439
+ value.to_f
440
+ when :Boolean
441
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
442
+ true
443
+ else
444
+ false
445
+ end
446
+ when :Object
447
+ # generic object (usually a Hash), return directly
448
+ value
449
+ when /\AArray<(?<inner_type>.+)>\z/
450
+ inner_type = Regexp.last_match[:inner_type]
451
+ value.map { |v| _deserialize(inner_type, v) }
452
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
453
+ k_type = Regexp.last_match[:k_type]
454
+ v_type = Regexp.last_match[:v_type]
455
+ {}.tap do |hash|
456
+ value.each do |k, v|
457
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
458
+ end
459
+ end
460
+ else # model
461
+ # models (e.g. Pet) or oneOf
462
+ klass = Lishogi.const_get(type)
463
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
464
+ end
465
+ end
466
+
467
+ # Returns the string representation of the object
468
+ # @return [String] String presentation of the object
469
+ def to_s
470
+ to_hash.to_s
471
+ end
472
+
473
+ # to_body is an alias to to_hash (backward compatibility)
474
+ # @return [Hash] Returns the object in the form of hash
475
+ def to_body
476
+ to_hash
477
+ end
478
+
479
+ # Returns the object in the form of hash
480
+ # @return [Hash] Returns the object in the form of hash
481
+ def to_hash
482
+ hash = {}
483
+ self.class.attribute_map.each_pair do |attr, param|
484
+ value = self.send(attr)
485
+ if value.nil?
486
+ is_nullable = self.class.openapi_nullable.include?(attr)
487
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
488
+ end
489
+
490
+ hash[param] = _to_hash(value)
491
+ end
492
+ hash
493
+ end
494
+
495
+ # Outputs non-array value in the form of hash
496
+ # For object, use to_hash. Otherwise, just return the value
497
+ # @param [Object] value Any valid value
498
+ # @return [Hash] Returns the value in the form of hash
499
+ def _to_hash(value)
500
+ if value.is_a?(Array)
501
+ value.compact.map { |v| _to_hash(v) }
502
+ elsif value.is_a?(Hash)
503
+ {}.tap do |hash|
504
+ value.each { |k, v| hash[k] = _to_hash(v) }
505
+ end
506
+ elsif value.respond_to? :to_hash
507
+ value.to_hash
508
+ else
509
+ value
510
+ end
511
+ end
512
+
513
+ end
514
+
515
+ end