class GiphyClient::Gif

An object containing data that describes GIFs returned by the query.

Attributes

bitly_gif_url[RW]

The unique bit.ly URL for this GIF

bitly_url[RW]

The unique bit.ly URL for this GIF

content_url[RW]

Currently unused

create_datetime[RW]

The date this GIF was added to the GIPHY database.

embed_url[RW]

A URL used for embedding this GIF

id[RW]

This GIF's unique ID

images[RW]
import_datetime[RW]

The creation or upload date from this GIF's source.

is_anonymous[RW]

Denotes whether or not this GIF has been uploaded to GIPHY by an anonymous user.

is_community[RW]

Denotes whether or not this GIF has been uploaded by a GIPHY user.

is_hidden[RW]

Denotes whether or not this GIF is private.

is_indexable[RW]

Denotes whether or not this GIF is indexable.

is_realtime[RW]

Denotes whether or not this GIF has been sourced from a realtime crawl.

is_removed[RW]

Denotes whether or not this GIF has been deleted.

is_sticker[RW]

Denotes whether this GIF is a sticker (has a transparent background).

rating[RW]

The MPAA-style rating for this content. Examples include Y, G, PG, PG-13 and R

slug[RW]

The unique slug used in this GIF's URL

source[RW]

The page on which this GIF was found

source_post_url[RW]

The URL of the webpage on which this GIF was found.

source_tld[RW]

The top level domain of the source URL.

tags[RW]

An array of tags for this GIF (Note\: Not available when using the Public Beta Key)

type[RW]

By default, this is almost always gif

update_datetime[RW]

The date on which this GIF was last updated.

url[RW]

The unique URL for this GIF

user[RW]

An object containing data about the user associated with this GIF, if applicable.

username[RW]

The username this GIF is attached to, if applicable

Public Class Methods

attribute_map() click to toggle source

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
new(attributes = {}) click to toggle source

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
swagger_types() click to toggle source

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

==(o) click to toggle source

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
_deserialize(type, value) click to toggle source

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
_to_hash(value) click to toggle source

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
build_from_hash(attributes) click to toggle source

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
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/GiphyClient/models/gif.rb, line 357
def eql?(o)
  self == o
end
hash() click to toggle source

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
list_invalid_properties() click to toggle source

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
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/GiphyClient/models/gif.rb, line 437
def to_body
  to_hash
end
to_hash() click to toggle source

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
to_s() click to toggle source

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
valid?() click to toggle source

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