GiphyClient 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,208 @@
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
+ # Data surrounding a static preview image of the downsized version of this GIF.
16
+ class GifImagesDownsizedStill
17
+ # The publicly-accessible direct URL for this GIF.
18
+ attr_accessor :url
19
+
20
+ # The width of this GIF in pixels.
21
+ attr_accessor :width
22
+
23
+ # The height of this GIF in pixels.
24
+ attr_accessor :height
25
+
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'url' => :'url',
31
+ :'width' => :'width',
32
+ :'height' => :'height'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ :'url' => :'String',
40
+ :'width' => :'String',
41
+ :'height' => :'String'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
52
+
53
+ if attributes.has_key?(:'url')
54
+ self.url = attributes[:'url']
55
+ end
56
+
57
+ if attributes.has_key?(:'width')
58
+ self.width = attributes[:'width']
59
+ end
60
+
61
+ if attributes.has_key?(:'height')
62
+ self.height = attributes[:'height']
63
+ end
64
+
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properies with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ return invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ return true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ url == o.url &&
86
+ width == o.width &&
87
+ height == o.height
88
+ end
89
+
90
+ # @see the `==` method
91
+ # @param [Object] Object to be compared
92
+ def eql?(o)
93
+ self == o
94
+ end
95
+
96
+ # Calculates hash code according to all attributes.
97
+ # @return [Fixnum] Hash code
98
+ def hash
99
+ [url, width, height].hash
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ self.class.swagger_types.each_pair do |key, type|
108
+ if type =~ /\AArray<(.*)>/i
109
+ # check to ensure the input is an array given that the the attribute
110
+ # is documented as an array but the input is not
111
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
112
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
113
+ end
114
+ elsif !attributes[self.class.attribute_map[key]].nil?
115
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
117
+ end
118
+
119
+ self
120
+ end
121
+
122
+ # Deserializes the data based on type
123
+ # @param string type Data type
124
+ # @param string value Value to be deserialized
125
+ # @return [Object] Deserialized data
126
+ def _deserialize(type, value)
127
+ case type.to_sym
128
+ when :DateTime
129
+ DateTime.parse(value)
130
+ when :Date
131
+ Date.parse(value)
132
+ when :String
133
+ value.to_s
134
+ when :Integer
135
+ value.to_i
136
+ when :Float
137
+ value.to_f
138
+ when :BOOLEAN
139
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
140
+ true
141
+ else
142
+ false
143
+ end
144
+ when :Object
145
+ # generic object (usually a Hash), return directly
146
+ value
147
+ when /\AArray<(?<inner_type>.+)>\z/
148
+ inner_type = Regexp.last_match[:inner_type]
149
+ value.map { |v| _deserialize(inner_type, v) }
150
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
151
+ k_type = Regexp.last_match[:k_type]
152
+ v_type = Regexp.last_match[:v_type]
153
+ {}.tap do |hash|
154
+ value.each do |k, v|
155
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
156
+ end
157
+ end
158
+ else # model
159
+ temp_model = GiphyClient.const_get(type).new
160
+ temp_model.build_from_hash(value)
161
+ end
162
+ end
163
+
164
+ # Returns the string representation of the object
165
+ # @return [String] String presentation of the object
166
+ def to_s
167
+ to_hash.to_s
168
+ end
169
+
170
+ # to_body is an alias to to_hash (backward compatibility)
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_body
173
+ to_hash
174
+ end
175
+
176
+ # Returns the object in the form of hash
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_hash
179
+ hash = {}
180
+ self.class.attribute_map.each_pair do |attr, param|
181
+ value = self.send(attr)
182
+ next if value.nil?
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ # Outputs non-array value in the form of hash
189
+ # For object, use to_hash. Otherwise, just return the value
190
+ # @param [Object] value Any valid value
191
+ # @return [Hash] Returns the value in the form of hash
192
+ def _to_hash(value)
193
+ if value.is_a?(Array)
194
+ value.compact.map{ |v| _to_hash(v) }
195
+ elsif value.is_a?(Hash)
196
+ {}.tap do |hash|
197
+ value.each { |k, v| hash[k] = _to_hash(v) }
198
+ end
199
+ elsif value.respond_to? :to_hash
200
+ value.to_hash
201
+ else
202
+ value
203
+ end
204
+ end
205
+
206
+ end
207
+
208
+ end
@@ -0,0 +1,258 @@
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
+ # Data surrounding versions of this GIF with a fixed height of 200 pixels. Good for mobile use.
16
+ class GifImagesFixedHeight
17
+ # The publicly-accessible direct URL for this GIF.
18
+ attr_accessor :url
19
+
20
+ # The width of this GIF in pixels.
21
+ attr_accessor :width
22
+
23
+ # The height of this GIF in pixels.
24
+ attr_accessor :height
25
+
26
+ # The size of this GIF in bytes.
27
+ attr_accessor :size
28
+
29
+ # The URL for this GIF in .MP4 format.
30
+ attr_accessor :mp4
31
+
32
+ # The size in bytes of the .MP4 file corresponding to this GIF.
33
+ attr_accessor :mp4_size
34
+
35
+ # The URL for this GIF in .webp format.
36
+ attr_accessor :webp
37
+
38
+ # The size in bytes of the .webp file corresponding to this GIF.
39
+ attr_accessor :webp_size
40
+
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'url' => :'url',
46
+ :'width' => :'width',
47
+ :'height' => :'height',
48
+ :'size' => :'size',
49
+ :'mp4' => :'mp4',
50
+ :'mp4_size' => :'mp4_size',
51
+ :'webp' => :'webp',
52
+ :'webp_size' => :'webp_size'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'url' => :'String',
60
+ :'width' => :'String',
61
+ :'height' => :'String',
62
+ :'size' => :'String',
63
+ :'mp4' => :'String',
64
+ :'mp4_size' => :'String',
65
+ :'webp' => :'String',
66
+ :'webp_size' => :'String'
67
+ }
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ return unless attributes.is_a?(Hash)
74
+
75
+ # convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
77
+
78
+ if attributes.has_key?(:'url')
79
+ self.url = attributes[:'url']
80
+ end
81
+
82
+ if attributes.has_key?(:'width')
83
+ self.width = attributes[:'width']
84
+ end
85
+
86
+ if attributes.has_key?(:'height')
87
+ self.height = attributes[:'height']
88
+ end
89
+
90
+ if attributes.has_key?(:'size')
91
+ self.size = attributes[:'size']
92
+ end
93
+
94
+ if attributes.has_key?(:'mp4')
95
+ self.mp4 = attributes[:'mp4']
96
+ end
97
+
98
+ if attributes.has_key?(:'mp4_size')
99
+ self.mp4_size = attributes[:'mp4_size']
100
+ end
101
+
102
+ if attributes.has_key?(:'webp')
103
+ self.webp = attributes[:'webp']
104
+ end
105
+
106
+ if attributes.has_key?(:'webp_size')
107
+ self.webp_size = attributes[:'webp_size']
108
+ end
109
+
110
+ end
111
+
112
+ # Show invalid properties with the reasons. Usually used together with valid?
113
+ # @return Array for valid properies with the reasons
114
+ def list_invalid_properties
115
+ invalid_properties = Array.new
116
+ return invalid_properties
117
+ end
118
+
119
+ # Check to see if the all the properties in the model are valid
120
+ # @return true if the model is valid
121
+ def valid?
122
+ return true
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ url == o.url &&
131
+ width == o.width &&
132
+ height == o.height &&
133
+ size == o.size &&
134
+ mp4 == o.mp4 &&
135
+ mp4_size == o.mp4_size &&
136
+ webp == o.webp &&
137
+ webp_size == o.webp_size
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Fixnum] Hash code
148
+ def hash
149
+ [url, width, height, size, mp4, mp4_size, webp, webp_size].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ self.class.swagger_types.each_pair do |key, type|
158
+ if type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ DateTime.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :BOOLEAN
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ temp_model = GiphyClient.const_get(type).new
210
+ temp_model.build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ next if value.nil?
233
+ hash[param] = _to_hash(value)
234
+ end
235
+ hash
236
+ end
237
+
238
+ # Outputs non-array value in the form of hash
239
+ # For object, use to_hash. Otherwise, just return the value
240
+ # @param [Object] value Any valid value
241
+ # @return [Hash] Returns the value in the form of hash
242
+ def _to_hash(value)
243
+ if value.is_a?(Array)
244
+ value.compact.map{ |v| _to_hash(v) }
245
+ elsif value.is_a?(Hash)
246
+ {}.tap do |hash|
247
+ value.each { |k, v| hash[k] = _to_hash(v) }
248
+ end
249
+ elsif value.respond_to? :to_hash
250
+ value.to_hash
251
+ else
252
+ value
253
+ end
254
+ end
255
+
256
+ end
257
+
258
+ end