GiphyClient 1.0.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 (157) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +69 -0
  4. data/GiphyClient.gemspec +44 -0
  5. data/README.md +152 -0
  6. data/Rakefile +7 -0
  7. data/config.json +18 -0
  8. data/docs/BaseChannelModel.md +36 -0
  9. data/docs/BaseChannelModelGifs.md +9 -0
  10. data/docs/Breadcrumb.md +10 -0
  11. data/docs/Category.md +11 -0
  12. data/docs/ChannelWithChildrenModel.md +37 -0
  13. data/docs/ChannelWithChildrenModelChildren.md +9 -0
  14. data/docs/DefaultApi.md +731 -0
  15. data/docs/Gif.md +36 -0
  16. data/docs/GifImages.md +27 -0
  17. data/docs/GifImagesDownsized.md +11 -0
  18. data/docs/GifImagesDownsizedLarge.md +11 -0
  19. data/docs/GifImagesDownsizedMedium.md +11 -0
  20. data/docs/GifImagesDownsizedSmall.md +11 -0
  21. data/docs/GifImagesDownsizedStill.md +10 -0
  22. data/docs/GifImagesFixedHeight.md +15 -0
  23. data/docs/GifImagesFixedHeightDownsampled.md +13 -0
  24. data/docs/GifImagesFixedHeightSmall.md +15 -0
  25. data/docs/GifImagesFixedHeightSmallStill.md +10 -0
  26. data/docs/GifImagesFixedHeightStill.md +10 -0
  27. data/docs/GifImagesFixedWidth.md +15 -0
  28. data/docs/GifImagesFixedWidthDownsampled.md +13 -0
  29. data/docs/GifImagesFixedWidthSmall.md +15 -0
  30. data/docs/GifImagesFixedWidthSmallStill.md +10 -0
  31. data/docs/GifImagesFixedWidthStill.md +10 -0
  32. data/docs/GifImagesLooping.md +8 -0
  33. data/docs/GifImagesOriginal.md +16 -0
  34. data/docs/GifImagesOriginalStill.md +10 -0
  35. data/docs/GifImagesPreview.md +11 -0
  36. data/docs/GifImagesPreviewGif.md +11 -0
  37. data/docs/InlineResponse200.md +10 -0
  38. data/docs/InlineResponse2001.md +9 -0
  39. data/docs/InlineResponse2002.md +9 -0
  40. data/docs/InlineResponse2003.md +10 -0
  41. data/docs/InlineResponse2004.md +10 -0
  42. data/docs/InlineResponse2005.md +10 -0
  43. data/docs/InlineResponse400.md +8 -0
  44. data/docs/LastChildModel.md +37 -0
  45. data/docs/LastChildModelChildren.md +9 -0
  46. data/docs/MetaContent.md +10 -0
  47. data/docs/MetaObject.md +8 -0
  48. data/docs/Pagination.md +10 -0
  49. data/docs/RandomGif.md +30 -0
  50. data/docs/ShallowTag.md +9 -0
  51. data/docs/Tag.md +9 -0
  52. data/docs/TrendingTag.md +10 -0
  53. data/docs/User.md +13 -0
  54. data/generate.sh +12 -0
  55. data/git_push.sh +55 -0
  56. data/lib/GiphyClient.rb +84 -0
  57. data/lib/GiphyClient/api/default_api.rb +952 -0
  58. data/lib/GiphyClient/api_client.rb +375 -0
  59. data/lib/GiphyClient/api_error.rb +37 -0
  60. data/lib/GiphyClient/configuration.rb +195 -0
  61. data/lib/GiphyClient/models/base_channel_model.rb +464 -0
  62. data/lib/GiphyClient/models/base_channel_model_gifs.rb +198 -0
  63. data/lib/GiphyClient/models/breadcrumb.rb +205 -0
  64. data/lib/GiphyClient/models/category.rb +220 -0
  65. data/lib/GiphyClient/models/channel_with_children_model.rb +473 -0
  66. data/lib/GiphyClient/models/channel_with_children_model_children.rb +198 -0
  67. data/lib/GiphyClient/models/gif.rb +473 -0
  68. data/lib/GiphyClient/models/gif_images.rb +358 -0
  69. data/lib/GiphyClient/models/gif_images_downsized.rb +218 -0
  70. data/lib/GiphyClient/models/gif_images_downsized_large.rb +218 -0
  71. data/lib/GiphyClient/models/gif_images_downsized_medium.rb +218 -0
  72. data/lib/GiphyClient/models/gif_images_downsized_small.rb +218 -0
  73. data/lib/GiphyClient/models/gif_images_downsized_still.rb +208 -0
  74. data/lib/GiphyClient/models/gif_images_fixed_height.rb +258 -0
  75. data/lib/GiphyClient/models/gif_images_fixed_height_downsampled.rb +238 -0
  76. data/lib/GiphyClient/models/gif_images_fixed_height_small.rb +258 -0
  77. data/lib/GiphyClient/models/gif_images_fixed_height_small_still.rb +208 -0
  78. data/lib/GiphyClient/models/gif_images_fixed_height_still.rb +208 -0
  79. data/lib/GiphyClient/models/gif_images_fixed_width.rb +258 -0
  80. data/lib/GiphyClient/models/gif_images_fixed_width_downsampled.rb +238 -0
  81. data/lib/GiphyClient/models/gif_images_fixed_width_small.rb +258 -0
  82. data/lib/GiphyClient/models/gif_images_fixed_width_small_still.rb +208 -0
  83. data/lib/GiphyClient/models/gif_images_fixed_width_still.rb +208 -0
  84. data/lib/GiphyClient/models/gif_images_looping.rb +188 -0
  85. data/lib/GiphyClient/models/gif_images_original.rb +268 -0
  86. data/lib/GiphyClient/models/gif_images_original_still.rb +208 -0
  87. data/lib/GiphyClient/models/gif_images_preview.rb +218 -0
  88. data/lib/GiphyClient/models/gif_images_preview_gif.rb +218 -0
  89. data/lib/GiphyClient/models/inline_response_200.rb +209 -0
  90. data/lib/GiphyClient/models/inline_response_200_1.rb +197 -0
  91. data/lib/GiphyClient/models/inline_response_200_2.rb +197 -0
  92. data/lib/GiphyClient/models/inline_response_200_3.rb +207 -0
  93. data/lib/GiphyClient/models/inline_response_200_4.rb +207 -0
  94. data/lib/GiphyClient/models/inline_response_200_5.rb +207 -0
  95. data/lib/GiphyClient/models/inline_response_400.rb +187 -0
  96. data/lib/GiphyClient/models/last_child_model.rb +473 -0
  97. data/lib/GiphyClient/models/last_child_model_children.rb +198 -0
  98. data/lib/GiphyClient/models/meta_content.rb +218 -0
  99. data/lib/GiphyClient/models/meta_object.rb +187 -0
  100. data/lib/GiphyClient/models/pagination.rb +208 -0
  101. data/lib/GiphyClient/models/random_gif.rb +401 -0
  102. data/lib/GiphyClient/models/shallow_tag.rb +198 -0
  103. data/lib/GiphyClient/models/tag.rb +198 -0
  104. data/lib/GiphyClient/models/trending_tag.rb +205 -0
  105. data/lib/GiphyClient/models/user.rb +238 -0
  106. data/lib/GiphyClient/version.rb +14 -0
  107. data/public.yaml +1638 -0
  108. data/spec/api/default_api_spec.rb +260 -0
  109. data/spec/api_client_spec.rb +225 -0
  110. data/spec/configuration_spec.rb +41 -0
  111. data/spec/models/base_channel_model_gifs_spec.rb +47 -0
  112. data/spec/models/base_channel_model_spec.rb +209 -0
  113. data/spec/models/breadcrumb_spec.rb +53 -0
  114. data/spec/models/category_spec.rb +59 -0
  115. data/spec/models/channel_with_children_model_children_spec.rb +47 -0
  116. data/spec/models/channel_with_children_model_spec.rb +215 -0
  117. data/spec/models/gif_images_downsized_large_spec.rb +59 -0
  118. data/spec/models/gif_images_downsized_medium_spec.rb +59 -0
  119. data/spec/models/gif_images_downsized_small_spec.rb +59 -0
  120. data/spec/models/gif_images_downsized_spec.rb +59 -0
  121. data/spec/models/gif_images_downsized_still_spec.rb +53 -0
  122. data/spec/models/gif_images_fixed_height_downsampled_spec.rb +71 -0
  123. data/spec/models/gif_images_fixed_height_small_spec.rb +83 -0
  124. data/spec/models/gif_images_fixed_height_small_still_spec.rb +53 -0
  125. data/spec/models/gif_images_fixed_height_spec.rb +83 -0
  126. data/spec/models/gif_images_fixed_height_still_spec.rb +53 -0
  127. data/spec/models/gif_images_fixed_width_downsampled_spec.rb +71 -0
  128. data/spec/models/gif_images_fixed_width_small_spec.rb +83 -0
  129. data/spec/models/gif_images_fixed_width_small_still_spec.rb +53 -0
  130. data/spec/models/gif_images_fixed_width_spec.rb +83 -0
  131. data/spec/models/gif_images_fixed_width_still_spec.rb +53 -0
  132. data/spec/models/gif_images_looping_spec.rb +41 -0
  133. data/spec/models/gif_images_original_spec.rb +89 -0
  134. data/spec/models/gif_images_original_still_spec.rb +53 -0
  135. data/spec/models/gif_images_preview_gif_spec.rb +59 -0
  136. data/spec/models/gif_images_preview_spec.rb +59 -0
  137. data/spec/models/gif_images_spec.rb +155 -0
  138. data/spec/models/gif_spec.rb +209 -0
  139. data/spec/models/inline_response_200_1_spec.rb +47 -0
  140. data/spec/models/inline_response_200_2_spec.rb +47 -0
  141. data/spec/models/inline_response_200_3_spec.rb +53 -0
  142. data/spec/models/inline_response_200_4_spec.rb +53 -0
  143. data/spec/models/inline_response_200_5_spec.rb +53 -0
  144. data/spec/models/inline_response_200_spec.rb +53 -0
  145. data/spec/models/inline_response_400_spec.rb +41 -0
  146. data/spec/models/last_child_model_children_spec.rb +47 -0
  147. data/spec/models/last_child_model_spec.rb +215 -0
  148. data/spec/models/meta_content_spec.rb +53 -0
  149. data/spec/models/meta_object_spec.rb +41 -0
  150. data/spec/models/pagination_spec.rb +53 -0
  151. data/spec/models/random_gif_spec.rb +173 -0
  152. data/spec/models/shallow_tag_spec.rb +47 -0
  153. data/spec/models/tag_spec.rb +47 -0
  154. data/spec/models/trending_tag_spec.rb +53 -0
  155. data/spec/models/user_spec.rb +71 -0
  156. data/spec/spec_helper.rb +110 -0
  157. metadata +428 -0
