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,207 @@
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 InlineResponse2004
17
+ attr_accessor :data
18
+
19
+ attr_accessor :pagination
20
+
21
+ attr_accessor :meta
22
+
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'data' => :'data',
28
+ :'pagination' => :'pagination',
29
+ :'meta' => :'meta'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'data' => :'Array<Tag>',
37
+ :'pagination' => :'Pagination',
38
+ :'meta' => :'MetaContent'
39
+ }
40
+ end
41
+
42
+ # Initializes the object
43
+ # @param [Hash] attributes Model attributes in the form of hash
44
+ def initialize(attributes = {})
45
+ return unless attributes.is_a?(Hash)
46
+
47
+ # convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
49
+
50
+ if attributes.has_key?(:'data')
51
+ if (value = attributes[:'data']).is_a?(Array)
52
+ self.data = value
53
+ end
54
+ end
55
+
56
+ if attributes.has_key?(:'pagination')
57
+ self.pagination = attributes[:'pagination']
58
+ end
59
+
60
+ if attributes.has_key?(:'meta')
61
+ self.meta = attributes[:'meta']
62
+ end
63
+
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properies with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ return invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ return true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ data == o.data &&
85
+ pagination == o.pagination &&
86
+ meta == o.meta
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Fixnum] Hash code
97
+ def hash
98
+ [data, pagination, meta].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.swagger_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :BOOLEAN
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ temp_model = GiphyClient.const_get(type).new
159
+ temp_model.build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map{ |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+
205
+ end
206
+
207
+ end
@@ -0,0 +1,207 @@
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 InlineResponse2005
17
+ attr_accessor :data
18
+
19
+ attr_accessor :pagination
20
+
21
+ attr_accessor :meta
22
+
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'data' => :'data',
28
+ :'pagination' => :'pagination',
29
+ :'meta' => :'meta'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'data' => :'Array<Gif>',
37
+ :'pagination' => :'Pagination',
38
+ :'meta' => :'MetaContent'
39
+ }
40
+ end
41
+
42
+ # Initializes the object
43
+ # @param [Hash] attributes Model attributes in the form of hash
44
+ def initialize(attributes = {})
45
+ return unless attributes.is_a?(Hash)
46
+
47
+ # convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
49
+
50
+ if attributes.has_key?(:'data')
51
+ if (value = attributes[:'data']).is_a?(Array)
52
+ self.data = value
53
+ end
54
+ end
55
+
56
+ if attributes.has_key?(:'pagination')
57
+ self.pagination = attributes[:'pagination']
58
+ end
59
+
60
+ if attributes.has_key?(:'meta')
61
+ self.meta = attributes[:'meta']
62
+ end
63
+
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properies with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ return invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ return true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ data == o.data &&
85
+ pagination == o.pagination &&
86
+ meta == o.meta
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Fixnum] Hash code
97
+ def hash
98
+ [data, pagination, meta].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.swagger_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :BOOLEAN
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ temp_model = GiphyClient.const_get(type).new
159
+ temp_model.build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map{ |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+
205
+ end
206
+
207
+ end
@@ -0,0 +1,187 @@
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 InlineResponse400
17
+ attr_accessor :meta
18
+
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'meta' => :'meta'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.swagger_types
29
+ {
30
+ :'meta' => :'MetaContent'
31
+ }
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ return unless attributes.is_a?(Hash)
38
+
39
+ # convert string to symbol for hash key
40
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
41
+
42
+ if attributes.has_key?(:'meta')
43
+ self.meta = attributes[:'meta']
44
+ end
45
+
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properies with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ return invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ return true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ meta == o.meta
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Fixnum] Hash code
77
+ def hash
78
+ [meta].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def build_from_hash(attributes)
85
+ return nil unless attributes.is_a?(Hash)
86
+ self.class.swagger_types.each_pair do |key, type|
87
+ if type =~ /\AArray<(.*)>/i
88
+ # check to ensure the input is an array given that the the attribute
89
+ # is documented as an array but the input is not
90
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
91
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
92
+ end
93
+ elsif !attributes[self.class.attribute_map[key]].nil?
94
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
95
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
96
+ end
97
+
98
+ self
99
+ end
100
+
101
+ # Deserializes the data based on type
102
+ # @param string type Data type
103
+ # @param string value Value to be deserialized
104
+ # @return [Object] Deserialized data
105
+ def _deserialize(type, value)
106
+ case type.to_sym
107
+ when :DateTime
108
+ DateTime.parse(value)
109
+ when :Date
110
+ Date.parse(value)
111
+ when :String
112
+ value.to_s
113
+ when :Integer
114
+ value.to_i
115
+ when :Float
116
+ value.to_f
117
+ when :BOOLEAN
118
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
119
+ true
120
+ else
121
+ false
122
+ end
123
+ when :Object
124
+ # generic object (usually a Hash), return directly
125
+ value
126
+ when /\AArray<(?<inner_type>.+)>\z/
127
+ inner_type = Regexp.last_match[:inner_type]
128
+ value.map { |v| _deserialize(inner_type, v) }
129
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
130
+ k_type = Regexp.last_match[:k_type]
131
+ v_type = Regexp.last_match[:v_type]
132
+ {}.tap do |hash|
133
+ value.each do |k, v|
134
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
135
+ end
136
+ end
137
+ else # model
138
+ temp_model = GiphyClient.const_get(type).new
139
+ temp_model.build_from_hash(value)
140
+ end
141
+ end
142
+
143
+ # Returns the string representation of the object
144
+ # @return [String] String presentation of the object
145
+ def to_s
146
+ to_hash.to_s
147
+ end
148
+
149
+ # to_body is an alias to to_hash (backward compatibility)
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_body
152
+ to_hash
153
+ end
154
+
155
+ # Returns the object in the form of hash
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_hash
158
+ hash = {}
159
+ self.class.attribute_map.each_pair do |attr, param|
160
+ value = self.send(attr)
161
+ next if value.nil?
162
+ hash[param] = _to_hash(value)
163
+ end
164
+ hash
165
+ end
166
+
167
+ # Outputs non-array value in the form of hash
168
+ # For object, use to_hash. Otherwise, just return the value
169
+ # @param [Object] value Any valid value
170
+ # @return [Hash] Returns the value in the form of hash
171
+ def _to_hash(value)
172
+ if value.is_a?(Array)
173
+ value.compact.map{ |v| _to_hash(v) }
174
+ elsif value.is_a?(Hash)
175
+ {}.tap do |hash|
176
+ value.each { |k, v| hash[k] = _to_hash(v) }
177
+ end
178
+ elsif value.respond_to? :to_hash
179
+ value.to_hash
180
+ else
181
+ value
182
+ end
183
+ end
184
+
185
+ end
186
+
187
+ end