kuapir 0.1.2

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 (190) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +13 -0
  3. data/Gemfile.lock +77 -0
  4. data/LICENSE +21 -0
  5. data/README.md +170 -0
  6. data/Rakefile +12 -0
  7. data/docs/BoxOffice.md +26 -0
  8. data/docs/BoxOfficeResponse.md +20 -0
  9. data/docs/Company.md +18 -0
  10. data/docs/Country.md +18 -0
  11. data/docs/DigitalReleaseItem.md +44 -0
  12. data/docs/DigitalReleaseResponse.md +22 -0
  13. data/docs/Distribution.md +28 -0
  14. data/docs/DistributionResponse.md +20 -0
  15. data/docs/Episode.md +28 -0
  16. data/docs/Fact.md +22 -0
  17. data/docs/FactResponse.md +20 -0
  18. data/docs/Film.md +100 -0
  19. data/docs/FilmSearchByFiltersResponse.md +22 -0
  20. data/docs/FilmSearchByFiltersResponseItems.md +42 -0
  21. data/docs/FilmSearchResponse.md +24 -0
  22. data/docs/FilmSearchResponseFilms.md +42 -0
  23. data/docs/FilmSequelsAndPrequelsResponse.md +30 -0
  24. data/docs/FilmTopResponse.md +20 -0
  25. data/docs/FilmTopResponseFilms.md +38 -0
  26. data/docs/FilmsApi.md +1126 -0
  27. data/docs/FiltersResponse.md +20 -0
  28. data/docs/FiltersResponseCountries.md +20 -0
  29. data/docs/FiltersResponseGenres.md +20 -0
  30. data/docs/Genre.md +18 -0
  31. data/docs/ImageResponse.md +22 -0
  32. data/docs/ImageResponseItems.md +20 -0
  33. data/docs/PersonByNameResponse.md +20 -0
  34. data/docs/PersonByNameResponseItems.md +28 -0
  35. data/docs/PersonResponse.md +50 -0
  36. data/docs/PersonResponseFilms.md +30 -0
  37. data/docs/PersonResponseSpouses.md +32 -0
  38. data/docs/PersonsApi.md +83 -0
  39. data/docs/PremiereResponse.md +20 -0
  40. data/docs/PremiereResponseItem.md +36 -0
  41. data/docs/RelatedFilmResponse.md +20 -0
  42. data/docs/RelatedFilmResponseItems.md +30 -0
  43. data/docs/ReviewDetailsResponse.md +32 -0
  44. data/docs/ReviewsApi.md +155 -0
  45. data/docs/ReviewsResponse.md +34 -0
  46. data/docs/ReviewsResponseReviews.md +32 -0
  47. data/docs/Season.md +20 -0
  48. data/docs/SeasonResponse.md +20 -0
  49. data/docs/StaffApi.md +147 -0
  50. data/docs/StaffResponse.md +30 -0
  51. data/docs/VideoResponse.md +20 -0
  52. data/docs/VideoResponseItems.md +22 -0
  53. data/kinopoiskapiunofficial-openapi.json +2918 -0
  54. data/kuapir.gemspec +42 -0
  55. data/lib/kuapir/api/films_api.rb +1193 -0
  56. data/lib/kuapir/api/persons_api.rb +89 -0
  57. data/lib/kuapir/api/reviews_api.rb +165 -0
  58. data/lib/kuapir/api/staff_api.rb +145 -0
  59. data/lib/kuapir/api_client.rb +390 -0
  60. data/lib/kuapir/api_error.rb +57 -0
  61. data/lib/kuapir/configuration.rb +287 -0
  62. data/lib/kuapir/models/box_office.rb +246 -0
  63. data/lib/kuapir/models/box_office_response.rb +224 -0
  64. data/lib/kuapir/models/company.rb +214 -0
  65. data/lib/kuapir/models/country.rb +214 -0
  66. data/lib/kuapir/models/digital_release_item.rb +334 -0
  67. data/lib/kuapir/models/digital_release_response.rb +232 -0
  68. data/lib/kuapir/models/distribution.rb +300 -0
  69. data/lib/kuapir/models/distribution_response.rb +224 -0
  70. data/lib/kuapir/models/episode.rb +249 -0
  71. data/lib/kuapir/models/fact.rb +266 -0
  72. data/lib/kuapir/models/fact_response.rb +224 -0
  73. data/lib/kuapir/models/film.rb +551 -0
  74. data/lib/kuapir/models/film_search_by_filters_response.rb +232 -0
  75. data/lib/kuapir/models/film_search_by_filters_response_items.rb +319 -0
  76. data/lib/kuapir/models/film_search_response.rb +244 -0
  77. data/lib/kuapir/models/film_search_response_films.rb +311 -0
  78. data/lib/kuapir/models/film_sequels_and_prequels_response.rb +300 -0
  79. data/lib/kuapir/models/film_top_response.rb +224 -0
  80. data/lib/kuapir/models/film_top_response_films.rb +272 -0
  81. data/lib/kuapir/models/filters_response.rb +226 -0
  82. data/lib/kuapir/models/filters_response_countries.rb +214 -0
  83. data/lib/kuapir/models/filters_response_genres.rb +214 -0
  84. data/lib/kuapir/models/genre.rb +214 -0
  85. data/lib/kuapir/models/image_response.rb +238 -0
  86. data/lib/kuapir/models/image_response_items.rb +214 -0
  87. data/lib/kuapir/models/person_by_name_response.rb +224 -0
  88. data/lib/kuapir/models/person_by_name_response_items.rb +274 -0
  89. data/lib/kuapir/models/person_response.rb +363 -0
  90. data/lib/kuapir/models/person_response_films.rb +284 -0
  91. data/lib/kuapir/models/person_response_spouses.rb +283 -0
  92. data/lib/kuapir/models/premiere_response.rb +224 -0
  93. data/lib/kuapir/models/premiere_response_item.rb +289 -0
  94. data/lib/kuapir/models/related_film_response.rb +224 -0
  95. data/lib/kuapir/models/related_film_response_items.rb +279 -0
  96. data/lib/kuapir/models/review_details_response.rb +314 -0
  97. data/lib/kuapir/models/reviews_response.rb +294 -0
  98. data/lib/kuapir/models/reviews_response_reviews.rb +282 -0
  99. data/lib/kuapir/models/season.rb +224 -0
  100. data/lib/kuapir/models/season_response.rb +224 -0
  101. data/lib/kuapir/models/staff_response.rb +301 -0
  102. data/lib/kuapir/models/video_response.rb +224 -0
  103. data/lib/kuapir/models/video_response_items.rb +255 -0
  104. data/lib/kuapir/version.rb +5 -0
  105. data/lib/kuapir.rb +83 -0
  106. data/openapi-generator-templates/Gemfile.mustache +9 -0
  107. data/openapi-generator-templates/README.mustache +148 -0
  108. data/openapi-generator-templates/Rakefile.mustache +10 -0
  109. data/openapi-generator-templates/api.mustache +205 -0
  110. data/openapi-generator-templates/api_client.mustache +260 -0
  111. data/openapi-generator-templates/api_client_faraday_partial.mustache +136 -0
  112. data/openapi-generator-templates/api_client_spec.mustache +216 -0
  113. data/openapi-generator-templates/api_client_typhoeus_partial.mustache +153 -0
  114. data/openapi-generator-templates/api_doc.mustache +118 -0
  115. data/openapi-generator-templates/api_error.mustache +45 -0
  116. data/openapi-generator-templates/api_info.mustache +12 -0
  117. data/openapi-generator-templates/api_test.mustache +43 -0
  118. data/openapi-generator-templates/base_object.mustache +120 -0
  119. data/openapi-generator-templates/configuration.mustache +381 -0
  120. data/openapi-generator-templates/configuration_spec.mustache +30 -0
  121. data/openapi-generator-templates/configuration_tls_faraday_partial.mustache +29 -0
  122. data/openapi-generator-templates/configuration_tls_typhoeus_partial.mustache +34 -0
  123. data/openapi-generator-templates/gem.mustache +50 -0
  124. data/openapi-generator-templates/gemspec.mustache +31 -0
  125. data/openapi-generator-templates/git_push.sh.mustache +57 -0
  126. data/openapi-generator-templates/gitignore.mustache +39 -0
  127. data/openapi-generator-templates/model.mustache +22 -0
  128. data/openapi-generator-templates/model_doc.mustache +12 -0
  129. data/openapi-generator-templates/model_test.mustache +73 -0
  130. data/openapi-generator-templates/partial_model_enum_class.mustache +20 -0
  131. data/openapi-generator-templates/partial_model_generic.mustache +371 -0
  132. data/openapi-generator-templates/partial_model_generic_doc.mustache +28 -0
  133. data/openapi-generator-templates/partial_oneof_module.mustache +137 -0
  134. data/openapi-generator-templates/partial_oneof_module_doc.mustache +92 -0
  135. data/openapi-generator-templates/rspec.mustache +2 -0
  136. data/openapi-generator-templates/rubocop.mustache +148 -0
  137. data/openapi-generator-templates/spec_helper.mustache +99 -0
  138. data/openapi-generator-templates/travis.mustache +14 -0
  139. data/openapi-generator-templates/version.mustache +3 -0
  140. data/openapitools.json +21 -0
  141. data/spec/api/films_api_spec.rb +227 -0
  142. data/spec/api/persons_api_spec.rb +45 -0
  143. data/spec/api/reviews_api_spec.rb +57 -0
  144. data/spec/api/staff_api_spec.rb +54 -0
  145. data/spec/api_client_spec.rb +229 -0
  146. data/spec/configuration_spec.rb +28 -0
  147. data/spec/models/box_office_response_spec.rb +37 -0
  148. data/spec/models/box_office_spec.rb +55 -0
  149. data/spec/models/company_spec.rb +31 -0
  150. data/spec/models/country_spec.rb +31 -0
  151. data/spec/models/digital_release_item_spec.rb +109 -0
  152. data/spec/models/digital_release_response_spec.rb +43 -0
  153. data/spec/models/distribution_response_spec.rb +37 -0
  154. data/spec/models/distribution_spec.rb +69 -0
  155. data/spec/models/episode_spec.rb +61 -0
  156. data/spec/models/fact_response_spec.rb +37 -0
  157. data/spec/models/fact_spec.rb +47 -0
  158. data/spec/models/film_search_by_filters_response_items_spec.rb +107 -0
  159. data/spec/models/film_search_by_filters_response_spec.rb +43 -0
  160. data/spec/models/film_search_response_films_spec.rb +107 -0
  161. data/spec/models/film_search_response_spec.rb +49 -0
  162. data/spec/models/film_sequels_and_prequels_response_spec.rb +71 -0
  163. data/spec/models/film_spec.rb +285 -0
  164. data/spec/models/film_top_response_films_spec.rb +91 -0
  165. data/spec/models/film_top_response_spec.rb +37 -0
  166. data/spec/models/filters_response_countries_spec.rb +37 -0
  167. data/spec/models/filters_response_genres_spec.rb +37 -0
  168. data/spec/models/filters_response_spec.rb +37 -0
  169. data/spec/models/genre_spec.rb +31 -0
  170. data/spec/models/image_response_items_spec.rb +37 -0
  171. data/spec/models/image_response_spec.rb +43 -0
  172. data/spec/models/person_by_name_response_items_spec.rb +65 -0
  173. data/spec/models/person_by_name_response_spec.rb +37 -0
  174. data/spec/models/person_response_films_spec.rb +71 -0
  175. data/spec/models/person_response_spec.rb +131 -0
  176. data/spec/models/person_response_spouses_spec.rb +77 -0
  177. data/spec/models/premiere_response_item_spec.rb +85 -0
  178. data/spec/models/premiere_response_spec.rb +37 -0
  179. data/spec/models/related_film_response_items_spec.rb +71 -0
  180. data/spec/models/related_film_response_spec.rb +37 -0
  181. data/spec/models/review_details_response_spec.rb +77 -0
  182. data/spec/models/reviews_response_reviews_spec.rb +77 -0
  183. data/spec/models/reviews_response_spec.rb +79 -0
  184. data/spec/models/season_response_spec.rb +37 -0
  185. data/spec/models/season_spec.rb +37 -0
  186. data/spec/models/staff_response_spec.rb +71 -0
  187. data/spec/models/video_response_items_spec.rb +47 -0
  188. data/spec/models/video_response_spec.rb +37 -0
  189. data/spec/spec_helper.rb +107 -0
  190. metadata +326 -0