@@ -0,0 +1,473 @@
1
+ =begin
2
+ #giphy-api
3
+
4
+ #Giphy's public api.
5
+
6
+ OpenAPI spec version: 0.9.3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module GiphyClient
15
+
16
+ class ChannelWithChildrenModel
17
+ # Always \"channel\"
18
+ attr_accessor :type
19
+
20
+ # 123
21
+ attr_accessor :id
22
+
23
+ # parent's slug
24
+ attr_accessor :parent
25
+
26
+ # xyz
27
+ attr_accessor :create_datetime
28
+
29
+ attr_accessor :breadcrumbs
30
+
31
+ # xyz
32
+ attr_accessor :username
33
+
34
+ attr_accessor :slug
35
+
36
+ # xyz
37
+ attr_accessor :title
38
+
39
+ # xyz
40
+ attr_accessor :short_title
41
+
42
+ # xyz
43
+ attr_accessor :description
44
+
45
+ attr_accessor :featured_gif
46
+
47
+ # xyz
48
+ attr_accessor :banner_image
49
+
50
+ # xyz
51
+ attr_accessor :avatar_image
52
+
53
+ attr_accessor :screensaver_gif
54
+
55
+ attr_accessor :is_private
56
+
57
+ attr_accessor :is_live
58
+
59
+ # xyz
60
+ attr_accessor :event_start_datetime
61
+
62
+ # xyz
63
+ attr_accessor :event_end_datetime
64
+
65
+ attr_accessor :has_children
66
+
67
+ # xyz
68
+ attr_accessor :url
69
+
70
+ # xyz
71
+ attr_accessor :website_url
72
+
73
+ # xyz
74
+ attr_accessor :instagram_url
75
+
76
+ # xyz
77
+ attr_accessor :twitter_url
78
+
79
+ # xyz
80
+ attr_accessor :facebook_url
81
+
82
+ # xyz
83
+ attr_accessor :pinterest_url
84
+
85
+ # xyz
86
+ attr_accessor :tumblr_url
87
+
88
+ attr_accessor :user
89
+
90
+ attr_accessor :trending_tags
91
+
92
+ attr_accessor :gifs
93
+
94
+ attr_accessor :children
95
+
96
+
97
+ # Attribute mapping from ruby-style variable name to JSON key.
98
+ def self.attribute_map
99
+ {
100
+ :'type' => :'type',
101
+ :'id' => :'id',
102
+ :'parent' => :'parent',
103
+ :'create_datetime' => :'create_datetime',
104
+ :'breadcrumbs' => :'breadcrumbs',
105
+ :'username' => :'username',
106
+ :'slug' => :'slug',
107
+ :'title' => :'title',
108
+ :'short_title' => :'short_title',
109
+ :'description' => :'description',
110
+ :'featured_gif' => :'featured_gif',
111
+ :'banner_image' => :'banner_image',
112
+ :'avatar_image' => :'avatar_image',
113
+ :'screensaver_gif' => :'screensaver_gif',
114
+ :'is_private' => :'is_private',
115
+ :'is_live' => :'is_live',
116
+ :'event_start_datetime' => :'event_start_datetime',
117
+ :'event_end_datetime' => :'event_end_datetime',
118
+ :'has_children' => :'has_children',
119
+ :'url' => :'url',
120
+ :'website_url' => :'website_url',
121
+ :'instagram_url' => :'instagram_url',
122
+ :'twitter_url' => :'twitter_url',
123
+ :'facebook_url' => :'facebook_url',
124
+ :'pinterest_url' => :'pinterest_url',
125
+ :'tumblr_url' => :'tumblr_url',
126
+ :'user' => :'user',
127
+ :'trending_tags' => :'trending_tags',
128
+ :'gifs' => :'gifs',
129
+ :'children' => :'children'
130
+ }
131
+ end
132
+
133
+ # Attribute type mapping.
134
+ def self.swagger_types
135
+ {
136
+ :'type' => :'String',
137
+ :'id' => :'Integer',
138
+ :'parent' => :'String',
139
+ :'create_datetime' => :'String',
140
+ :'breadcrumbs' => :'Array<Breadcrumb>',
141
+ :'username' => :'String',
142
+ :'slug' => :'String',
143
+ :'title' => :'String',
144
+ :'short_title' => :'String',
145
+ :'description' => :'String',
146
+ :'featured_gif' => :'Gif',
147
+ :'banner_image' => :'String',
148
+ :'avatar_image' => :'String',
149
+ :'screensaver_gif' => :'Gif',
150
+ :'is_private' => :'BOOLEAN',
151
+ :'is_live' => :'BOOLEAN',
152
+ :'event_start_datetime' => :'String',
153
+ :'event_end_datetime' => :'String',
154
+ :'has_children' => :'BOOLEAN',
155
+ :'url' => :'String',
156
+ :'website_url' => :'String',
157
+ :'instagram_url' => :'String',
158
+ :'twitter_url' => :'String',
159
+ :'facebook_url' => :'String',
160
+ :'pinterest_url' => :'String',
161
+ :'tumblr_url' => :'String',
162
+ :'user' => :'User',
163
+ :'trending_tags' => :'Array<TrendingTag>',
164
+ :'gifs' => :'BaseChannelModelGifs',
165
+ :'children' => :'ChannelWithChildrenModelChildren'
166
+ }
167
+ end
168
+
169
+ # Initializes the object
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ def initialize(attributes = {})
172
+ return unless attributes.is_a?(Hash)
173
+
174
+ # convert string to symbol for hash key
175
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
176
+
177
+ if attributes.has_key?(:'type')
178
+ self.type = attributes[:'type']
179
+ else
180
+ self.type = "channel"
181
+ end
182
+
183
+ if attributes.has_key?(:'id')
184
+ self.id = attributes[:'id']
185
+ end
186
+
187
+ if attributes.has_key?(:'parent')
188
+ self.parent = attributes[:'parent']
189
+ end
190
+
191
+ if attributes.has_key?(:'create_datetime')
192
+ self.create_datetime = attributes[:'create_datetime']
193
+ end
194
+
195
+ if attributes.has_key?(:'breadcrumbs')
196
+ if (value = attributes[:'breadcrumbs']).is_a?(Array)
197
+ self.breadcrumbs = value
198
+ end
199
+ end
200
+
201
+ if attributes.has_key?(:'username')
202
+ self.username = attributes[:'username']
203
+ end
204
+
205
+ if attributes.has_key?(:'slug')
206
+ self.slug = attributes[:'slug']
207
+ end
208
+
209
+ if attributes.has_key?(:'title')
210
+ self.title = attributes[:'title']
211
+ end
212
+
213
+ if attributes.has_key?(:'short_title')
214
+ self.short_title = attributes[:'short_title']
215
+ end
216
+
217
+ if attributes.has_key?(:'description')
218
+ self.description = attributes[:'description']
219
+ end
220
+
221
+ if attributes.has_key?(:'featured_gif')
222
+ self.featured_gif = attributes[:'featured_gif']
223
+ end
224
+
225
+ if attributes.has_key?(:'banner_image')
226
+ self.banner_image = attributes[:'banner_image']
227
+ end
228
+
229
+ if attributes.has_key?(:'avatar_image')
230
+ self.avatar_image = attributes[:'avatar_image']
231
+ end
232
+
233
+ if attributes.has_key?(:'screensaver_gif')
234
+ self.screensaver_gif = attributes[:'screensaver_gif']
235
+ end
236
+
237
+ if attributes.has_key?(:'is_private')
238
+ self.is_private = attributes[:'is_private']
239
+ end
240
+
241
+ if attributes.has_key?(:'is_live')
242
+ self.is_live = attributes[:'is_live']
243
+ end
244
+
245
+ if attributes.has_key?(:'event_start_datetime')
246
+ self.event_start_datetime = attributes[:'event_start_datetime']
247
+ end
248
+
249
+ if attributes.has_key?(:'event_end_datetime')
250
+ self.event_end_datetime = attributes[:'event_end_datetime']
251
+ end
252
+
253
+ if attributes.has_key?(:'has_children')
254
+ self.has_children = attributes[:'has_children']
255
+ end
256
+
257
+ if attributes.has_key?(:'url')
258
+ self.url = attributes[:'url']
259
+ end
260
+
261
+ if attributes.has_key?(:'website_url')
262
+ self.website_url = attributes[:'website_url']
263
+ end
264
+
265
+ if attributes.has_key?(:'instagram_url')
266
+ self.instagram_url = attributes[:'instagram_url']
267
+ end
268
+
269
+ if attributes.has_key?(:'twitter_url')
270
+ self.twitter_url = attributes[:'twitter_url']
271
+ end
272
+
273
+ if attributes.has_key?(:'facebook_url')
274
+ self.facebook_url = attributes[:'facebook_url']
275
+ end
276
+
277
+ if attributes.has_key?(:'pinterest_url')
278
+ self.pinterest_url = attributes[:'pinterest_url']
279
+ end
280
+
281
+ if attributes.has_key?(:'tumblr_url')
282
+ self.tumblr_url = attributes[:'tumblr_url']
283
+ end
284
+
285
+ if attributes.has_key?(:'user')
286
+ self.user = attributes[:'user']
287
+ end
288
+
289
+ if attributes.has_key?(:'trending_tags')
290
+ if (value = attributes[:'trending_tags']).is_a?(Array)
291
+ self.trending_tags = value
292
+ end
293
+ end
294
+
295
+ if attributes.has_key?(:'gifs')
296
+ self.gifs = attributes[:'gifs']
297
+ end
298
+
299
+ if attributes.has_key?(:'children')
300
+ self.children = attributes[:'children']
301
+ end
302
+
303
+ end
304
+
305
+ # Show invalid properties with the reasons. Usually used together with valid?
306
+ # @return Array for valid properies with the reasons
307
+ def list_invalid_properties
308
+ invalid_properties = Array.new
309
+ return invalid_properties
310
+ end
311
+
312
+ # Check to see if the all the properties in the model are valid
313
+ # @return true if the model is valid
314
+ def valid?
315
+ return true
316
+ end
317
+
318
+ # Checks equality by comparing each attribute.
319
+ # @param [Object] Object to be compared
320
+ def ==(o)
321
+ return true if self.equal?(o)
322
+ self.class == o.class &&
323
+ type == o.type &&
324
+ id == o.id &&
325
+ parent == o.parent &&
326
+ create_datetime == o.create_datetime &&
327
+ breadcrumbs == o.breadcrumbs &&
328
+ username == o.username &&
329
+ slug == o.slug &&
330
+ title == o.title &&
331
+ short_title == o.short_title &&
332
+ description == o.description &&
333
+ featured_gif == o.featured_gif &&
334
+ banner_image == o.banner_image &&
335
+ avatar_image == o.avatar_image &&
336
+ screensaver_gif == o.screensaver_gif &&
337
+ is_private == o.is_private &&
338
+ is_live == o.is_live &&
339
+ event_start_datetime == o.event_start_datetime &&
340
+ event_end_datetime == o.event_end_datetime &&
341
+ has_children == o.has_children &&
342
+ url == o.url &&
343
+ website_url == o.website_url &&
344
+ instagram_url == o.instagram_url &&
345
+ twitter_url == o.twitter_url &&
346
+ facebook_url == o.facebook_url &&
347
+ pinterest_url == o.pinterest_url &&
348
+ tumblr_url == o.tumblr_url &&
349
+ user == o.user &&
350
+ trending_tags == o.trending_tags &&
351
+ gifs == o.gifs &&
352
+ children == o.children
353
+ end
354
+
355
+ # @see the `==` method
356
+ # @param [Object] Object to be compared
357
+ def eql?(o)
358
+ self == o
359
+ end
360
+
361
+ # Calculates hash code according to all attributes.
362
+ # @return [Fixnum] Hash code
363
+ def hash
364
+ [type, id, parent, create_datetime, breadcrumbs, username, slug, title, short_title, description, featured_gif, banner_image, avatar_image, screensaver_gif, is_private, is_live, event_start_datetime, event_end_datetime, has_children, url, website_url, instagram_url, twitter_url, facebook_url, pinterest_url, tumblr_url, user, trending_tags, gifs, children].hash
365
+ end
366
+
367
+ # Builds the object from hash
368
+ # @param [Hash] attributes Model attributes in the form of hash
369
+ # @return [Object] Returns the model itself
370
+ def build_from_hash(attributes)
371
+ return nil unless attributes.is_a?(Hash)
372
+ self.class.swagger_types.each_pair do |key, type|
373
+ if type =~ /\AArray<(.*)>/i
374
+ # check to ensure the input is an array given that the the attribute
375
+ # is documented as an array but the input is not
376
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
377
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
378
+ end
379
+ elsif !attributes[self.class.attribute_map[key]].nil?
380
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
381
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
382
+ end
383
+
384
+ self
385
+ end
386
+
387
+ # Deserializes the data based on type
388
+ # @param string type Data type
389
+ # @param string value Value to be deserialized
390
+ # @return [Object] Deserialized data
391
+ def _deserialize(type, value)
392
+ case type.to_sym
393
+ when :DateTime
394
+ DateTime.parse(value)
395
+ when :Date
396
+ Date.parse(value)
397
+ when :String
398
+ value.to_s
399
+ when :Integer
400
+ value.to_i
401
+ when :Float
402
+ value.to_f
403
+ when :BOOLEAN
404
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
405
+ true
406
+ else
407
+ false
408
+ end
409
+ when :Object
410
+ # generic object (usually a Hash), return directly
411
+ value
412
+ when /\AArray<(?<inner_type>.+)>\z/
413
+ inner_type = Regexp.last_match[:inner_type]
414
+ value.map { |v| _deserialize(inner_type, v) }
415
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
416
+ k_type = Regexp.last_match[:k_type]
417
+ v_type = Regexp.last_match[:v_type]
418
+ {}.tap do |hash|
419
+ value.each do |k, v|
420
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
421
+ end
422
+ end
423
+ else # model
424
+ temp_model = GiphyClient.const_get(type).new
425
+ temp_model.build_from_hash(value)
426
+ end
427
+ end
428
+
429
+ # Returns the string representation of the object
430
+ # @return [String] String presentation of the object
431
+ def to_s
432
+ to_hash.to_s
433
+ end
434
+
435
+ # to_body is an alias to to_hash (backward compatibility)
436
+ # @return [Hash] Returns the object in the form of hash
437
+ def to_body
438
+ to_hash
439
+ end
440
+
441
+ # Returns the object in the form of hash
442
+ # @return [Hash] Returns the object in the form of hash
443
+ def to_hash
444
+ hash = {}
445
+ self.class.attribute_map.each_pair do |attr, param|
446
+ value = self.send(attr)
447
+ next if value.nil?
448
+ hash[param] = _to_hash(value)
449
+ end
450
+ hash
451
+ end
452
+
453
+ # Outputs non-array value in the form of hash
454
+ # For object, use to_hash. Otherwise, just return the value
455
+ # @param [Object] value Any valid value
456
+ # @return [Hash] Returns the value in the form of hash
457
+ def _to_hash(value)
458
+ if value.is_a?(Array)
459
+ value.compact.map{ |v| _to_hash(v) }
460
+ elsif value.is_a?(Hash)
461
+ {}.tap do |hash|
462
+ value.each { |k, v| hash[k] = _to_hash(v) }
463
+ end
464
+ elsif value.respond_to? :to_hash
465
+ value.to_hash
466
+ else
467
+ value
468
+ end
469
+ end
470
+
471
+ end
472
+
473
+ end