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,198 @@
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 ChannelWithChildrenModelChildren
17
+ attr_accessor :data
18
+
19
+ attr_accessor :pagination
20
+
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'data' => :'data',
26
+ :'pagination' => :'pagination'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.swagger_types
32
+ {
33
+ :'data' => :'Array<LastChildModel>',
34
+ :'pagination' => :'Pagination'
35
+ }
36
+ end
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ def initialize(attributes = {})
41
+ return unless attributes.is_a?(Hash)
42
+
43
+ # convert string to symbol for hash key
44
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
45
+
46
+ if attributes.has_key?(:'data')
47
+ if (value = attributes[:'data']).is_a?(Array)
48
+ self.data = value
49
+ end
50
+ end
51
+
52
+ if attributes.has_key?(:'pagination')
53
+ self.pagination = attributes[:'pagination']
54
+ end
55
+
56
+ end
57
+
58
+ # Show invalid properties with the reasons. Usually used together with valid?
59
+ # @return Array for valid properies with the reasons
60
+ def list_invalid_properties
61
+ invalid_properties = Array.new
62
+ return invalid_properties
63
+ end
64
+
65
+ # Check to see if the all the properties in the model are valid
66
+ # @return true if the model is valid
67
+ def valid?
68
+ return true
69
+ end
70
+
71
+ # Checks equality by comparing each attribute.
72
+ # @param [Object] Object to be compared
73
+ def ==(o)
74
+ return true if self.equal?(o)
75
+ self.class == o.class &&
76
+ data == o.data &&
77
+ pagination == o.pagination
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(o)
83
+ self == o
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Fixnum] Hash code
88
+ def hash
89
+ [data, pagination].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def build_from_hash(attributes)
96
+ return nil unless attributes.is_a?(Hash)
97
+ self.class.swagger_types.each_pair do |key, type|
98
+ if type =~ /\AArray<(.*)>/i
99
+ # check to ensure the input is an array given that the the attribute
100
+ # is documented as an array but the input is not
101
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
102
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
103
+ end
104
+ elsif !attributes[self.class.attribute_map[key]].nil?
105
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
106
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
107
+ end
108
+
109
+ self
110
+ end
111
+
112
+ # Deserializes the data based on type
113
+ # @param string type Data type
114
+ # @param string value Value to be deserialized
115
+ # @return [Object] Deserialized data
116
+ def _deserialize(type, value)
117
+ case type.to_sym
118
+ when :DateTime
119
+ DateTime.parse(value)
120
+ when :Date
121
+ Date.parse(value)
122
+ when :String
123
+ value.to_s
124
+ when :Integer
125
+ value.to_i
126
+ when :Float
127
+ value.to_f
128
+ when :BOOLEAN
129
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
130
+ true
131
+ else
132
+ false
133
+ end
134
+ when :Object
135
+ # generic object (usually a Hash), return directly
136
+ value
137
+ when /\AArray<(?<inner_type>.+)>\z/
138
+ inner_type = Regexp.last_match[:inner_type]
139
+ value.map { |v| _deserialize(inner_type, v) }
140
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
141
+ k_type = Regexp.last_match[:k_type]
142
+ v_type = Regexp.last_match[:v_type]
143
+ {}.tap do |hash|
144
+ value.each do |k, v|
145
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
146
+ end
147
+ end
148
+ else # model
149
+ temp_model = GiphyClient.const_get(type).new
150
+ temp_model.build_from_hash(value)
151
+ end
152
+ end
153
+
154
+ # Returns the string representation of the object
155
+ # @return [String] String presentation of the object
156
+ def to_s
157
+ to_hash.to_s
158
+ end
159
+
160
+ # to_body is an alias to to_hash (backward compatibility)
161
+ # @return [Hash] Returns the object in the form of hash
162
+ def to_body
163
+ to_hash
164
+ end
165
+
166
+ # Returns the object in the form of hash
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_hash
169
+ hash = {}
170
+ self.class.attribute_map.each_pair do |attr, param|
171
+ value = self.send(attr)
172
+ next if value.nil?
173
+ hash[param] = _to_hash(value)
174
+ end
175
+ hash
176
+ end
177
+
178
+ # Outputs non-array value in the form of hash
179
+ # For object, use to_hash. Otherwise, just return the value
180
+ # @param [Object] value Any valid value
181
+ # @return [Hash] Returns the value in the form of hash
182
+ def _to_hash(value)
183
+ if value.is_a?(Array)
184
+ value.compact.map{ |v| _to_hash(v) }
185
+ elsif value.is_a?(Hash)
186
+ {}.tap do |hash|
187
+ value.each { |k, v| hash[k] = _to_hash(v) }
188
+ end
189
+ elsif value.respond_to? :to_hash
190
+ value.to_hash
191
+ else
192
+ value
193
+ end
194
+ end
195
+
196
+ end
197
+
198
+ end
@@ -0,0 +1,473 @@
1
+ =begin
2
+ #giphy-api
3
+
4
+ #Giphy's public api.
5
+
6
+ OpenAPI spec version: 0.9.3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module GiphyClient
15
+ # An object containing data that describes GIFs returned by the query.
16
+ class Gif
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 unique slug used in this GIF's URL
24
+ attr_accessor :slug
25
+
26
+ # The unique URL for this GIF
27
+ attr_accessor :url
28
+
29
+ # The unique bit.ly URL for this GIF
30
+ attr_accessor :bitly_gif_url
31
+
32
+ # The unique bit.ly URL for this GIF
33
+ attr_accessor :bitly_url
34
+
35
+ # A URL used for embedding this GIF
36
+ attr_accessor :embed_url
37
+
38
+ # The username this GIF is attached to, if applicable
39
+ attr_accessor :username
40
+
41
+ # The page on which this GIF was found
42
+ attr_accessor :source
43
+
44
+ # The MPAA-style rating for this content. Examples include Y, G, PG, PG-13 and R
45
+ attr_accessor :rating
46
+
47
+ # Currently unused
48
+ attr_accessor :content_url
49
+
50
+ # An array of tags for this GIF (Note\\: Not available when using the Public Beta Key)
51
+ attr_accessor :tags
52
+
53
+ # An array of featured tags for this GIF (Note\\: Not available when using the Public Beta Key)
54
+ attr_accessor :featured_tags
55
+
56
+ # An object containing data about the user associated with this GIF, if applicable.
57
+ attr_accessor :user
58
+
59
+ # The top level domain of the source URL.
60
+ attr_accessor :source_tld
61
+
62
+ # The URL of the webpage on which this GIF was found.
63
+ attr_accessor :source_post_url
64
+
65
+ # Denotes whether or not this GIF is private.
66
+ attr_accessor :is_hidden
67
+
68
+ # Denotes whether or not this GIF has been deleted.
69
+ attr_accessor :is_removed
70
+
71
+ # Denotes whether or not this GIF has been uploaded by a GIPHY user.
72
+ attr_accessor :is_community
73
+
74
+ # Denotes whether or not this GIF has been uploaded to GIPHY by an anonymous user.
75
+ attr_accessor :is_anonymous
76
+
77
+ # Denotes whether or not this GIF is featured on giphy.com (deprecated).
78
+ attr_accessor :is_featured
79
+
80
+ # Denotes whether or not this GIF has been sourced from a realtime crawl.
81
+ attr_accessor :is_realtime
82
+
83
+ # Denotes whether or not this GIF is indexable.
84
+ attr_accessor :is_indexable
85
+
86
+ # Denotes whether this GIF is a sticker (has a transparent background).
87
+ attr_accessor :is_sticker
88
+
89
+ # The date on which this GIF was last updated.
90
+ attr_accessor :update_datetime
91
+
92
+ # The date this GIF was added to the GIPHY database.
93
+ attr_accessor :create_datetime
94
+
95
+ # The creation or upload date from this GIF's source.
96
+ attr_accessor :import_datetime
97
+
98
+ # The date on which this gif was marked trending, if applicable.
99
+ attr_accessor :trending_datetime
100
+
101
+ attr_accessor :images
102
+
103
+
104
+ # Attribute mapping from ruby-style variable name to JSON key.
105
+ def self.attribute_map
106
+ {
107
+ :'type' => :'type',
108
+ :'id' => :'id',
109
+ :'slug' => :'slug',
110
+ :'url' => :'url',
111
+ :'bitly_gif_url' => :'bitly_gif_url',
112
+ :'bitly_url' => :'bitly_url',
113
+ :'embed_url' => :'embed_url',
114
+ :'username' => :'username',
115
+ :'source' => :'source',
116
+ :'rating' => :'rating',
117
+ :'content_url' => :'content_url',
118
+ :'tags' => :'tags',
119
+ :'featured_tags' => :'featured_tags',
120
+ :'user' => :'user',
121
+ :'source_tld' => :'source_tld',
122
+ :'source_post_url' => :'source_post_url',
123
+ :'is_hidden' => :'is_hidden',
124
+ :'is_removed' => :'is_removed',
125
+ :'is_community' => :'is_community',
126
+ :'is_anonymous' => :'is_anonymous',
127
+ :'is_featured' => :'is_featured',
128
+ :'is_realtime' => :'is_realtime',
129
+ :'is_indexable' => :'is_indexable',
130
+ :'is_sticker' => :'is_sticker',
131
+ :'update_datetime' => :'update_datetime',
132
+ :'create_datetime' => :'create_datetime',
133
+ :'import_datetime' => :'import_datetime',
134
+ :'trending_datetime' => :'trending_datetime',
135
+ :'images' => :'images'
136
+ }
137
+ end
138
+
139
+ # Attribute type mapping.
140
+ def self.swagger_types
141
+ {
142
+ :'type' => :'String',
143
+ :'id' => :'String',
144
+ :'slug' => :'String',
145
+ :'url' => :'String',
146
+ :'bitly_gif_url' => :'String',
147
+ :'bitly_url' => :'String',
148
+ :'embed_url' => :'String',
149
+ :'username' => :'String',
150
+ :'source' => :'String',
151
+ :'rating' => :'String',
152
+ :'content_url' => :'String',
153
+ :'tags' => :'Array<String>',
154
+ :'featured_tags' => :'Array<String>',
155
+ :'user' => :'User',
156
+ :'source_tld' => :'String',
157
+ :'source_post_url' => :'String',
158
+ :'is_hidden' => :'BOOLEAN',
159
+ :'is_removed' => :'BOOLEAN',
160
+ :'is_community' => :'BOOLEAN',
161
+ :'is_anonymous' => :'BOOLEAN',
162
+ :'is_featured' => :'BOOLEAN',
163
+ :'is_realtime' => :'BOOLEAN',
164
+ :'is_indexable' => :'BOOLEAN',
165
+ :'is_sticker' => :'BOOLEAN',
166
+ :'update_datetime' => :'String',
167
+ :'create_datetime' => :'String',
168
+ :'import_datetime' => :'String',
169
+ :'trending_datetime' => :'String',
170
+ :'images' => :'GifImages'
171
+ }
172
+ end
173
+
174
+ # Initializes the object
175
+ # @param [Hash] attributes Model attributes in the form of hash
176
+ def initialize(attributes = {})
177
+ return unless attributes.is_a?(Hash)
178
+
179
+ # convert string to symbol for hash key
180
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
181
+
182
+ if attributes.has_key?(:'type')
183
+ self.type = attributes[:'type']
184
+ else
185
+ self.type = "gif"
186
+ end
187
+
188
+ if attributes.has_key?(:'id')
189
+ self.id = attributes[:'id']
190
+ end
191
+
192
+ if attributes.has_key?(:'slug')
193
+ self.slug = attributes[:'slug']
194
+ end
195
+
196
+ if attributes.has_key?(:'url')
197
+ self.url = attributes[:'url']
198
+ end
199
+
200
+ if attributes.has_key?(:'bitly_gif_url')
201
+ self.bitly_gif_url = attributes[:'bitly_gif_url']
202
+ end
203
+
204
+ if attributes.has_key?(:'bitly_url')
205
+ self.bitly_url = attributes[:'bitly_url']
206
+ end
207
+
208
+ if attributes.has_key?(:'embed_url')
209
+ self.embed_url = attributes[:'embed_url']
210
+ end
211
+
212
+ if attributes.has_key?(:'username')
213
+ self.username = attributes[:'username']
214
+ end
215
+
216
+ if attributes.has_key?(:'source')
217
+ self.source = attributes[:'source']
218
+ end
219
+
220
+ if attributes.has_key?(:'rating')
221
+ self.rating = attributes[:'rating']
222
+ end
223
+
224
+ if attributes.has_key?(:'content_url')
225
+ self.content_url = attributes[:'content_url']
226
+ end
227
+
228
+ if attributes.has_key?(:'tags')
229
+ if (value = attributes[:'tags']).is_a?(Array)
230
+ self.tags = value
231
+ end
232
+ end
233
+
234
+ if attributes.has_key?(:'featured_tags')
235
+ if (value = attributes[:'featured_tags']).is_a?(Array)
236
+ self.featured_tags = value
237
+ end
238
+ end
239
+
240
+ if attributes.has_key?(:'user')
241
+ self.user = attributes[:'user']
242
+ end
243
+
244
+ if attributes.has_key?(:'source_tld')
245
+ self.source_tld = attributes[:'source_tld']
246
+ end
247
+
248
+ if attributes.has_key?(:'source_post_url')
249
+ self.source_post_url = attributes[:'source_post_url']
250
+ end
251
+
252
+ if attributes.has_key?(:'is_hidden')
253
+ self.is_hidden = attributes[:'is_hidden']
254
+ end
255
+
256
+ if attributes.has_key?(:'is_removed')
257
+ self.is_removed = attributes[:'is_removed']
258
+ end
259
+
260
+ if attributes.has_key?(:'is_community')
261
+ self.is_community = attributes[:'is_community']
262
+ end
263
+
264
+ if attributes.has_key?(:'is_anonymous')
265
+ self.is_anonymous = attributes[:'is_anonymous']
266
+ end
267
+
268
+ if attributes.has_key?(:'is_featured')
269
+ self.is_featured = attributes[:'is_featured']
270
+ end
271
+
272
+ if attributes.has_key?(:'is_realtime')
273
+ self.is_realtime = attributes[:'is_realtime']
274
+ end
275
+
276
+ if attributes.has_key?(:'is_indexable')
277
+ self.is_indexable = attributes[:'is_indexable']
278
+ end
279
+
280
+ if attributes.has_key?(:'is_sticker')
281
+ self.is_sticker = attributes[:'is_sticker']
282
+ end
283
+
284
+ if attributes.has_key?(:'update_datetime')
285
+ self.update_datetime = attributes[:'update_datetime']
286
+ end
287
+
288
+ if attributes.has_key?(:'create_datetime')
289
+ self.create_datetime = attributes[:'create_datetime']
290
+ end
291
+
292
+ if attributes.has_key?(:'import_datetime')
293
+ self.import_datetime = attributes[:'import_datetime']
294
+ end
295
+
296
+ if attributes.has_key?(:'trending_datetime')
297
+ self.trending_datetime = attributes[:'trending_datetime']
298
+ end
299
+
300
+ if attributes.has_key?(:'images')
301
+ self.images = attributes[:'images']
302
+ end
303
+
304
+ end
305
+
306
+ # Show invalid properties with the reasons. Usually used together with valid?
307
+ # @return Array for valid properies with the reasons
308
+ def list_invalid_properties
309
+ invalid_properties = Array.new
310
+ return invalid_properties
311
+ end
312
+
313
+ # Check to see if the all the properties in the model are valid
314
+ # @return true if the model is valid
315
+ def valid?
316
+ return true
317
+ end
318
+
319
+ # Checks equality by comparing each attribute.
320
+ # @param [Object] Object to be compared
321
+ def ==(o)
322
+ return true if self.equal?(o)
323
+ self.class == o.class &&
324
+ type == o.type &&
325
+ id == o.id &&
326
+ slug == o.slug &&
327
+ url == o.url &&
328
+ bitly_gif_url == o.bitly_gif_url &&
329
+ bitly_url == o.bitly_url &&
330
+ embed_url == o.embed_url &&
331
+ username == o.username &&
332
+ source == o.source &&
333
+ rating == o.rating &&
334
+ content_url == o.content_url &&
335
+ tags == o.tags &&
336
+ featured_tags == o.featured_tags &&
337
+ user == o.user &&
338
+ source_tld == o.source_tld &&
339
+ source_post_url == o.source_post_url &&
340
+ is_hidden == o.is_hidden &&
341
+ is_removed == o.is_removed &&
342
+ is_community == o.is_community &&
343
+ is_anonymous == o.is_anonymous &&
344
+ is_featured == o.is_featured &&
345
+ is_realtime == o.is_realtime &&
346
+ is_indexable == o.is_indexable &&
347
+ is_sticker == o.is_sticker &&
348
+ update_datetime == o.update_datetime &&
349
+ create_datetime == o.create_datetime &&
350
+ import_datetime == o.import_datetime &&
351
+ trending_datetime == o.trending_datetime &&
352
+ images == o.images
353
+ end
354
+
355
+ # @see the `==` method
356
+ # @param [Object] Object to be compared
357
+ def eql?(o)
358
+ self == o
359
+ end
360
+
361
+ # Calculates hash code according to all attributes.
362
+ # @return [Fixnum] Hash code
363
+ def hash
364
+ [type, id, slug, url, bitly_gif_url, bitly_url, embed_url, username, source, rating, content_url, tags, featured_tags, user, source_tld, source_post_url, is_hidden, is_removed, is_community, is_anonymous, is_featured, is_realtime, is_indexable, is_sticker, update_datetime, create_datetime, import_datetime, trending_datetime, images].hash
365
+ end
366
+
367
+ # Builds the object from hash
368
+ # @param [Hash] attributes Model attributes in the form of hash
369
+ # @return [Object] Returns the model itself
370
+ def build_from_hash(attributes)
371
+ return nil unless attributes.is_a?(Hash)
372
+ self.class.swagger_types.each_pair do |key, type|
373
+ if type =~ /\AArray<(.*)>/i
374
+ # check to ensure the input is an array given that the the attribute
375
+ # is documented as an array but the input is not
376
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
377
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
378
+ end
379
+ elsif !attributes[self.class.attribute_map[key]].nil?
380
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
381
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
382
+ end
383
+
384
+ self
385
+ end
386
+
387
+ # Deserializes the data based on type
388
+ # @param string type Data type
389
+ # @param string value Value to be deserialized
390
+ # @return [Object] Deserialized data
391
+ def _deserialize(type, value)
392
+ case type.to_sym
393
+ when :DateTime
394
+ DateTime.parse(value)
395
+ when :Date
396
+ Date.parse(value)
397
+ when :String
398
+ value.to_s
399
+ when :Integer
400
+ value.to_i
401
+ when :Float
402
+ value.to_f
403
+ when :BOOLEAN
404
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
405
+ true
406
+ else
407
+ false
408
+ end
409
+ when :Object
410
+ # generic object (usually a Hash), return directly
411
+ value
412
+ when /\AArray<(?<inner_type>.+)>\z/
413
+ inner_type = Regexp.last_match[:inner_type]
414
+ value.map { |v| _deserialize(inner_type, v) }
415
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
416
+ k_type = Regexp.last_match[:k_type]
417
+ v_type = Regexp.last_match[:v_type]
418
+ {}.tap do |hash|
419
+ value.each do |k, v|
420
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
421
+ end
422
+ end
423
+ else # model
424
+ temp_model = GiphyClient.const_get(type).new
425
+ temp_model.build_from_hash(value)
426
+ end
427
+ end
428
+
429
+ # Returns the string representation of the object
430
+ # @return [String] String presentation of the object
431
+ def to_s
432
+ to_hash.to_s
433
+ end
434
+
435
+ # to_body is an alias to to_hash (backward compatibility)
436
+ # @return [Hash] Returns the object in the form of hash
437
+ def to_body
438
+ to_hash
439
+ end
440
+
441
+ # Returns the object in the form of hash
442
+ # @return [Hash] Returns the object in the form of hash
443
+ def to_hash
444
+ hash = {}
445
+ self.class.attribute_map.each_pair do |attr, param|
446
+ value = self.send(attr)
447
+ next if value.nil?
448
+ hash[param] = _to_hash(value)
449
+ end
450
+ hash
451
+ end
452
+
453
+ # Outputs non-array value in the form of hash
454
+ # For object, use to_hash. Otherwise, just return the value
455
+ # @param [Object] value Any valid value
456
+ # @return [Hash] Returns the value in the form of hash
457
+ def _to_hash(value)
458
+ if value.is_a?(Array)
459
+ value.compact.map{ |v| _to_hash(v) }
460
+ elsif value.is_a?(Hash)
461
+ {}.tap do |hash|
462
+ value.each { |k, v| hash[k] = _to_hash(v) }
463
+ end
464
+ elsif value.respond_to? :to_hash
465
+ value.to_hash
466
+ else
467
+ value
468
+ end
469
+ end
470
+
471
+ end
472
+
473
+ end