GiphyClient 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/GiphyClient.gemspec +44 -0
- data/README.md +152 -0
- data/Rakefile +7 -0
- data/config.json +18 -0
- data/docs/BaseChannelModel.md +36 -0
- data/docs/BaseChannelModelGifs.md +9 -0
- data/docs/Breadcrumb.md +10 -0
- data/docs/Category.md +11 -0
- data/docs/ChannelWithChildrenModel.md +37 -0
- data/docs/ChannelWithChildrenModelChildren.md +9 -0
- data/docs/DefaultApi.md +731 -0
- data/docs/Gif.md +36 -0
- data/docs/GifImages.md +27 -0
- data/docs/GifImagesDownsized.md +11 -0
- data/docs/GifImagesDownsizedLarge.md +11 -0
- data/docs/GifImagesDownsizedMedium.md +11 -0
- data/docs/GifImagesDownsizedSmall.md +11 -0
- data/docs/GifImagesDownsizedStill.md +10 -0
- data/docs/GifImagesFixedHeight.md +15 -0
- data/docs/GifImagesFixedHeightDownsampled.md +13 -0
- data/docs/GifImagesFixedHeightSmall.md +15 -0
- data/docs/GifImagesFixedHeightSmallStill.md +10 -0
- data/docs/GifImagesFixedHeightStill.md +10 -0
- data/docs/GifImagesFixedWidth.md +15 -0
- data/docs/GifImagesFixedWidthDownsampled.md +13 -0
- data/docs/GifImagesFixedWidthSmall.md +15 -0
- data/docs/GifImagesFixedWidthSmallStill.md +10 -0
- data/docs/GifImagesFixedWidthStill.md +10 -0
- data/docs/GifImagesLooping.md +8 -0
- data/docs/GifImagesOriginal.md +16 -0
- data/docs/GifImagesOriginalStill.md +10 -0
- data/docs/GifImagesPreview.md +11 -0
- data/docs/GifImagesPreviewGif.md +11 -0
- data/docs/InlineResponse200.md +10 -0
- data/docs/InlineResponse2001.md +9 -0
- data/docs/InlineResponse2002.md +9 -0
- data/docs/InlineResponse2003.md +10 -0
- data/docs/InlineResponse2004.md +10 -0
- data/docs/InlineResponse2005.md +10 -0
- data/docs/InlineResponse400.md +8 -0
- data/docs/LastChildModel.md +37 -0
- data/docs/LastChildModelChildren.md +9 -0
- data/docs/MetaContent.md +10 -0
- data/docs/MetaObject.md +8 -0
- data/docs/Pagination.md +10 -0
- data/docs/RandomGif.md +30 -0
- data/docs/ShallowTag.md +9 -0
- data/docs/Tag.md +9 -0
- data/docs/TrendingTag.md +10 -0
- data/docs/User.md +13 -0
- data/generate.sh +12 -0
- data/git_push.sh +55 -0
- data/lib/GiphyClient.rb +84 -0
- data/lib/GiphyClient/api/default_api.rb +952 -0
- data/lib/GiphyClient/api_client.rb +375 -0
- data/lib/GiphyClient/api_error.rb +37 -0
- data/lib/GiphyClient/configuration.rb +195 -0
- data/lib/GiphyClient/models/base_channel_model.rb +464 -0
- data/lib/GiphyClient/models/base_channel_model_gifs.rb +198 -0
- data/lib/GiphyClient/models/breadcrumb.rb +205 -0
- data/lib/GiphyClient/models/category.rb +220 -0
- data/lib/GiphyClient/models/channel_with_children_model.rb +473 -0
- data/lib/GiphyClient/models/channel_with_children_model_children.rb +198 -0
- data/lib/GiphyClient/models/gif.rb +473 -0
- data/lib/GiphyClient/models/gif_images.rb +358 -0
- data/lib/GiphyClient/models/gif_images_downsized.rb +218 -0
- data/lib/GiphyClient/models/gif_images_downsized_large.rb +218 -0
- data/lib/GiphyClient/models/gif_images_downsized_medium.rb +218 -0
- data/lib/GiphyClient/models/gif_images_downsized_small.rb +218 -0
- data/lib/GiphyClient/models/gif_images_downsized_still.rb +208 -0
- data/lib/GiphyClient/models/gif_images_fixed_height.rb +258 -0
- data/lib/GiphyClient/models/gif_images_fixed_height_downsampled.rb +238 -0
- data/lib/GiphyClient/models/gif_images_fixed_height_small.rb +258 -0
- data/lib/GiphyClient/models/gif_images_fixed_height_small_still.rb +208 -0
- data/lib/GiphyClient/models/gif_images_fixed_height_still.rb +208 -0
- data/lib/GiphyClient/models/gif_images_fixed_width.rb +258 -0
- data/lib/GiphyClient/models/gif_images_fixed_width_downsampled.rb +238 -0
- data/lib/GiphyClient/models/gif_images_fixed_width_small.rb +258 -0
- data/lib/GiphyClient/models/gif_images_fixed_width_small_still.rb +208 -0
- data/lib/GiphyClient/models/gif_images_fixed_width_still.rb +208 -0
- data/lib/GiphyClient/models/gif_images_looping.rb +188 -0
- data/lib/GiphyClient/models/gif_images_original.rb +268 -0
- data/lib/GiphyClient/models/gif_images_original_still.rb +208 -0
- data/lib/GiphyClient/models/gif_images_preview.rb +218 -0
- data/lib/GiphyClient/models/gif_images_preview_gif.rb +218 -0
- data/lib/GiphyClient/models/inline_response_200.rb +209 -0
- data/lib/GiphyClient/models/inline_response_200_1.rb +197 -0
- data/lib/GiphyClient/models/inline_response_200_2.rb +197 -0
- data/lib/GiphyClient/models/inline_response_200_3.rb +207 -0
- data/lib/GiphyClient/models/inline_response_200_4.rb +207 -0
- data/lib/GiphyClient/models/inline_response_200_5.rb +207 -0
- data/lib/GiphyClient/models/inline_response_400.rb +187 -0
- data/lib/GiphyClient/models/last_child_model.rb +473 -0
- data/lib/GiphyClient/models/last_child_model_children.rb +198 -0
- data/lib/GiphyClient/models/meta_content.rb +218 -0
- data/lib/GiphyClient/models/meta_object.rb +187 -0
- data/lib/GiphyClient/models/pagination.rb +208 -0
- data/lib/GiphyClient/models/random_gif.rb +401 -0
- data/lib/GiphyClient/models/shallow_tag.rb +198 -0
- data/lib/GiphyClient/models/tag.rb +198 -0
- data/lib/GiphyClient/models/trending_tag.rb +205 -0
- data/lib/GiphyClient/models/user.rb +238 -0
- data/lib/GiphyClient/version.rb +14 -0
- data/public.yaml +1638 -0
- data/spec/api/default_api_spec.rb +260 -0
- data/spec/api_client_spec.rb +225 -0
- data/spec/configuration_spec.rb +41 -0
- data/spec/models/base_channel_model_gifs_spec.rb +47 -0
- data/spec/models/base_channel_model_spec.rb +209 -0
- data/spec/models/breadcrumb_spec.rb +53 -0
- data/spec/models/category_spec.rb +59 -0
- data/spec/models/channel_with_children_model_children_spec.rb +47 -0
- data/spec/models/channel_with_children_model_spec.rb +215 -0
- data/spec/models/gif_images_downsized_large_spec.rb +59 -0
- data/spec/models/gif_images_downsized_medium_spec.rb +59 -0
- data/spec/models/gif_images_downsized_small_spec.rb +59 -0
- data/spec/models/gif_images_downsized_spec.rb +59 -0
- data/spec/models/gif_images_downsized_still_spec.rb +53 -0
- data/spec/models/gif_images_fixed_height_downsampled_spec.rb +71 -0
- data/spec/models/gif_images_fixed_height_small_spec.rb +83 -0
- data/spec/models/gif_images_fixed_height_small_still_spec.rb +53 -0
- data/spec/models/gif_images_fixed_height_spec.rb +83 -0
- data/spec/models/gif_images_fixed_height_still_spec.rb +53 -0
- data/spec/models/gif_images_fixed_width_downsampled_spec.rb +71 -0
- data/spec/models/gif_images_fixed_width_small_spec.rb +83 -0
- data/spec/models/gif_images_fixed_width_small_still_spec.rb +53 -0
- data/spec/models/gif_images_fixed_width_spec.rb +83 -0
- data/spec/models/gif_images_fixed_width_still_spec.rb +53 -0
- data/spec/models/gif_images_looping_spec.rb +41 -0
- data/spec/models/gif_images_original_spec.rb +89 -0
- data/spec/models/gif_images_original_still_spec.rb +53 -0
- data/spec/models/gif_images_preview_gif_spec.rb +59 -0
- data/spec/models/gif_images_preview_spec.rb +59 -0
- data/spec/models/gif_images_spec.rb +155 -0
- data/spec/models/gif_spec.rb +209 -0
- data/spec/models/inline_response_200_1_spec.rb +47 -0
- data/spec/models/inline_response_200_2_spec.rb +47 -0
- data/spec/models/inline_response_200_3_spec.rb +53 -0
- data/spec/models/inline_response_200_4_spec.rb +53 -0
- data/spec/models/inline_response_200_5_spec.rb +53 -0
- data/spec/models/inline_response_200_spec.rb +53 -0
- data/spec/models/inline_response_400_spec.rb +41 -0
- data/spec/models/last_child_model_children_spec.rb +47 -0
- data/spec/models/last_child_model_spec.rb +215 -0
- data/spec/models/meta_content_spec.rb +53 -0
- data/spec/models/meta_object_spec.rb +41 -0
- data/spec/models/pagination_spec.rb +53 -0
- data/spec/models/random_gif_spec.rb +173 -0
- data/spec/models/shallow_tag_spec.rb +47 -0
- data/spec/models/tag_spec.rb +47 -0
- data/spec/models/trending_tag_spec.rb +53 -0
- data/spec/models/user_spec.rb +71 -0
- data/spec/spec_helper.rb +110 -0
- metadata +428 -0
@@ -0,0 +1,358 @@
|
|
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
|
+
# An object containing data for various available formats and sizes of this GIF.
|
16
|
+
class GifImages
|
17
|
+
attr_accessor :fixed_height
|
18
|
+
|
19
|
+
attr_accessor :fixed_height_still
|
20
|
+
|
21
|
+
attr_accessor :fixed_height_downsampled
|
22
|
+
|
23
|
+
attr_accessor :fixed_width
|
24
|
+
|
25
|
+
attr_accessor :fixed_width_still
|
26
|
+
|
27
|
+
attr_accessor :fixed_width_downsampled
|
28
|
+
|
29
|
+
attr_accessor :fixed_height_small
|
30
|
+
|
31
|
+
attr_accessor :fixed_height_small_still
|
32
|
+
|
33
|
+
attr_accessor :fixed_width_small
|
34
|
+
|
35
|
+
attr_accessor :fixed_width_small_still
|
36
|
+
|
37
|
+
attr_accessor :downsized
|
38
|
+
|
39
|
+
attr_accessor :downsized_still
|
40
|
+
|
41
|
+
attr_accessor :downsized_large
|
42
|
+
|
43
|
+
attr_accessor :downsized_medium
|
44
|
+
|
45
|
+
attr_accessor :downsized_small
|
46
|
+
|
47
|
+
attr_accessor :original
|
48
|
+
|
49
|
+
attr_accessor :original_still
|
50
|
+
|
51
|
+
attr_accessor :looping
|
52
|
+
|
53
|
+
attr_accessor :preview
|
54
|
+
|
55
|
+
attr_accessor :preview_gif
|
56
|
+
|
57
|
+
|
58
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
59
|
+
def self.attribute_map
|
60
|
+
{
|
61
|
+
:'fixed_height' => :'fixed_height',
|
62
|
+
:'fixed_height_still' => :'fixed_height_still',
|
63
|
+
:'fixed_height_downsampled' => :'fixed_height_downsampled',
|
64
|
+
:'fixed_width' => :'fixed_width',
|
65
|
+
:'fixed_width_still' => :'fixed_width_still',
|
66
|
+
:'fixed_width_downsampled' => :'fixed_width_downsampled',
|
67
|
+
:'fixed_height_small' => :'fixed_height_small',
|
68
|
+
:'fixed_height_small_still' => :'fixed_height_small_still',
|
69
|
+
:'fixed_width_small' => :'fixed_width_small',
|
70
|
+
:'fixed_width_small_still' => :'fixed_width_small_still',
|
71
|
+
:'downsized' => :'downsized',
|
72
|
+
:'downsized_still' => :'downsized_still',
|
73
|
+
:'downsized_large' => :'downsized_large',
|
74
|
+
:'downsized_medium' => :'downsized_medium',
|
75
|
+
:'downsized_small' => :'downsized_small',
|
76
|
+
:'original' => :'original',
|
77
|
+
:'original_still' => :'original_still',
|
78
|
+
:'looping' => :'looping',
|
79
|
+
:'preview' => :'preview',
|
80
|
+
:'preview_gif' => :'preview_gif'
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
# Attribute type mapping.
|
85
|
+
def self.swagger_types
|
86
|
+
{
|
87
|
+
:'fixed_height' => :'GifImagesFixedHeight',
|
88
|
+
:'fixed_height_still' => :'GifImagesFixedHeightStill',
|
89
|
+
:'fixed_height_downsampled' => :'GifImagesFixedHeightDownsampled',
|
90
|
+
:'fixed_width' => :'GifImagesFixedWidth',
|
91
|
+
:'fixed_width_still' => :'GifImagesFixedWidthStill',
|
92
|
+
:'fixed_width_downsampled' => :'GifImagesFixedWidthDownsampled',
|
93
|
+
:'fixed_height_small' => :'GifImagesFixedHeightSmall',
|
94
|
+
:'fixed_height_small_still' => :'GifImagesFixedHeightSmallStill',
|
95
|
+
:'fixed_width_small' => :'GifImagesFixedWidthSmall',
|
96
|
+
:'fixed_width_small_still' => :'GifImagesFixedWidthSmallStill',
|
97
|
+
:'downsized' => :'GifImagesDownsized',
|
98
|
+
:'downsized_still' => :'GifImagesDownsizedStill',
|
99
|
+
:'downsized_large' => :'GifImagesDownsizedLarge',
|
100
|
+
:'downsized_medium' => :'GifImagesDownsizedMedium',
|
101
|
+
:'downsized_small' => :'GifImagesDownsizedSmall',
|
102
|
+
:'original' => :'GifImagesOriginal',
|
103
|
+
:'original_still' => :'GifImagesOriginalStill',
|
104
|
+
:'looping' => :'GifImagesLooping',
|
105
|
+
:'preview' => :'GifImagesPreview',
|
106
|
+
:'preview_gif' => :'GifImagesPreviewGif'
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
# Initializes the object
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
def initialize(attributes = {})
|
113
|
+
return unless attributes.is_a?(Hash)
|
114
|
+
|
115
|
+
# convert string to symbol for hash key
|
116
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
117
|
+
|
118
|
+
if attributes.has_key?(:'fixed_height')
|
119
|
+
self.fixed_height = attributes[:'fixed_height']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.has_key?(:'fixed_height_still')
|
123
|
+
self.fixed_height_still = attributes[:'fixed_height_still']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.has_key?(:'fixed_height_downsampled')
|
127
|
+
self.fixed_height_downsampled = attributes[:'fixed_height_downsampled']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.has_key?(:'fixed_width')
|
131
|
+
self.fixed_width = attributes[:'fixed_width']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.has_key?(:'fixed_width_still')
|
135
|
+
self.fixed_width_still = attributes[:'fixed_width_still']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes.has_key?(:'fixed_width_downsampled')
|
139
|
+
self.fixed_width_downsampled = attributes[:'fixed_width_downsampled']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.has_key?(:'fixed_height_small')
|
143
|
+
self.fixed_height_small = attributes[:'fixed_height_small']
|
144
|
+
end
|
145
|
+
|
146
|
+
if attributes.has_key?(:'fixed_height_small_still')
|
147
|
+
self.fixed_height_small_still = attributes[:'fixed_height_small_still']
|
148
|
+
end
|
149
|
+
|
150
|
+
if attributes.has_key?(:'fixed_width_small')
|
151
|
+
self.fixed_width_small = attributes[:'fixed_width_small']
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes.has_key?(:'fixed_width_small_still')
|
155
|
+
self.fixed_width_small_still = attributes[:'fixed_width_small_still']
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes.has_key?(:'downsized')
|
159
|
+
self.downsized = attributes[:'downsized']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.has_key?(:'downsized_still')
|
163
|
+
self.downsized_still = attributes[:'downsized_still']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes.has_key?(:'downsized_large')
|
167
|
+
self.downsized_large = attributes[:'downsized_large']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.has_key?(:'downsized_medium')
|
171
|
+
self.downsized_medium = attributes[:'downsized_medium']
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes.has_key?(:'downsized_small')
|
175
|
+
self.downsized_small = attributes[:'downsized_small']
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes.has_key?(:'original')
|
179
|
+
self.original = attributes[:'original']
|
180
|
+
end
|
181
|
+
|
182
|
+
if attributes.has_key?(:'original_still')
|
183
|
+
self.original_still = attributes[:'original_still']
|
184
|
+
end
|
185
|
+
|
186
|
+
if attributes.has_key?(:'looping')
|
187
|
+
self.looping = attributes[:'looping']
|
188
|
+
end
|
189
|
+
|
190
|
+
if attributes.has_key?(:'preview')
|
191
|
+
self.preview = attributes[:'preview']
|
192
|
+
end
|
193
|
+
|
194
|
+
if attributes.has_key?(:'preview_gif')
|
195
|
+
self.preview_gif = attributes[:'preview_gif']
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
|
200
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
201
|
+
# @return Array for valid properies with the reasons
|
202
|
+
def list_invalid_properties
|
203
|
+
invalid_properties = Array.new
|
204
|
+
return invalid_properties
|
205
|
+
end
|
206
|
+
|
207
|
+
# Check to see if the all the properties in the model are valid
|
208
|
+
# @return true if the model is valid
|
209
|
+
def valid?
|
210
|
+
return true
|
211
|
+
end
|
212
|
+
|
213
|
+
# Checks equality by comparing each attribute.
|
214
|
+
# @param [Object] Object to be compared
|
215
|
+
def ==(o)
|
216
|
+
return true if self.equal?(o)
|
217
|
+
self.class == o.class &&
|
218
|
+
fixed_height == o.fixed_height &&
|
219
|
+
fixed_height_still == o.fixed_height_still &&
|
220
|
+
fixed_height_downsampled == o.fixed_height_downsampled &&
|
221
|
+
fixed_width == o.fixed_width &&
|
222
|
+
fixed_width_still == o.fixed_width_still &&
|
223
|
+
fixed_width_downsampled == o.fixed_width_downsampled &&
|
224
|
+
fixed_height_small == o.fixed_height_small &&
|
225
|
+
fixed_height_small_still == o.fixed_height_small_still &&
|
226
|
+
fixed_width_small == o.fixed_width_small &&
|
227
|
+
fixed_width_small_still == o.fixed_width_small_still &&
|
228
|
+
downsized == o.downsized &&
|
229
|
+
downsized_still == o.downsized_still &&
|
230
|
+
downsized_large == o.downsized_large &&
|
231
|
+
downsized_medium == o.downsized_medium &&
|
232
|
+
downsized_small == o.downsized_small &&
|
233
|
+
original == o.original &&
|
234
|
+
original_still == o.original_still &&
|
235
|
+
looping == o.looping &&
|
236
|
+
preview == o.preview &&
|
237
|
+
preview_gif == o.preview_gif
|
238
|
+
end
|
239
|
+
|
240
|
+
# @see the `==` method
|
241
|
+
# @param [Object] Object to be compared
|
242
|
+
def eql?(o)
|
243
|
+
self == o
|
244
|
+
end
|
245
|
+
|
246
|
+
# Calculates hash code according to all attributes.
|
247
|
+
# @return [Fixnum] Hash code
|
248
|
+
def hash
|
249
|
+
[fixed_height, fixed_height_still, fixed_height_downsampled, fixed_width, fixed_width_still, fixed_width_downsampled, fixed_height_small, fixed_height_small_still, fixed_width_small, fixed_width_small_still, downsized, downsized_still, downsized_large, downsized_medium, downsized_small, original, original_still, looping, preview, preview_gif].hash
|
250
|
+
end
|
251
|
+
|
252
|
+
# Builds the object from hash
|
253
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
254
|
+
# @return [Object] Returns the model itself
|
255
|
+
def build_from_hash(attributes)
|
256
|
+
return nil unless attributes.is_a?(Hash)
|
257
|
+
self.class.swagger_types.each_pair do |key, type|
|
258
|
+
if type =~ /\AArray<(.*)>/i
|
259
|
+
# check to ensure the input is an array given that the the attribute
|
260
|
+
# is documented as an array but the input is not
|
261
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
262
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
263
|
+
end
|
264
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
265
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
266
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
267
|
+
end
|
268
|
+
|
269
|
+
self
|
270
|
+
end
|
271
|
+
|
272
|
+
# Deserializes the data based on type
|
273
|
+
# @param string type Data type
|
274
|
+
# @param string value Value to be deserialized
|
275
|
+
# @return [Object] Deserialized data
|
276
|
+
def _deserialize(type, value)
|
277
|
+
case type.to_sym
|
278
|
+
when :DateTime
|
279
|
+
DateTime.parse(value)
|
280
|
+
when :Date
|
281
|
+
Date.parse(value)
|
282
|
+
when :String
|
283
|
+
value.to_s
|
284
|
+
when :Integer
|
285
|
+
value.to_i
|
286
|
+
when :Float
|
287
|
+
value.to_f
|
288
|
+
when :BOOLEAN
|
289
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
290
|
+
true
|
291
|
+
else
|
292
|
+
false
|
293
|
+
end
|
294
|
+
when :Object
|
295
|
+
# generic object (usually a Hash), return directly
|
296
|
+
value
|
297
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
298
|
+
inner_type = Regexp.last_match[:inner_type]
|
299
|
+
value.map { |v| _deserialize(inner_type, v) }
|
300
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
301
|
+
k_type = Regexp.last_match[:k_type]
|
302
|
+
v_type = Regexp.last_match[:v_type]
|
303
|
+
{}.tap do |hash|
|
304
|
+
value.each do |k, v|
|
305
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
306
|
+
end
|
307
|
+
end
|
308
|
+
else # model
|
309
|
+
temp_model = GiphyClient.const_get(type).new
|
310
|
+
temp_model.build_from_hash(value)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
# Returns the string representation of the object
|
315
|
+
# @return [String] String presentation of the object
|
316
|
+
def to_s
|
317
|
+
to_hash.to_s
|
318
|
+
end
|
319
|
+
|
320
|
+
# to_body is an alias to to_hash (backward compatibility)
|
321
|
+
# @return [Hash] Returns the object in the form of hash
|
322
|
+
def to_body
|
323
|
+
to_hash
|
324
|
+
end
|
325
|
+
|
326
|
+
# Returns the object in the form of hash
|
327
|
+
# @return [Hash] Returns the object in the form of hash
|
328
|
+
def to_hash
|
329
|
+
hash = {}
|
330
|
+
self.class.attribute_map.each_pair do |attr, param|
|
331
|
+
value = self.send(attr)
|
332
|
+
next if value.nil?
|
333
|
+
hash[param] = _to_hash(value)
|
334
|
+
end
|
335
|
+
hash
|
336
|
+
end
|
337
|
+
|
338
|
+
# Outputs non-array value in the form of hash
|
339
|
+
# For object, use to_hash. Otherwise, just return the value
|
340
|
+
# @param [Object] value Any valid value
|
341
|
+
# @return [Hash] Returns the value in the form of hash
|
342
|
+
def _to_hash(value)
|
343
|
+
if value.is_a?(Array)
|
344
|
+
value.compact.map{ |v| _to_hash(v) }
|
345
|
+
elsif value.is_a?(Hash)
|
346
|
+
{}.tap do |hash|
|
347
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
348
|
+
end
|
349
|
+
elsif value.respond_to? :to_hash
|
350
|
+
value.to_hash
|
351
|
+
else
|
352
|
+
value
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
end
|
357
|
+
|
358
|
+
end
|
@@ -0,0 +1,218 @@
|
|
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 version of this GIF downsized to be under 2mb.
|
16
|
+
class GifImagesDownsized
|
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
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:'url' => :'url',
|
34
|
+
:'width' => :'width',
|
35
|
+
:'height' => :'height',
|
36
|
+
:'size' => :'size'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Attribute type mapping.
|
41
|
+
def self.swagger_types
|
42
|
+
{
|
43
|
+
:'url' => :'String',
|
44
|
+
:'width' => :'String',
|
45
|
+
:'height' => :'String',
|
46
|
+
:'size' => :'String'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
57
|
+
|
58
|
+
if attributes.has_key?(:'url')
|
59
|
+
self.url = attributes[:'url']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'width')
|
63
|
+
self.width = attributes[:'width']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes.has_key?(:'height')
|
67
|
+
self.height = attributes[:'height']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.has_key?(:'size')
|
71
|
+
self.size = attributes[:'size']
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
77
|
+
# @return Array for valid properies with the reasons
|
78
|
+
def list_invalid_properties
|
79
|
+
invalid_properties = Array.new
|
80
|
+
return invalid_properties
|
81
|
+
end
|
82
|
+
|
83
|
+
# Check to see if the all the properties in the model are valid
|
84
|
+
# @return true if the model is valid
|
85
|
+
def valid?
|
86
|
+
return true
|
87
|
+
end
|
88
|
+
|
89
|
+
# Checks equality by comparing each attribute.
|
90
|
+
# @param [Object] Object to be compared
|
91
|
+
def ==(o)
|
92
|
+
return true if self.equal?(o)
|
93
|
+
self.class == o.class &&
|
94
|
+
url == o.url &&
|
95
|
+
width == o.width &&
|
96
|
+
height == o.height &&
|
97
|
+
size == o.size
|
98
|
+
end
|
99
|
+
|
100
|
+
# @see the `==` method
|
101
|
+
# @param [Object] Object to be compared
|
102
|
+
def eql?(o)
|
103
|
+
self == o
|
104
|
+
end
|
105
|
+
|
106
|
+
# Calculates hash code according to all attributes.
|
107
|
+
# @return [Fixnum] Hash code
|
108
|
+
def hash
|
109
|
+
[url, width, height, size].hash
|
110
|
+
end
|
111
|
+
|
112
|
+
# Builds the object from hash
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
114
|
+
# @return [Object] Returns the model itself
|
115
|
+
def build_from_hash(attributes)
|
116
|
+
return nil unless attributes.is_a?(Hash)
|
117
|
+
self.class.swagger_types.each_pair do |key, type|
|
118
|
+
if type =~ /\AArray<(.*)>/i
|
119
|
+
# check to ensure the input is an array given that the the attribute
|
120
|
+
# is documented as an array but the input is not
|
121
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
122
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
123
|
+
end
|
124
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
125
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
126
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
127
|
+
end
|
128
|
+
|
129
|
+
self
|
130
|
+
end
|
131
|
+
|
132
|
+
# Deserializes the data based on type
|
133
|
+
# @param string type Data type
|
134
|
+
# @param string value Value to be deserialized
|
135
|
+
# @return [Object] Deserialized data
|
136
|
+
def _deserialize(type, value)
|
137
|
+
case type.to_sym
|
138
|
+
when :DateTime
|
139
|
+
DateTime.parse(value)
|
140
|
+
when :Date
|
141
|
+
Date.parse(value)
|
142
|
+
when :String
|
143
|
+
value.to_s
|
144
|
+
when :Integer
|
145
|
+
value.to_i
|
146
|
+
when :Float
|
147
|
+
value.to_f
|
148
|
+
when :BOOLEAN
|
149
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
150
|
+
true
|
151
|
+
else
|
152
|
+
false
|
153
|
+
end
|
154
|
+
when :Object
|
155
|
+
# generic object (usually a Hash), return directly
|
156
|
+
value
|
157
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
158
|
+
inner_type = Regexp.last_match[:inner_type]
|
159
|
+
value.map { |v| _deserialize(inner_type, v) }
|
160
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
161
|
+
k_type = Regexp.last_match[:k_type]
|
162
|
+
v_type = Regexp.last_match[:v_type]
|
163
|
+
{}.tap do |hash|
|
164
|
+
value.each do |k, v|
|
165
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
else # model
|
169
|
+
temp_model = GiphyClient.const_get(type).new
|
170
|
+
temp_model.build_from_hash(value)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
# Returns the string representation of the object
|
175
|
+
# @return [String] String presentation of the object
|
176
|
+
def to_s
|
177
|
+
to_hash.to_s
|
178
|
+
end
|
179
|
+
|
180
|
+
# to_body is an alias to to_hash (backward compatibility)
|
181
|
+
# @return [Hash] Returns the object in the form of hash
|
182
|
+
def to_body
|
183
|
+
to_hash
|
184
|
+
end
|
185
|
+
|
186
|
+
# Returns the object in the form of hash
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
188
|
+
def to_hash
|
189
|
+
hash = {}
|
190
|
+
self.class.attribute_map.each_pair do |attr, param|
|
191
|
+
value = self.send(attr)
|
192
|
+
next if value.nil?
|
193
|
+
hash[param] = _to_hash(value)
|
194
|
+
end
|
195
|
+
hash
|
196
|
+
end
|
197
|
+
|
198
|
+
# Outputs non-array value in the form of hash
|
199
|
+
# For object, use to_hash. Otherwise, just return the value
|
200
|
+
# @param [Object] value Any valid value
|
201
|
+
# @return [Hash] Returns the value in the form of hash
|
202
|
+
def _to_hash(value)
|
203
|
+
if value.is_a?(Array)
|
204
|
+
value.compact.map{ |v| _to_hash(v) }
|
205
|
+
elsif value.is_a?(Hash)
|
206
|
+
{}.tap do |hash|
|
207
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
208
|
+
end
|
209
|
+
elsif value.respond_to? :to_hash
|
210
|
+
value.to_hash
|
211
|
+
else
|
212
|
+
value
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|