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,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
+
16
+ class Pagination
17
+ # Position in pagination.
18
+ attr_accessor :offset
19
+
20
+ # Total number of items available.
21
+ attr_accessor :total_count
22
+
23
+ # Total number of items returned.
24
+ attr_accessor :count
25
+
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'offset' => :'offset',
31
+ :'total_count' => :'total_count',
32
+ :'count' => :'count'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ :'offset' => :'Integer',
40
+ :'total_count' => :'Integer',
41
+ :'count' => :'Integer'
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?(:'offset')
54
+ self.offset = attributes[:'offset']
55
+ end
56
+
57
+ if attributes.has_key?(:'total_count')
58
+ self.total_count = attributes[:'total_count']
59
+ end
60
+
61
+ if attributes.has_key?(:'count')
62
+ self.count = attributes[:'count']
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
+ offset == o.offset &&
86
+ total_count == o.total_count &&
87
+ count == o.count
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
+ [offset, total_count, count].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,401 @@
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 that describes GIFs returned by the query.
16
+ class RandomGif
17
+ # By default, this is almost always gif
18
+ attr_accessor :type
19
+
20
+ # This GIF's unique ID
21
+ attr_accessor :id
22
+
23
+ # The URL for this preview GIF.
24
+ attr_accessor :url
25
+
26
+ # The URL for the original preview GIF.
27
+ attr_accessor :image_original_url
28
+
29
+ # The URL for this preview GIF.
30
+ attr_accessor :image_url
31
+
32
+ # The URL for this preview GIF.
33
+ attr_accessor :image_mp4_url
34
+
35
+ # The number of frames in this GIF.
36
+ attr_accessor :image_frames
37
+
38
+ # The width of this GIF.
39
+ attr_accessor :image_width
40
+
41
+ # The height of this GIF.
42
+ attr_accessor :image_height
43
+
44
+ # A version of this GIF with a fixed height of 200 pixels and the number of frames reduced to 6.
45
+ attr_accessor :fixed_height_downsampled_url
46
+
47
+ attr_accessor :fixed_height_downsampled_width
48
+
49
+ attr_accessor :fixed_height_downsampled_height
50
+
51
+ # A version of this GIF with a fixed width of 200 pixels and the number of frames reduced to 6.
52
+ attr_accessor :fixed_width_downsampled_url
53
+
54
+ attr_accessor :fixed_width_downsampled_width
55
+
56
+ attr_accessor :fixed_width_downsampled_height
57
+
58
+ # A version of this GIF with a fixed height of 100 pixels and the number of frames reduced to 6.
59
+ attr_accessor :fixed_height_small_url
60
+
61
+ # A still version of this gif.
62
+ attr_accessor :fixed_height_small_still_url
63
+
64
+ attr_accessor :fixed_height_small_width
65
+
66
+ attr_accessor :fixed_height_small_height
67
+
68
+ attr_accessor :fixed_width_small_url
69
+
70
+ # A still version of this GIF with a fixed width of 100 pixels.
71
+ attr_accessor :fixed_width_small_still_url
72
+
73
+ attr_accessor :fixed_width_small_width
74
+
75
+ attr_accessor :fixed_width_small_height
76
+
77
+
78
+ # Attribute mapping from ruby-style variable name to JSON key.
79
+ def self.attribute_map
80
+ {
81
+ :'type' => :'type',
82
+ :'id' => :'id',
83
+ :'url' => :'url',
84
+ :'image_original_url' => :'image_original_url',
85
+ :'image_url' => :'image_url',
86
+ :'image_mp4_url' => :'image_mp4_url',
87
+ :'image_frames' => :'image_frames',
88
+ :'image_width' => :'image_width',
89
+ :'image_height' => :'image_height',
90
+ :'fixed_height_downsampled_url' => :'fixed_height_downsampled_url',
91
+ :'fixed_height_downsampled_width' => :'fixed_height_downsampled_width',
92
+ :'fixed_height_downsampled_height' => :'fixed_height_downsampled_height',
93
+ :'fixed_width_downsampled_url' => :'fixed_width_downsampled_url',
94
+ :'fixed_width_downsampled_width' => :'fixed_width_downsampled_width',
95
+ :'fixed_width_downsampled_height' => :'fixed_width_downsampled_height',
96
+ :'fixed_height_small_url' => :'fixed_height_small_url',
97
+ :'fixed_height_small_still_url' => :'fixed_height_small_still_url',
98
+ :'fixed_height_small_width' => :'fixed_height_small_width',
99
+ :'fixed_height_small_height' => :'fixed_height_small_height',
100
+ :'fixed_width_small_url' => :'fixed_width_small_url',
101
+ :'fixed_width_small_still_url' => :'fixed_width_small_still_url',
102
+ :'fixed_width_small_width' => :'fixed_width_small_width',
103
+ :'fixed_width_small_height' => :'fixed_width_small_height'
104
+ }
105
+ end
106
+
107
+ # Attribute type mapping.
108
+ def self.swagger_types
109
+ {
110
+ :'type' => :'String',
111
+ :'id' => :'String',
112
+ :'url' => :'String',
113
+ :'image_original_url' => :'String',
114
+ :'image_url' => :'String',
115
+ :'image_mp4_url' => :'String',
116
+ :'image_frames' => :'String',
117
+ :'image_width' => :'String',
118
+ :'image_height' => :'String',
119
+ :'fixed_height_downsampled_url' => :'String',
120
+ :'fixed_height_downsampled_width' => :'String',
121
+ :'fixed_height_downsampled_height' => :'String',
122
+ :'fixed_width_downsampled_url' => :'String',
123
+ :'fixed_width_downsampled_width' => :'String',
124
+ :'fixed_width_downsampled_height' => :'String',
125
+ :'fixed_height_small_url' => :'String',
126
+ :'fixed_height_small_still_url' => :'String',
127
+ :'fixed_height_small_width' => :'String',
128
+ :'fixed_height_small_height' => :'String',
129
+ :'fixed_width_small_url' => :'String',
130
+ :'fixed_width_small_still_url' => :'String',
131
+ :'fixed_width_small_width' => :'String',
132
+ :'fixed_width_small_height' => :'String'
133
+ }
134
+ end
135
+
136
+ # Initializes the object
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ def initialize(attributes = {})
139
+ return unless attributes.is_a?(Hash)
140
+
141
+ # convert string to symbol for hash key
142
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
143
+
144
+ if attributes.has_key?(:'type')
145
+ self.type = attributes[:'type']
146
+ else
147
+ self.type = "gif"
148
+ end
149
+
150
+ if attributes.has_key?(:'id')
151
+ self.id = attributes[:'id']
152
+ end
153
+
154
+ if attributes.has_key?(:'url')
155
+ self.url = attributes[:'url']
156
+ end
157
+
158
+ if attributes.has_key?(:'image_original_url')
159
+ self.image_original_url = attributes[:'image_original_url']
160
+ end
161
+
162
+ if attributes.has_key?(:'image_url')
163
+ self.image_url = attributes[:'image_url']
164
+ end
165
+
166
+ if attributes.has_key?(:'image_mp4_url')
167
+ self.image_mp4_url = attributes[:'image_mp4_url']
168
+ end
169
+
170
+ if attributes.has_key?(:'image_frames')
171
+ self.image_frames = attributes[:'image_frames']
172
+ end
173
+
174
+ if attributes.has_key?(:'image_width')
175
+ self.image_width = attributes[:'image_width']
176
+ end
177
+
178
+ if attributes.has_key?(:'image_height')
179
+ self.image_height = attributes[:'image_height']
180
+ end
181
+
182
+ if attributes.has_key?(:'fixed_height_downsampled_url')
183
+ self.fixed_height_downsampled_url = attributes[:'fixed_height_downsampled_url']
184
+ end
185
+
186
+ if attributes.has_key?(:'fixed_height_downsampled_width')
187
+ self.fixed_height_downsampled_width = attributes[:'fixed_height_downsampled_width']
188
+ end
189
+
190
+ if attributes.has_key?(:'fixed_height_downsampled_height')
191
+ self.fixed_height_downsampled_height = attributes[:'fixed_height_downsampled_height']
192
+ end
193
+
194
+ if attributes.has_key?(:'fixed_width_downsampled_url')
195
+ self.fixed_width_downsampled_url = attributes[:'fixed_width_downsampled_url']
196
+ end
197
+
198
+ if attributes.has_key?(:'fixed_width_downsampled_width')
199
+ self.fixed_width_downsampled_width = attributes[:'fixed_width_downsampled_width']
200
+ end
201
+
202
+ if attributes.has_key?(:'fixed_width_downsampled_height')
203
+ self.fixed_width_downsampled_height = attributes[:'fixed_width_downsampled_height']
204
+ end
205
+
206
+ if attributes.has_key?(:'fixed_height_small_url')
207
+ self.fixed_height_small_url = attributes[:'fixed_height_small_url']
208
+ end
209
+
210
+ if attributes.has_key?(:'fixed_height_small_still_url')
211
+ self.fixed_height_small_still_url = attributes[:'fixed_height_small_still_url']
212
+ end
213
+
214
+ if attributes.has_key?(:'fixed_height_small_width')
215
+ self.fixed_height_small_width = attributes[:'fixed_height_small_width']
216
+ end
217
+
218
+ if attributes.has_key?(:'fixed_height_small_height')
219
+ self.fixed_height_small_height = attributes[:'fixed_height_small_height']
220
+ end
221
+
222
+ if attributes.has_key?(:'fixed_width_small_url')
223
+ self.fixed_width_small_url = attributes[:'fixed_width_small_url']
224
+ end
225
+
226
+ if attributes.has_key?(:'fixed_width_small_still_url')
227
+ self.fixed_width_small_still_url = attributes[:'fixed_width_small_still_url']
228
+ end
229
+
230
+ if attributes.has_key?(:'fixed_width_small_width')
231
+ self.fixed_width_small_width = attributes[:'fixed_width_small_width']
232
+ end
233
+
234
+ if attributes.has_key?(:'fixed_width_small_height')
235
+ self.fixed_width_small_height = attributes[:'fixed_width_small_height']
236
+ end
237
+
238
+ end
239
+
240
+ # Show invalid properties with the reasons. Usually used together with valid?
241
+ # @return Array for valid properies with the reasons
242
+ def list_invalid_properties
243
+ invalid_properties = Array.new
244
+ return invalid_properties
245
+ end
246
+
247
+ # Check to see if the all the properties in the model are valid
248
+ # @return true if the model is valid
249
+ def valid?
250
+ return true
251
+ end
252
+
253
+ # Checks equality by comparing each attribute.
254
+ # @param [Object] Object to be compared
255
+ def ==(o)
256
+ return true if self.equal?(o)
257
+ self.class == o.class &&
258
+ type == o.type &&
259
+ id == o.id &&
260
+ url == o.url &&
261
+ image_original_url == o.image_original_url &&
262
+ image_url == o.image_url &&
263
+ image_mp4_url == o.image_mp4_url &&
264
+ image_frames == o.image_frames &&
265
+ image_width == o.image_width &&
266
+ image_height == o.image_height &&
267
+ fixed_height_downsampled_url == o.fixed_height_downsampled_url &&
268
+ fixed_height_downsampled_width == o.fixed_height_downsampled_width &&
269
+ fixed_height_downsampled_height == o.fixed_height_downsampled_height &&
270
+ fixed_width_downsampled_url == o.fixed_width_downsampled_url &&
271
+ fixed_width_downsampled_width == o.fixed_width_downsampled_width &&
272
+ fixed_width_downsampled_height == o.fixed_width_downsampled_height &&
273
+ fixed_height_small_url == o.fixed_height_small_url &&
274
+ fixed_height_small_still_url == o.fixed_height_small_still_url &&
275
+ fixed_height_small_width == o.fixed_height_small_width &&
276
+ fixed_height_small_height == o.fixed_height_small_height &&
277
+ fixed_width_small_url == o.fixed_width_small_url &&
278
+ fixed_width_small_still_url == o.fixed_width_small_still_url &&
279
+ fixed_width_small_width == o.fixed_width_small_width &&
280
+ fixed_width_small_height == o.fixed_width_small_height
281
+ end
282
+
283
+ # @see the `==` method
284
+ # @param [Object] Object to be compared
285
+ def eql?(o)
286
+ self == o
287
+ end
288
+
289
+ # Calculates hash code according to all attributes.
290
+ # @return [Fixnum] Hash code
291
+ def hash
292
+ [type, id, url, image_original_url, image_url, image_mp4_url, image_frames, image_width, image_height, fixed_height_downsampled_url, fixed_height_downsampled_width, fixed_height_downsampled_height, fixed_width_downsampled_url, fixed_width_downsampled_width, fixed_width_downsampled_height, fixed_height_small_url, fixed_height_small_still_url, fixed_height_small_width, fixed_height_small_height, fixed_width_small_url, fixed_width_small_still_url, fixed_width_small_width, fixed_width_small_height].hash
293
+ end
294
+
295
+ # Builds the object from hash
296
+ # @param [Hash] attributes Model attributes in the form of hash
297
+ # @return [Object] Returns the model itself
298
+ def build_from_hash(attributes)
299
+ return nil unless attributes.is_a?(Hash)
300
+ self.class.swagger_types.each_pair do |key, type|
301
+ if type =~ /\AArray<(.*)>/i
302
+ # check to ensure the input is an array given that the the attribute
303
+ # is documented as an array but the input is not
304
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
305
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
306
+ end
307
+ elsif !attributes[self.class.attribute_map[key]].nil?
308
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
309
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
310
+ end
311
+
312
+ self
313
+ end
314
+
315
+ # Deserializes the data based on type
316
+ # @param string type Data type
317
+ # @param string value Value to be deserialized
318
+ # @return [Object] Deserialized data
319
+ def _deserialize(type, value)
320
+ case type.to_sym
321
+ when :DateTime
322
+ DateTime.parse(value)
323
+ when :Date
324
+ Date.parse(value)
325
+ when :String
326
+ value.to_s
327
+ when :Integer
328
+ value.to_i
329
+ when :Float
330
+ value.to_f
331
+ when :BOOLEAN
332
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
333
+ true
334
+ else
335
+ false
336
+ end
337
+ when :Object
338
+ # generic object (usually a Hash), return directly
339
+ value
340
+ when /\AArray<(?<inner_type>.+)>\z/
341
+ inner_type = Regexp.last_match[:inner_type]
342
+ value.map { |v| _deserialize(inner_type, v) }
343
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
344
+ k_type = Regexp.last_match[:k_type]
345
+ v_type = Regexp.last_match[:v_type]
346
+ {}.tap do |hash|
347
+ value.each do |k, v|
348
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
349
+ end
350
+ end
351
+ else # model
352
+ temp_model = GiphyClient.const_get(type).new
353
+ temp_model.build_from_hash(value)
354
+ end
355
+ end
356
+
357
+ # Returns the string representation of the object
358
+ # @return [String] String presentation of the object
359
+ def to_s
360
+ to_hash.to_s
361
+ end
362
+
363
+ # to_body is an alias to to_hash (backward compatibility)
364
+ # @return [Hash] Returns the object in the form of hash
365
+ def to_body
366
+ to_hash
367
+ end
368
+
369
+ # Returns the object in the form of hash
370
+ # @return [Hash] Returns the object in the form of hash
371
+ def to_hash
372
+ hash = {}
373
+ self.class.attribute_map.each_pair do |attr, param|
374
+ value = self.send(attr)
375
+ next if value.nil?
376
+ hash[param] = _to_hash(value)
377
+ end
378
+ hash
379
+ end
380
+
381
+ # Outputs non-array value in the form of hash
382
+ # For object, use to_hash. Otherwise, just return the value
383
+ # @param [Object] value Any valid value
384
+ # @return [Hash] Returns the value in the form of hash
385
+ def _to_hash(value)
386
+ if value.is_a?(Array)
387
+ value.compact.map{ |v| _to_hash(v) }
388
+ elsif value.is_a?(Hash)
389
+ {}.tap do |hash|
390
+ value.each { |k, v| hash[k] = _to_hash(v) }
391
+ end
392
+ elsif value.respond_to? :to_hash
393
+ value.to_hash
394
+ else
395
+ value
396
+ end
397
+ end
398
+
399
+ end
400
+
401
+ end