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,255 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+ require "time"
5
+
6
+ module Kuapir
7
+ class VideoResponseItems
8
+ attr_accessor :url, :name, :site
9
+
10
+ class EnumAttributeValidator
11
+ attr_reader :datatype, :allowable_values
12
+
13
+ def initialize(datatype, allowable_values)
14
+ @allowable_values = allowable_values.map do |value|
15
+ case datatype.to_s
16
+ when /Integer/i
17
+ value.to_i
18
+ when /Float/i
19
+ value.to_f
20
+ else
21
+ value
22
+ end
23
+ end
24
+ end
25
+
26
+ def valid?(value)
27
+ !value || allowable_values.include?(value)
28
+ end
29
+ end
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ 'url': :url,
35
+ 'name': :name,
36
+ 'site': :site
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ 'url': :String,
49
+ 'name': :String,
50
+ 'site': :String
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ unless attributes.is_a?(Hash)
63
+ raise ArgumentError,
64
+ "The input argument (attributes) must be a hash in `Kuapir::VideoResponseItems` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) do |(k, v), h|
69
+ unless self.class.attribute_map.key?(k.to_sym)
70
+ raise ArgumentError,
71
+ "`#{k}` is not a valid attribute in `Kuapir::VideoResponseItems`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+
74
+ h[k.to_sym] = v
75
+ end
76
+
77
+ self.url = attributes[:url] if attributes.key?(:url)
78
+
79
+ self.name = attributes[:name] if attributes.key?(:name)
80
+
81
+ self.site = attributes[:site] if attributes.key?(:site)
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ []
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ site_validator = EnumAttributeValidator.new("String", %w[YOUTUBE KINOPOISK_WIDGET UNKNOWN])
94
+ return false unless site_validator.valid?(@site)
95
+
96
+ true
97
+ end
98
+
99
+ # Custom attribute writer method checking allowed values (enum).
100
+ # @param [Object] site Object to be assigned
101
+ def site=(site)
102
+ validator = EnumAttributeValidator.new("String", %w[YOUTUBE KINOPOISK_WIDGET UNKNOWN])
103
+ unless validator.valid?(site)
104
+ raise ArgumentError,
105
+ "invalid value for \"site\", must be one of #{validator.allowable_values}."
106
+ end
107
+
108
+ @site = site
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(other)
114
+ return true if equal?(other)
115
+
116
+ self.class == other.class &&
117
+ url == other.url &&
118
+ name == other.name &&
119
+ site == other.site
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(other)
125
+ self == other
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [url, name, site].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ new.build_from_hash(attributes)
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+
147
+ self.class.openapi_types.each_pair do |key, type|
148
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
149
+ send("#{key}=", nil)
150
+ elsif type =~ /\AArray<(.*)>/i
151
+ # check to ensure the input is an array given that the attribute
152
+ # is documented as an array but the input is not
153
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
154
+ send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
155
+ _deserialize(Regexp.last_match(1), v)
156
+ end)
157
+ end
158
+ elsif !attributes[self.class.attribute_map[key]].nil?
159
+ send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
160
+ end
161
+ end
162
+
163
+ self
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def _deserialize(type, value)
171
+ case type.to_sym
172
+ when :Time
173
+ Time.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :Boolean
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ # models (e.g. Pet) or oneOf
204
+ klass = Kuapir.const_get(type)
205
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = send(attr)
227
+ if value.nil?
228
+ is_nullable = self.class.openapi_nullable.include?(attr)
229
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
230
+ end
231
+
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+ end
255
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kuapir
4
+ VERSION = "0.1.2"
5
+ end
data/lib/kuapir.rb ADDED
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ # #Kinopoisk Unofficial API
4
+ #
5
+ #
6
+ #
7
+ # The version of the OpenAPI document: 2.0.1
8
+ # Contact: support@kinopoiskapiunofficial.tech
9
+ # Generated by: https://openapi-generator.tech
10
+ # OpenAPI Generator version: 5.3.1
11
+ # Common files
12
+ require "kuapir/api_client"
13
+ require "kuapir/api_error"
14
+ require "kuapir/version"
15
+ require "kuapir/configuration"
16
+
17
+ # Models
18
+ require "kuapir/models/box_office"
19
+ require "kuapir/models/box_office_response"
20
+ require "kuapir/models/company"
21
+ require "kuapir/models/country"
22
+ require "kuapir/models/digital_release_item"
23
+ require "kuapir/models/digital_release_response"
24
+ require "kuapir/models/distribution"
25
+ require "kuapir/models/distribution_response"
26
+ require "kuapir/models/episode"
27
+ require "kuapir/models/fact"
28
+ require "kuapir/models/fact_response"
29
+ require "kuapir/models/film"
30
+ require "kuapir/models/film_search_by_filters_response"
31
+ require "kuapir/models/film_search_by_filters_response_items"
32
+ require "kuapir/models/film_search_response"
33
+ require "kuapir/models/film_search_response_films"
34
+ require "kuapir/models/film_sequels_and_prequels_response"
35
+ require "kuapir/models/film_top_response"
36
+ require "kuapir/models/film_top_response_films"
37
+ require "kuapir/models/filters_response"
38
+ require "kuapir/models/filters_response_countries"
39
+ require "kuapir/models/filters_response_genres"
40
+ require "kuapir/models/genre"
41
+ require "kuapir/models/image_response"
42
+ require "kuapir/models/image_response_items"
43
+ require "kuapir/models/person_by_name_response"
44
+ require "kuapir/models/person_by_name_response_items"
45
+ require "kuapir/models/person_response"
46
+ require "kuapir/models/person_response_films"
47
+ require "kuapir/models/person_response_spouses"
48
+ require "kuapir/models/premiere_response"
49
+ require "kuapir/models/premiere_response_item"
50
+ require "kuapir/models/related_film_response"
51
+ require "kuapir/models/related_film_response_items"
52
+ require "kuapir/models/review_details_response"
53
+ require "kuapir/models/reviews_response"
54
+ require "kuapir/models/reviews_response_reviews"
55
+ require "kuapir/models/season"
56
+ require "kuapir/models/season_response"
57
+ require "kuapir/models/staff_response"
58
+ require "kuapir/models/video_response"
59
+ require "kuapir/models/video_response_items"
60
+
61
+ # APIs
62
+ require "kuapir/api/films_api"
63
+ require "kuapir/api/persons_api"
64
+ require "kuapir/api/reviews_api"
65
+ require "kuapir/api/staff_api"
66
+
67
+ module Kuapir
68
+ class << self
69
+ # Customize default settings for the SDK using block.
70
+ # Kuapir.configure do |config|
71
+ # config.username = "xxx"
72
+ # config.password = "xxx"
73
+ # end
74
+ # If no block given, return the default Configuration object.
75
+ def configure
76
+ if block_given?
77
+ yield(Configuration.default)
78
+ else
79
+ Configuration.default
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 13.0.1'
7
+ gem 'pry-byebug'
8
+ gem 'rubocop', '~> 0.66.0'
9
+ end
@@ -0,0 +1,148 @@
1
+ # {{gemName}}
2
+
3
+ {{moduleName}} - the Ruby gem for the {{appName}}
4
+
5
+ {{#appDescriptionWithNewLines}}
6
+ {{{.}}}
7
+ {{/appDescriptionWithNewLines}}
8
+
9
+ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
10
+
11
+ - API version: {{appVersion}}
12
+ - Package version: {{gemVersion}}
13
+ {{^hideGenerationTimestamp}}
14
+ - Build date: {{generatedDate}}
15
+ {{/hideGenerationTimestamp}}
16
+ - Build package: {{generatorClass}}
17
+ {{#infoUrl}}
18
+ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
19
+ {{/infoUrl}}
20
+
21
+ ## Installation
22
+
23
+ ### Build a gem
24
+
25
+ To build the Ruby code into a gem:
26
+
27
+ ```shell
28
+ gem build {{{gemName}}}.gemspec
29
+ ```
30
+
31
+ Then either install the gem locally:
32
+
33
+ ```shell
34
+ gem install ./{{{gemName}}}-{{{gemVersion}}}.gem
35
+ ```
36
+
37
+ (for development, run `gem install --dev ./{{{gemName}}}-{{{gemVersion}}}.gem` to install the development dependencies)
38
+
39
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
40
+
41
+ Finally add this to the Gemfile:
42
+
43
+ gem '{{{gemName}}}', '~> {{{gemVersion}}}'
44
+
45
+ ### Install from Git
46
+
47
+ If the Ruby gem is hosted at a git repository: https://{{gitHost}}/{{gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}, then add the following in the Gemfile:
48
+
49
+ gem '{{{gemName}}}', :git => 'https://{{gitHost}}/{{gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}.git'
50
+
51
+ ### Include the Ruby code directly
52
+
53
+ Include the Ruby code directly using `-I` as follows:
54
+
55
+ ```shell
56
+ ruby -Ilib script.rb
57
+ ```
58
+
59
+ ## Getting Started
60
+
61
+ Please follow the [installation](#installation) procedure and then run the following code:
62
+
63
+ ```ruby
64
+ # Load the gem
65
+ require '{{{gemName}}}'
66
+ {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}
67
+ # Setup authorization
68
+ {{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
69
+ # Configure HTTP basic authorization: {{{name}}}
70
+ config.username = 'YOUR_USERNAME'
71
+ config.password = 'YOUR_PASSWORD'{{/isBasicBasic}}{{#isBasicBearer}}
72
+ # Configure Bearer authorization{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}: {{{name}}}
73
+ config.access_token = 'YOUR_BEARER_TOKEN'{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
74
+ # Configure API key authorization: {{{name}}}
75
+ config.api_key['{{{name}}}'] = 'YOUR API KEY'
76
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
77
+ # config.api_key_prefix['{{{name}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}}
78
+ # Configure OAuth2 access token for authorization: {{{name}}}
79
+ config.access_token = 'YOUR ACCESS TOKEN'{{/isOAuth}}
80
+ {{/authMethods}}end
81
+ {{/hasAuthMethods}}
82
+
83
+ api_instance = {{{moduleName}}}::{{{classname}}}.new
84
+ {{#requiredParams}}
85
+ {{{paramName}}} = {{{vendorExtensions.x-ruby-example}}} # {{{dataType}}} | {{{description}}}
86
+ {{/requiredParams}}
87
+ {{#optionalParams}}
88
+ {{#-first}}
89
+ opts = {
90
+ {{/-first}}
91
+ {{{paramName}}}: {{{vendorExtensions.x-ruby-example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}}
92
+ {{#-last}}
93
+ }
94
+ {{/-last}}
95
+ {{/optionalParams}}
96
+
97
+ begin
98
+ {{#summary}} #{{{.}}}
99
+ {{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}{{#returnType}}
100
+ p result{{/returnType}}
101
+ rescue {{{moduleName}}}::ApiError => e
102
+ puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}"
103
+ end
104
+ {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
105
+ ```
106
+
107
+ ## Documentation for API Endpoints
108
+
109
+ All URIs are relative to *{{basePath}}*
110
+
111
+ Class | Method | HTTP request | Description
112
+ ------------ | ------------- | ------------- | -------------
113
+ {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{{summary}}}
114
+ {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
115
+
116
+ ## Documentation for Models
117
+
118
+ {{#models}}{{#model}} - [{{moduleName}}::{{classname}}]({{modelDocPath}}{{classname}}.md)
119
+ {{/model}}{{/models}}
120
+
121
+ ## Documentation for Authorization
122
+
123
+ {{^authMethods}} All endpoints do not require authorization.
124
+ {{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
125
+ {{#authMethods}}### {{name}}
126
+
127
+ {{#isApiKey}}
128
+
129
+ - **Type**: API key
130
+ - **API key parameter name**: {{keyParamName}}
131
+ - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
132
+ {{/isApiKey}}
133
+ {{#isBasic}}
134
+ {{#isBasicBasic}}- **Type**: HTTP basic authentication
135
+ {{/isBasicBasic}}{{#isBasicBearer}}- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
136
+ {{/isBasicBearer}}
137
+ {{/isBasic}}
138
+ {{#isOAuth}}
139
+
140
+ - **Type**: OAuth
141
+ - **Flow**: {{flow}}
142
+ - **Authorization URL**: {{authorizationUrl}}
143
+ - **Scopes**: {{^scopes}}N/A{{/scopes}}
144
+ {{#scopes}} - {{scope}}: {{description}}
145
+ {{/scopes}}
146
+ {{/isOAuth}}
147
+
148
+ {{/authMethods}}
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
8
+ rescue LoadError
9
+ # no rspec available
10
+ end