@@ -0,0 +1,551 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+ require "time"
5
+
6
+ module Kuapir
7
+ class Film
8
+ attr_accessor :kinopoisk_id, :imdb_id, :name_ru, :name_en, :name_original, :poster_url, :poster_url_preview,
9
+ :reviews_count, :rating_good_review, :rating_good_review_vote_count, :rating_kinopoisk, :rating_kinopoisk_vote_count, :rating_imdb, :rating_imdb_vote_count, :rating_film_critics, :rating_film_critics_vote_count, :rating_await, :rating_await_count, :rating_rf_critics, :rating_rf_critics_vote_count, :web_url, :year, :film_length, :slogan, :description, :short_description, :editor_annotation, :is_tickets_available, :production_status, :type, :rating_mpaa, :rating_age_limits, :has_imax, :has3_d, :last_sync, :countries, :genres, :start_year, :end_year, :serial, :short_film, :completed
10
+
11
+ class EnumAttributeValidator
12
+ attr_reader :datatype, :allowable_values
13
+
14
+ def initialize(datatype, allowable_values)
15
+ @allowable_values = allowable_values.map do |value|
16
+ case datatype.to_s
17
+ when /Integer/i
18
+ value.to_i
19
+ when /Float/i
20
+ value.to_f
21
+ else
22
+ value
23
+ end
24
+ end
25
+ end
26
+
27
+ def valid?(value)
28
+ !value || allowable_values.include?(value)
29
+ end
30
+ end
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ 'kinopoisk_id': :kinopoiskId,
36
+ 'imdb_id': :imdbId,
37
+ 'name_ru': :nameRu,
38
+ 'name_en': :nameEn,
39
+ 'name_original': :nameOriginal,
40
+ 'poster_url': :posterUrl,
41
+ 'poster_url_preview': :posterUrlPreview,
42
+ 'reviews_count': :reviewsCount,
43
+ 'rating_good_review': :ratingGoodReview,
44
+ 'rating_good_review_vote_count': :ratingGoodReviewVoteCount,
45
+ 'rating_kinopoisk': :ratingKinopoisk,
46
+ 'rating_kinopoisk_vote_count': :ratingKinopoiskVoteCount,
47
+ 'rating_imdb': :ratingImdb,
48
+ 'rating_imdb_vote_count': :ratingImdbVoteCount,
49
+ 'rating_film_critics': :ratingFilmCritics,
50
+ 'rating_film_critics_vote_count': :ratingFilmCriticsVoteCount,
51
+ 'rating_await': :ratingAwait,
52
+ 'rating_await_count': :ratingAwaitCount,
53
+ 'rating_rf_critics': :ratingRfCritics,
54
+ 'rating_rf_critics_vote_count': :ratingRfCriticsVoteCount,
55
+ 'web_url': :webUrl,
56
+ 'year': :year,
57
+ 'film_length': :filmLength,
58
+ 'slogan': :slogan,
59
+ 'description': :description,
60
+ 'short_description': :shortDescription,
61
+ 'editor_annotation': :editorAnnotation,
62
+ 'is_tickets_available': :isTicketsAvailable,
63
+ 'production_status': :productionStatus,
64
+ 'type': :type,
65
+ 'rating_mpaa': :ratingMpaa,
66
+ 'rating_age_limits': :ratingAgeLimits,
67
+ 'has_imax': :hasImax,
68
+ 'has3_d': :has3D,
69
+ 'last_sync': :lastSync,
70
+ 'countries': :countries,
71
+ 'genres': :genres,
72
+ 'start_year': :startYear,
73
+ 'end_year': :endYear,
74
+ 'serial': :serial,
75
+ 'short_film': :shortFilm,
76
+ 'completed': :completed
77
+ }
78
+ end
79
+
80
+ # Returns all the JSON keys this model knows about
81
+ def self.acceptable_attributes
82
+ attribute_map.values
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.openapi_types
87
+ {
88
+ 'kinopoisk_id': :Integer,
89
+ 'imdb_id': :String,
90
+ 'name_ru': :String,
91
+ 'name_en': :String,
92
+ 'name_original': :String,
93
+ 'poster_url': :String,
94
+ 'poster_url_preview': :String,
95
+ 'reviews_count': :Integer,
96
+ 'rating_good_review': :Float,
97
+ 'rating_good_review_vote_count': :Integer,
98
+ 'rating_kinopoisk': :Float,
99
+ 'rating_kinopoisk_vote_count': :Integer,
100
+ 'rating_imdb': :Float,
101
+ 'rating_imdb_vote_count': :Integer,
102
+ 'rating_film_critics': :Float,
103
+ 'rating_film_critics_vote_count': :Integer,
104
+ 'rating_await': :Float,
105
+ 'rating_await_count': :Integer,
106
+ 'rating_rf_critics': :Float,
107
+ 'rating_rf_critics_vote_count': :Integer,
108
+ 'web_url': :String,
109
+ 'year': :Integer,
110
+ 'film_length': :Integer,
111
+ 'slogan': :String,
112
+ 'description': :String,
113
+ 'short_description': :String,
114
+ 'editor_annotation': :String,
115
+ 'is_tickets_available': :Boolean,
116
+ 'production_status': :String,
117
+ 'type': :String,
118
+ 'rating_mpaa': :String,
119
+ 'rating_age_limits': :String,
120
+ 'has_imax': :Boolean,
121
+ 'has3_d': :Boolean,
122
+ 'last_sync': :String,
123
+ 'countries': :'Array<Country>',
124
+ 'genres': :'Array<Genre>',
125
+ 'start_year': :Integer,
126
+ 'end_year': :Integer,
127
+ 'serial': :Boolean,
128
+ 'short_film': :Boolean,
129
+ 'completed': :Boolean
130
+ }
131
+ end
132
+
133
+ # List of attributes with nullable: true
134
+ def self.openapi_nullable
135
+ Set.new(%i[
136
+ imdb_id
137
+ name_ru
138
+ name_en
139
+ name_original
140
+ rating_good_review
141
+ rating_good_review_vote_count
142
+ rating_kinopoisk
143
+ rating_kinopoisk_vote_count
144
+ rating_imdb
145
+ rating_imdb_vote_count
146
+ rating_film_critics
147
+ rating_film_critics_vote_count
148
+ rating_await
149
+ rating_await_count
150
+ rating_rf_critics
151
+ rating_rf_critics_vote_count
152
+ year
153
+ film_length
154
+ slogan
155
+ description
156
+ short_description
157
+ editor_annotation
158
+ production_status
159
+ rating_mpaa
160
+ rating_age_limits
161
+ has_imax
162
+ has3_d
163
+ start_year
164
+ end_year
165
+ serial
166
+ short_film
167
+ completed
168
+ ])
169
+ end
170
+
171
+ # Initializes the object
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ def initialize(attributes = {})
174
+ unless attributes.is_a?(Hash)
175
+ raise ArgumentError,
176
+ "The input argument (attributes) must be a hash in `Kuapir::Film` initialize method"
177
+ end
178
+
179
+ # check to see if the attribute exists and convert string to symbol for hash key
180
+ attributes = attributes.each_with_object({}) do |(k, v), h|
181
+ unless self.class.attribute_map.key?(k.to_sym)
182
+ raise ArgumentError,
183
+ "`#{k}` is not a valid attribute in `Kuapir::Film`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
184
+ end
185
+
186
+ h[k.to_sym] = v
187
+ end
188
+
189
+ self.kinopoisk_id = attributes[:kinopoisk_id] if attributes.key?(:kinopoisk_id)
190
+
191
+ self.imdb_id = attributes[:imdb_id] if attributes.key?(:imdb_id)
192
+
193
+ self.name_ru = attributes[:name_ru] if attributes.key?(:name_ru)
194
+
195
+ self.name_en = attributes[:name_en] if attributes.key?(:name_en)
196
+
197
+ self.name_original = attributes[:name_original] if attributes.key?(:name_original)
198
+
199
+ self.poster_url = attributes[:poster_url] if attributes.key?(:poster_url)
200
+
201
+ self.poster_url_preview = attributes[:poster_url_preview] if attributes.key?(:poster_url_preview)
202
+
203
+ self.reviews_count = attributes[:reviews_count] if attributes.key?(:reviews_count)
204
+
205
+ self.rating_good_review = attributes[:rating_good_review] if attributes.key?(:rating_good_review)
206
+
207
+ if attributes.key?(:rating_good_review_vote_count)
208
+ self.rating_good_review_vote_count = attributes[:rating_good_review_vote_count]
209
+ end
210
+
211
+ self.rating_kinopoisk = attributes[:rating_kinopoisk] if attributes.key?(:rating_kinopoisk)
212
+
213
+ if attributes.key?(:rating_kinopoisk_vote_count)
214
+ self.rating_kinopoisk_vote_count = attributes[:rating_kinopoisk_vote_count]
215
+ end
216
+
217
+ self.rating_imdb = attributes[:rating_imdb] if attributes.key?(:rating_imdb)
218
+
219
+ self.rating_imdb_vote_count = attributes[:rating_imdb_vote_count] if attributes.key?(:rating_imdb_vote_count)
220
+
221
+ self.rating_film_critics = attributes[:rating_film_critics] if attributes.key?(:rating_film_critics)
222
+
223
+ if attributes.key?(:rating_film_critics_vote_count)
224
+ self.rating_film_critics_vote_count = attributes[:rating_film_critics_vote_count]
225
+ end
226
+
227
+ self.rating_await = attributes[:rating_await] if attributes.key?(:rating_await)
228
+
229
+ self.rating_await_count = attributes[:rating_await_count] if attributes.key?(:rating_await_count)
230
+
231
+ self.rating_rf_critics = attributes[:rating_rf_critics] if attributes.key?(:rating_rf_critics)
232
+
233
+ if attributes.key?(:rating_rf_critics_vote_count)
234
+ self.rating_rf_critics_vote_count = attributes[:rating_rf_critics_vote_count]
235
+ end
236
+
237
+ self.web_url = attributes[:web_url] if attributes.key?(:web_url)
238
+
239
+ self.year = attributes[:year] if attributes.key?(:year)
240
+
241
+ self.film_length = attributes[:film_length] if attributes.key?(:film_length)
242
+
243
+ self.slogan = attributes[:slogan] if attributes.key?(:slogan)
244
+
245
+ self.description = attributes[:description] if attributes.key?(:description)
246
+
247
+ self.short_description = attributes[:short_description] if attributes.key?(:short_description)
248
+
249
+ self.editor_annotation = attributes[:editor_annotation] if attributes.key?(:editor_annotation)
250
+
251
+ self.is_tickets_available = attributes[:is_tickets_available] if attributes.key?(:is_tickets_available)
252
+
253
+ self.production_status = attributes[:production_status] if attributes.key?(:production_status)
254
+
255
+ self.type = attributes[:type] if attributes.key?(:type)
256
+
257
+ self.rating_mpaa = attributes[:rating_mpaa] if attributes.key?(:rating_mpaa)
258
+
259
+ self.rating_age_limits = attributes[:rating_age_limits] if attributes.key?(:rating_age_limits)
260
+
261
+ self.has_imax = attributes[:has_imax] if attributes.key?(:has_imax)
262
+
263
+ self.has3_d = attributes[:has3_d] if attributes.key?(:has3_d)
264
+
265
+ self.last_sync = attributes[:last_sync] if attributes.key?(:last_sync)
266
+
267
+ if attributes.key?(:countries) && (value = attributes[:countries]).is_a?(Array)
268
+ self.countries = value
269
+ end
270
+
271
+ if attributes.key?(:genres) && (value = attributes[:genres]).is_a?(Array)
272
+ self.genres = value
273
+ end
274
+
275
+ self.start_year = attributes[:start_year] if attributes.key?(:start_year)
276
+
277
+ self.end_year = attributes[:end_year] if attributes.key?(:end_year)
278
+
279
+ self.serial = attributes[:serial] if attributes.key?(:serial)
280
+
281
+ self.short_film = attributes[:short_film] if attributes.key?(:short_film)
282
+
283
+ self.completed = attributes[:completed] if attributes.key?(:completed)
284
+ end
285
+
286
+ # Show invalid properties with the reasons. Usually used together with valid?
287
+ # @return Array for valid properties with the reasons
288
+ def list_invalid_properties
289
+ invalid_properties = []
290
+ invalid_properties.push('invalid value for "kinopoisk_id", kinopoisk_id cannot be nil.') if @kinopoisk_id.nil?
291
+
292
+ invalid_properties.push('invalid value for "poster_url", poster_url cannot be nil.') if @poster_url.nil?
293
+
294
+ if @poster_url_preview.nil?
295
+ invalid_properties.push('invalid value for "poster_url_preview", poster_url_preview cannot be nil.')
296
+ end
297
+
298
+ invalid_properties.push('invalid value for "reviews_count", reviews_count cannot be nil.') if @reviews_count.nil?
299
+
300
+ invalid_properties.push('invalid value for "web_url", web_url cannot be nil.') if @web_url.nil?
301
+
302
+ if @is_tickets_available.nil?
303
+ invalid_properties.push('invalid value for "is_tickets_available", is_tickets_available cannot be nil.')
304
+ end
305
+
306
+ invalid_properties.push('invalid value for "type", type cannot be nil.') if @type.nil?
307
+
308
+ invalid_properties.push('invalid value for "last_sync", last_sync cannot be nil.') if @last_sync.nil?
309
+
310
+ invalid_properties.push('invalid value for "countries", countries cannot be nil.') if @countries.nil?
311
+
312
+ invalid_properties.push('invalid value for "genres", genres cannot be nil.') if @genres.nil?
313
+
314
+ invalid_properties
315
+ end
316
+
317
+ # Check to see if the all the properties in the model are valid
318
+ # @return true if the model is valid
319
+ def valid?
320
+ return false if @kinopoisk_id.nil?
321
+ return false if @poster_url.nil?
322
+ return false if @poster_url_preview.nil?
323
+ return false if @reviews_count.nil?
324
+ return false if @web_url.nil?
325
+ return false if @is_tickets_available.nil?
326
+
327
+ production_status_validator = EnumAttributeValidator.new("String",
328
+ %w[FILMING PRE_PRODUCTION COMPLETED ANNOUNCED UNKNOWN
329
+ POST_PRODUCTION])
330
+ return false unless production_status_validator.valid?(@production_status)
331
+ return false if @type.nil?
332
+
333
+ type_validator = EnumAttributeValidator.new("String", %w[FILM VIDEO TV_SERIES MINI_SERIES TV_SHOW])
334
+ return false unless type_validator.valid?(@type)
335
+ return false if @last_sync.nil?
336
+ return false if @countries.nil?
337
+ return false if @genres.nil?
338
+
339
+ true
340
+ end
341
+
342
+ # Custom attribute writer method checking allowed values (enum).
343
+ # @param [Object] production_status Object to be assigned
344
+ def production_status=(production_status)
345
+ validator = EnumAttributeValidator.new("String",
346
+ %w[FILMING PRE_PRODUCTION COMPLETED ANNOUNCED UNKNOWN POST_PRODUCTION])
347
+ unless validator.valid?(production_status)
348
+ raise ArgumentError,
349
+ "invalid value for \"production_status\", must be one of #{validator.allowable_values}."
350
+ end
351
+
352
+ @production_status = production_status
353
+ end
354
+
355
+ # Custom attribute writer method checking allowed values (enum).
356
+ # @param [Object] type Object to be assigned
357
+ def type=(type)
358
+ validator = EnumAttributeValidator.new("String", %w[FILM VIDEO TV_SERIES MINI_SERIES TV_SHOW])
359
+ unless validator.valid?(type)
360
+ raise ArgumentError,
361
+ "invalid value for \"type\", must be one of #{validator.allowable_values}."
362
+ end
363
+
364
+ @type = type
365
+ end
366
+
367
+ # Checks equality by comparing each attribute.
368
+ # @param [Object] Object to be compared
369
+ def ==(other)
370
+ return true if equal?(other)
371
+
372
+ self.class == other.class &&
373
+ kinopoisk_id == other.kinopoisk_id &&
374
+ imdb_id == other.imdb_id &&
375
+ name_ru == other.name_ru &&
376
+ name_en == other.name_en &&
377
+ name_original == other.name_original &&
378
+ poster_url == other.poster_url &&
379
+ poster_url_preview == other.poster_url_preview &&
380
+ reviews_count == other.reviews_count &&
381
+ rating_good_review == other.rating_good_review &&
382
+ rating_good_review_vote_count == other.rating_good_review_vote_count &&
383
+ rating_kinopoisk == other.rating_kinopoisk &&
384
+ rating_kinopoisk_vote_count == other.rating_kinopoisk_vote_count &&
385
+ rating_imdb == other.rating_imdb &&
386
+ rating_imdb_vote_count == other.rating_imdb_vote_count &&
387
+ rating_film_critics == other.rating_film_critics &&
388
+ rating_film_critics_vote_count == other.rating_film_critics_vote_count &&
389
+ rating_await == other.rating_await &&
390
+ rating_await_count == other.rating_await_count &&
391
+ rating_rf_critics == other.rating_rf_critics &&
392
+ rating_rf_critics_vote_count == other.rating_rf_critics_vote_count &&
393
+ web_url == other.web_url &&
394
+ year == other.year &&
395
+ film_length == other.film_length &&
396
+ slogan == other.slogan &&
397
+ description == other.description &&
398
+ short_description == other.short_description &&
399
+ editor_annotation == other.editor_annotation &&
400
+ is_tickets_available == other.is_tickets_available &&
401
+ production_status == other.production_status &&
402
+ type == other.type &&
403
+ rating_mpaa == other.rating_mpaa &&
404
+ rating_age_limits == other.rating_age_limits &&
405
+ has_imax == other.has_imax &&
406
+ has3_d == other.has3_d &&
407
+ last_sync == other.last_sync &&
408
+ countries == other.countries &&
409
+ genres == other.genres &&
410
+ start_year == other.start_year &&
411
+ end_year == other.end_year &&
412
+ serial == other.serial &&
413
+ short_film == other.short_film &&
414
+ completed == other.completed
415
+ end
416
+
417
+ # @see the `==` method
418
+ # @param [Object] Object to be compared
419
+ def eql?(other)
420
+ self == other
421
+ end
422
+
423
+ # Calculates hash code according to all attributes.
424
+ # @return [Integer] Hash code
425
+ def hash
426
+ [kinopoisk_id, imdb_id, name_ru, name_en, name_original, poster_url, poster_url_preview, reviews_count,
427
+ rating_good_review, rating_good_review_vote_count, rating_kinopoisk, rating_kinopoisk_vote_count, rating_imdb, rating_imdb_vote_count, rating_film_critics, rating_film_critics_vote_count, rating_await, rating_await_count, rating_rf_critics, rating_rf_critics_vote_count, web_url, year, film_length, slogan, description, short_description, editor_annotation, is_tickets_available, production_status, type, rating_mpaa, rating_age_limits, has_imax, has3_d, last_sync, countries, genres, start_year, end_year, serial, short_film, completed].hash
428
+ end
429
+
430
+ # Builds the object from hash
431
+ # @param [Hash] attributes Model attributes in the form of hash
432
+ # @return [Object] Returns the model itself
433
+ def self.build_from_hash(attributes)
434
+ new.build_from_hash(attributes)
435
+ end
436
+
437
+ # Builds the object from hash
438
+ # @param [Hash] attributes Model attributes in the form of hash
439
+ # @return [Object] Returns the model itself
440
+ def build_from_hash(attributes)
441
+ return nil unless attributes.is_a?(Hash)
442
+
443
+ self.class.openapi_types.each_pair do |key, type|
444
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
445
+ send("#{key}=", nil)
446
+ elsif type =~ /\AArray<(.*)>/i
447
+ # check to ensure the input is an array given that the attribute
448
+ # is documented as an array but the input is not
449
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
450
+ send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
451
+ _deserialize(Regexp.last_match(1), v)
452
+ end)
453
+ end
454
+ elsif !attributes[self.class.attribute_map[key]].nil?
455
+ send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
456
+ end
457
+ end
458
+
459
+ self
460
+ end
461
+
462
+ # Deserializes the data based on type
463
+ # @param string type Data type
464
+ # @param string value Value to be deserialized
465
+ # @return [Object] Deserialized data
466
+ def _deserialize(type, value)
467
+ case type.to_sym
468
+ when :Time
469
+ Time.parse(value)
470
+ when :Date
471
+ Date.parse(value)
472
+ when :String
473
+ value.to_s
474
+ when :Integer
475
+ value.to_i
476
+ when :Float
477
+ value.to_f
478
+ when :Boolean
479
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
480
+ true
481
+ else
482
+ false
483
+ end
484
+ when :Object
485
+ # generic object (usually a Hash), return directly
486
+ value
487
+ when /\AArray<(?<inner_type>.+)>\z/
488
+ inner_type = Regexp.last_match[:inner_type]
489
+ value.map { |v| _deserialize(inner_type, v) }
490
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
491
+ k_type = Regexp.last_match[:k_type]
492
+ v_type = Regexp.last_match[:v_type]
493
+ {}.tap do |hash|
494
+ value.each do |k, v|
495
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
496
+ end
497
+ end
498
+ else # model
499
+ # models (e.g. Pet) or oneOf
500
+ klass = Kuapir.const_get(type)
501
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
502
+ end
503
+ end
504
+
505
+ # Returns the string representation of the object
506
+ # @return [String] String presentation of the object
507
+ def to_s
508
+ to_hash.to_s
509
+ end
510
+
511
+ # to_body is an alias to to_hash (backward compatibility)
512
+ # @return [Hash] Returns the object in the form of hash
513
+ def to_body
514
+ to_hash
515
+ end
516
+
517
+ # Returns the object in the form of hash
518
+ # @return [Hash] Returns the object in the form of hash
519
+ def to_hash
520
+ hash = {}
521
+ self.class.attribute_map.each_pair do |attr, param|
522
+ value = send(attr)
523
+ if value.nil?
524
+ is_nullable = self.class.openapi_nullable.include?(attr)
525
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
526
+ end
527
+
528
+ hash[param] = _to_hash(value)
529
+ end
530
+ hash
531
+ end
532
+
533
+ # Outputs non-array value in the form of hash
534
+ # For object, use to_hash. Otherwise, just return the value
535
+ # @param [Object] value Any valid value
536
+ # @return [Hash] Returns the value in the form of hash
537
+ def _to_hash(value)
538
+ if value.is_a?(Array)
539
+ value.compact.map { |v| _to_hash(v) }
540
+ elsif value.is_a?(Hash)
541
+ {}.tap do |hash|
542
+ value.each { |k, v| hash[k] = _to_hash(v) }
543
+ end
544
+ elsif value.respond_to? :to_hash
545
+ value.to_hash
546
+ else
547
+ value
548
+ end
549
+ end
550
+ end
551
+ end