class GiphyClient::Gif
An object containing data that describes GIFs returned by the query.
Attributes
The unique bit.ly URL for this GIF
The unique bit.ly URL for this GIF
Currently unused
The date this GIF was added to the GIPHY database.
A URL used for embedding this GIF
This GIF's unique ID
The creation or upload date from this GIF's source.
Denotes whether or not this GIF has been uploaded to GIPHY by an anonymous user.
Denotes whether or not this GIF has been uploaded by a GIPHY user.
Denotes whether or not this GIF is featured on giphy.com (deprecated).
Denotes whether or not this GIF is indexable.
Denotes whether or not this GIF has been sourced from a realtime crawl.
Denotes whether or not this GIF has been deleted.
Denotes whether this GIF is a sticker (has a transparent background).
The MPAA-style rating for this content. Examples include Y, G, PG, PG-13 and R
The unique slug used in this GIF's URL
The page on which this GIF was found
The URL of the webpage on which this GIF was found.
The top level domain of the source URL.
The date on which this gif was marked trending, if applicable.
By default, this is almost always gif
The date on which this GIF was last updated.
The unique URL for this GIF
An object containing data about the user associated with this GIF, if applicable.
The username this GIF is attached to, if applicable
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/GiphyClient/models/gif.rb, line 105 def self.attribute_map { :'type' => :'type', :'id' => :'id', :'slug' => :'slug', :'url' => :'url', :'bitly_gif_url' => :'bitly_gif_url', :'bitly_url' => :'bitly_url', :'embed_url' => :'embed_url', :'username' => :'username', :'source' => :'source', :'rating' => :'rating', :'content_url' => :'content_url', :'tags' => :'tags', :'featured_tags' => :'featured_tags', :'user' => :'user', :'source_tld' => :'source_tld', :'source_post_url' => :'source_post_url', :'is_hidden' => :'is_hidden', :'is_removed' => :'is_removed', :'is_community' => :'is_community', :'is_anonymous' => :'is_anonymous', :'is_featured' => :'is_featured', :'is_realtime' => :'is_realtime', :'is_indexable' => :'is_indexable', :'is_sticker' => :'is_sticker', :'update_datetime' => :'update_datetime', :'create_datetime' => :'create_datetime', :'import_datetime' => :'import_datetime', :'trending_datetime' => :'trending_datetime', :'images' => :'images' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/GiphyClient/models/gif.rb, line 176 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'type') self.type = attributes[:'type'] else self.type = "gif" end if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'slug') self.slug = attributes[:'slug'] end if attributes.has_key?(:'url') self.url = attributes[:'url'] end if attributes.has_key?(:'bitly_gif_url') self.bitly_gif_url = attributes[:'bitly_gif_url'] end if attributes.has_key?(:'bitly_url') self.bitly_url = attributes[:'bitly_url'] end if attributes.has_key?(:'embed_url') self.embed_url = attributes[:'embed_url'] end if attributes.has_key?(:'username') self.username = attributes[:'username'] end if attributes.has_key?(:'source') self.source = attributes[:'source'] end if attributes.has_key?(:'rating') self.rating = attributes[:'rating'] end if attributes.has_key?(:'content_url') self.content_url = attributes[:'content_url'] end if attributes.has_key?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self.tags = value end end if attributes.has_key?(:'featured_tags') if (value = attributes[:'featured_tags']).is_a?(Array) self.featured_tags = value end end if attributes.has_key?(:'user') self.user = attributes[:'user'] end if attributes.has_key?(:'source_tld') self.source_tld = attributes[:'source_tld'] end if attributes.has_key?(:'source_post_url') self.source_post_url = attributes[:'source_post_url'] end if attributes.has_key?(:'is_hidden') self.is_hidden = attributes[:'is_hidden'] end if attributes.has_key?(:'is_removed') self.is_removed = attributes[:'is_removed'] end if attributes.has_key?(:'is_community') self.is_community = attributes[:'is_community'] end if attributes.has_key?(:'is_anonymous') self.is_anonymous = attributes[:'is_anonymous'] end if attributes.has_key?(:'is_featured') self.is_featured = attributes[:'is_featured'] end if attributes.has_key?(:'is_realtime') self.is_realtime = attributes[:'is_realtime'] end if attributes.has_key?(:'is_indexable') self.is_indexable = attributes[:'is_indexable'] end if attributes.has_key?(:'is_sticker') self.is_sticker = attributes[:'is_sticker'] end if attributes.has_key?(:'update_datetime') self.update_datetime = attributes[:'update_datetime'] end if attributes.has_key?(:'create_datetime') self.create_datetime = attributes[:'create_datetime'] end if attributes.has_key?(:'import_datetime') self.import_datetime = attributes[:'import_datetime'] end if attributes.has_key?(:'trending_datetime') self.trending_datetime = attributes[:'trending_datetime'] end if attributes.has_key?(:'images') self.images = attributes[:'images'] end end
Attribute type mapping.
# File lib/GiphyClient/models/gif.rb, line 140 def self.swagger_types { :'type' => :'String', :'id' => :'String', :'slug' => :'String', :'url' => :'String', :'bitly_gif_url' => :'String', :'bitly_url' => :'String', :'embed_url' => :'String', :'username' => :'String', :'source' => :'String', :'rating' => :'String', :'content_url' => :'String', :'tags' => :'Array<String>', :'featured_tags' => :'Array<String>', :'user' => :'User', :'source_tld' => :'String', :'source_post_url' => :'String', :'is_hidden' => :'BOOLEAN', :'is_removed' => :'BOOLEAN', :'is_community' => :'BOOLEAN', :'is_anonymous' => :'BOOLEAN', :'is_featured' => :'BOOLEAN', :'is_realtime' => :'BOOLEAN', :'is_indexable' => :'BOOLEAN', :'is_sticker' => :'BOOLEAN', :'update_datetime' => :'String', :'create_datetime' => :'String', :'import_datetime' => :'String', :'trending_datetime' => :'String', :'images' => :'GifImages' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/GiphyClient/models/gif.rb, line 321 def ==(o) return true if self.equal?(o) self.class == o.class && type == o.type && id == o.id && slug == o.slug && url == o.url && bitly_gif_url == o.bitly_gif_url && bitly_url == o.bitly_url && embed_url == o.embed_url && username == o.username && source == o.source && rating == o.rating && content_url == o.content_url && tags == o.tags && featured_tags == o.featured_tags && user == o.user && source_tld == o.source_tld && source_post_url == o.source_post_url && is_hidden == o.is_hidden && is_removed == o.is_removed && is_community == o.is_community && is_anonymous == o.is_anonymous && is_featured == o.is_featured && is_realtime == o.is_realtime && is_indexable == o.is_indexable && is_sticker == o.is_sticker && update_datetime == o.update_datetime && create_datetime == o.create_datetime && import_datetime == o.import_datetime && trending_datetime == o.trending_datetime && images == o.images end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/GiphyClient/models/gif.rb, line 391 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = GiphyClient.const_get(type).new temp_model.build_from_hash(value) end end
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/GiphyClient/models/gif.rb, line 457 def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/GiphyClient/models/gif.rb, line 370 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
@see the `==` method @param [Object] Object to be compared
# File lib/GiphyClient/models/gif.rb, line 357 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/GiphyClient/models/gif.rb, line 363 def hash [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 end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properies with the reasons
# File lib/GiphyClient/models/gif.rb, line 308 def list_invalid_properties invalid_properties = Array.new return invalid_properties end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/GiphyClient/models/gif.rb, line 443 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end
Returns the string representation of the object @return [String] String presentation of the object
# File lib/GiphyClient/models/gif.rb, line 431 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/GiphyClient/models/gif.rb, line 315 def valid? return true end