Sha256: ad0fd63484553ba81966a8351d53d3e1d5e6d64cf24f17848873a6324d6be95a

Contents?: true

Size: 930 Bytes

Versions: 4

Compression:

Stored size: 930 Bytes

Contents

# frozen_string_literal: true

module WhatsappSdk
  module Resource
    class Media
      module Type
        AUDIO = 'audio'
        DOCUMENT = 'document'
        IMAGE = 'image'
        VIDEO = 'video'
        STICKER = 'sticker'
      end

      attr_accessor :file_size, :id, :messaging_product, :mime_type, :sha256, :url

      def self.from_hash(hash)
        media = new
        media.id = hash["id"]
        media.file_size = hash["file_size"]
        media.messaging_product = hash["messaging_product"]
        media.mime_type = hash["mime_type"]
        media.sha256 = hash["sha256"]
        media.url = hash["url"]
        media
      end

      def ==(other)
        id == other.id &&
          file_size == other.file_size &&
          messaging_product == other.messaging_product &&
          mime_type == other.mime_type &&
          sha256 == other.sha256 &&
          url == other.url
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
whatsapp_sdk-1.0.3 lib/whatsapp_sdk/resource/media.rb
whatsapp_sdk-1.0.2 lib/whatsapp_sdk/resource/media.rb
whatsapp_sdk-1.0.1 lib/whatsapp_sdk/resource/media.rb
whatsapp_sdk-1.0.0 lib/whatsapp_sdk/resource/media.rb