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,464 @@
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 BaseChannelModel
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
+
95
+ # Attribute mapping from ruby-style variable name to JSON key.
96
+ def self.attribute_map
97
+ {
98
+ :'type' => :'type',
99
+ :'id' => :'id',
100
+ :'parent' => :'parent',
101
+ :'create_datetime' => :'create_datetime',
102
+ :'breadcrumbs' => :'breadcrumbs',
103
+ :'username' => :'username',
104
+ :'slug' => :'slug',
105
+ :'title' => :'title',
106
+ :'short_title' => :'short_title',
107
+ :'description' => :'description',
108
+ :'featured_gif' => :'featured_gif',
109
+ :'banner_image' => :'banner_image',
110
+ :'avatar_image' => :'avatar_image',
111
+ :'screensaver_gif' => :'screensaver_gif',
112
+ :'is_private' => :'is_private',
113
+ :'is_live' => :'is_live',
114
+ :'event_start_datetime' => :'event_start_datetime',
115
+ :'event_end_datetime' => :'event_end_datetime',
116
+ :'has_children' => :'has_children',
117
+ :'url' => :'url',
118
+ :'website_url' => :'website_url',
119
+ :'instagram_url' => :'instagram_url',
120
+ :'twitter_url' => :'twitter_url',
121
+ :'facebook_url' => :'facebook_url',
122
+ :'pinterest_url' => :'pinterest_url',
123
+ :'tumblr_url' => :'tumblr_url',
124
+ :'user' => :'user',
125
+ :'trending_tags' => :'trending_tags',
126
+ :'gifs' => :'gifs'
127
+ }
128
+ end
129
+
130
+ # Attribute type mapping.
131
+ def self.swagger_types
132
+ {
133
+ :'type' => :'String',
134
+ :'id' => :'Integer',
135
+ :'parent' => :'String',
136
+ :'create_datetime' => :'String',
137
+ :'breadcrumbs' => :'Array<Breadcrumb>',
138
+ :'username' => :'String',
139
+ :'slug' => :'String',
140
+ :'title' => :'String',
141
+ :'short_title' => :'String',
142
+ :'description' => :'String',
143
+ :'featured_gif' => :'Gif',
144
+ :'banner_image' => :'String',
145
+ :'avatar_image' => :'String',
146
+ :'screensaver_gif' => :'Gif',
147
+ :'is_private' => :'BOOLEAN',
148
+ :'is_live' => :'BOOLEAN',
149
+ :'event_start_datetime' => :'String',
150
+ :'event_end_datetime' => :'String',
151
+ :'has_children' => :'BOOLEAN',
152
+ :'url' => :'String',
153
+ :'website_url' => :'String',
154
+ :'instagram_url' => :'String',
155
+ :'twitter_url' => :'String',
156
+ :'facebook_url' => :'String',
157
+ :'pinterest_url' => :'String',
158
+ :'tumblr_url' => :'String',
159
+ :'user' => :'User',
160
+ :'trending_tags' => :'Array<TrendingTag>',
161
+ :'gifs' => :'BaseChannelModelGifs'
162
+ }
163
+ end
164
+
165
+ # Initializes the object
166
+ # @param [Hash] attributes Model attributes in the form of hash
167
+ def initialize(attributes = {})
168
+ return unless attributes.is_a?(Hash)
169
+
170
+ # convert string to symbol for hash key
171
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
172
+
173
+ if attributes.has_key?(:'type')
174
+ self.type = attributes[:'type']
175
+ else
176
+ self.type = "channel"
177
+ end
178
+
179
+ if attributes.has_key?(:'id')
180
+ self.id = attributes[:'id']
181
+ end
182
+
183
+ if attributes.has_key?(:'parent')
184
+ self.parent = attributes[:'parent']
185
+ end
186
+
187
+ if attributes.has_key?(:'create_datetime')
188
+ self.create_datetime = attributes[:'create_datetime']
189
+ end
190
+
191
+ if attributes.has_key?(:'breadcrumbs')
192
+ if (value = attributes[:'breadcrumbs']).is_a?(Array)
193
+ self.breadcrumbs = value
194
+ end
195
+ end
196
+
197
+ if attributes.has_key?(:'username')
198
+ self.username = attributes[:'username']
199
+ end
200
+
201
+ if attributes.has_key?(:'slug')
202
+ self.slug = attributes[:'slug']
203
+ end
204
+
205
+ if attributes.has_key?(:'title')
206
+ self.title = attributes[:'title']
207
+ end
208
+
209
+ if attributes.has_key?(:'short_title')
210
+ self.short_title = attributes[:'short_title']
211
+ end
212
+
213
+ if attributes.has_key?(:'description')
214
+ self.description = attributes[:'description']
215
+ end
216
+
217
+ if attributes.has_key?(:'featured_gif')
218
+ self.featured_gif = attributes[:'featured_gif']
219
+ end
220
+
221
+ if attributes.has_key?(:'banner_image')
222
+ self.banner_image = attributes[:'banner_image']
223
+ end
224
+
225
+ if attributes.has_key?(:'avatar_image')
226
+ self.avatar_image = attributes[:'avatar_image']
227
+ end
228
+
229
+ if attributes.has_key?(:'screensaver_gif')
230
+ self.screensaver_gif = attributes[:'screensaver_gif']
231
+ end
232
+
233
+ if attributes.has_key?(:'is_private')
234
+ self.is_private = attributes[:'is_private']
235
+ end
236
+
237
+ if attributes.has_key?(:'is_live')
238
+ self.is_live = attributes[:'is_live']
239
+ end
240
+
241
+ if attributes.has_key?(:'event_start_datetime')
242
+ self.event_start_datetime = attributes[:'event_start_datetime']
243
+ end
244
+
245
+ if attributes.has_key?(:'event_end_datetime')
246
+ self.event_end_datetime = attributes[:'event_end_datetime']
247
+ end
248
+
249
+ if attributes.has_key?(:'has_children')
250
+ self.has_children = attributes[:'has_children']
251
+ end
252
+
253
+ if attributes.has_key?(:'url')
254
+ self.url = attributes[:'url']
255
+ end
256
+
257
+ if attributes.has_key?(:'website_url')
258
+ self.website_url = attributes[:'website_url']
259
+ end
260
+
261
+ if attributes.has_key?(:'instagram_url')
262
+ self.instagram_url = attributes[:'instagram_url']
263
+ end
264
+
265
+ if attributes.has_key?(:'twitter_url')
266
+ self.twitter_url = attributes[:'twitter_url']
267
+ end
268
+
269
+ if attributes.has_key?(:'facebook_url')
270
+ self.facebook_url = attributes[:'facebook_url']
271
+ end
272
+
273
+ if attributes.has_key?(:'pinterest_url')
274
+ self.pinterest_url = attributes[:'pinterest_url']
275
+ end
276
+
277
+ if attributes.has_key?(:'tumblr_url')
278
+ self.tumblr_url = attributes[:'tumblr_url']
279
+ end
280
+
281
+ if attributes.has_key?(:'user')
282
+ self.user = attributes[:'user']
283
+ end
284
+
285
+ if attributes.has_key?(:'trending_tags')
286
+ if (value = attributes[:'trending_tags']).is_a?(Array)
287
+ self.trending_tags = value
288
+ end
289
+ end
290
+
291
+ if attributes.has_key?(:'gifs')
292
+ self.gifs = attributes[:'gifs']
293
+ end
294
+
295
+ end
296
+
297
+ # Show invalid properties with the reasons. Usually used together with valid?
298
+ # @return Array for valid properies with the reasons
299
+ def list_invalid_properties
300
+ invalid_properties = Array.new
301
+ return invalid_properties
302
+ end
303
+
304
+ # Check to see if the all the properties in the model are valid
305
+ # @return true if the model is valid
306
+ def valid?
307
+ return true
308
+ end
309
+
310
+ # Checks equality by comparing each attribute.
311
+ # @param [Object] Object to be compared
312
+ def ==(o)
313
+ return true if self.equal?(o)
314
+ self.class == o.class &&
315
+ type == o.type &&
316
+ id == o.id &&
317
+ parent == o.parent &&
318
+ create_datetime == o.create_datetime &&
319
+ breadcrumbs == o.breadcrumbs &&
320
+ username == o.username &&
321
+ slug == o.slug &&
322
+ title == o.title &&
323
+ short_title == o.short_title &&
324
+ description == o.description &&
325
+ featured_gif == o.featured_gif &&
326
+ banner_image == o.banner_image &&
327
+ avatar_image == o.avatar_image &&
328
+ screensaver_gif == o.screensaver_gif &&
329
+ is_private == o.is_private &&
330
+ is_live == o.is_live &&
331
+ event_start_datetime == o.event_start_datetime &&
332
+ event_end_datetime == o.event_end_datetime &&
333
+ has_children == o.has_children &&
334
+ url == o.url &&
335
+ website_url == o.website_url &&
336
+ instagram_url == o.instagram_url &&
337
+ twitter_url == o.twitter_url &&
338
+ facebook_url == o.facebook_url &&
339
+ pinterest_url == o.pinterest_url &&
340
+ tumblr_url == o.tumblr_url &&
341
+ user == o.user &&
342
+ trending_tags == o.trending_tags &&
343
+ gifs == o.gifs
344
+ end
345
+
346
+ # @see the `==` method
347
+ # @param [Object] Object to be compared
348
+ def eql?(o)
349
+ self == o
350
+ end
351
+
352
+ # Calculates hash code according to all attributes.
353
+ # @return [Fixnum] Hash code
354
+ def hash
355
+ [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].hash
356
+ end
357
+
358
+ # Builds the object from hash
359
+ # @param [Hash] attributes Model attributes in the form of hash
360
+ # @return [Object] Returns the model itself
361
+ def build_from_hash(attributes)
362
+ return nil unless attributes.is_a?(Hash)
363
+ self.class.swagger_types.each_pair do |key, type|
364
+ if type =~ /\AArray<(.*)>/i
365
+ # check to ensure the input is an array given that the the attribute
366
+ # is documented as an array but the input is not
367
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
368
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
369
+ end
370
+ elsif !attributes[self.class.attribute_map[key]].nil?
371
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
372
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
373
+ end
374
+
375
+ self
376
+ end
377
+
378
+ # Deserializes the data based on type
379
+ # @param string type Data type
380
+ # @param string value Value to be deserialized
381
+ # @return [Object] Deserialized data
382
+ def _deserialize(type, value)
383
+ case type.to_sym
384
+ when :DateTime
385
+ DateTime.parse(value)
386
+ when :Date
387
+ Date.parse(value)
388
+ when :String
389
+ value.to_s
390
+ when :Integer
391
+ value.to_i
392
+ when :Float
393
+ value.to_f
394
+ when :BOOLEAN
395
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
396
+ true
397
+ else
398
+ false
399
+ end
400
+ when :Object
401
+ # generic object (usually a Hash), return directly
402
+ value
403
+ when /\AArray<(?<inner_type>.+)>\z/
404
+ inner_type = Regexp.last_match[:inner_type]
405
+ value.map { |v| _deserialize(inner_type, v) }
406
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
407
+ k_type = Regexp.last_match[:k_type]
408
+ v_type = Regexp.last_match[:v_type]
409
+ {}.tap do |hash|
410
+ value.each do |k, v|
411
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
412
+ end
413
+ end
414
+ else # model
415
+ temp_model = GiphyClient.const_get(type).new
416
+ temp_model.build_from_hash(value)
417
+ end
418
+ end
419
+
420
+ # Returns the string representation of the object
421
+ # @return [String] String presentation of the object
422
+ def to_s
423
+ to_hash.to_s
424
+ end
425
+
426
+ # to_body is an alias to to_hash (backward compatibility)
427
+ # @return [Hash] Returns the object in the form of hash
428
+ def to_body
429
+ to_hash
430
+ end
431
+
432
+ # Returns the object in the form of hash
433
+ # @return [Hash] Returns the object in the form of hash
434
+ def to_hash
435
+ hash = {}
436
+ self.class.attribute_map.each_pair do |attr, param|
437
+ value = self.send(attr)
438
+ next if value.nil?
439
+ hash[param] = _to_hash(value)
440
+ end
441
+ hash
442
+ end
443
+
444
+ # Outputs non-array value in the form of hash
445
+ # For object, use to_hash. Otherwise, just return the value
446
+ # @param [Object] value Any valid value
447
+ # @return [Hash] Returns the value in the form of hash
448
+ def _to_hash(value)
449
+ if value.is_a?(Array)
450
+ value.compact.map{ |v| _to_hash(v) }
451
+ elsif value.is_a?(Hash)
452
+ {}.tap do |hash|
453
+ value.each { |k, v| hash[k] = _to_hash(v) }
454
+ end
455
+ elsif value.respond_to? :to_hash
456
+ value.to_hash
457
+ else
458
+ value
459
+ end
460
+ end
461
+
462
+ end
463
+
464
+ end