Sha256: 11fbbdb84e2af5dd3936f36a56cc496c70753134c1a8348e0f0bd89070233896

Contents?: true

Size: 727 Bytes

Versions: 4

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true

require_relative "data_response"

module WhatsappSdk
  module Api
    module Responses
      class MediaDataResponse < DataResponse
        attr_accessor :id, :url, :mime_type, :sha256, :file_size, :messaging_product

        def initialize(response)
          @id = response["id"]
          @messaging_product = response["messaging_product"]
          @url = response["url"]
          @mime_type = response["mime_type"]
          @sha256 = response["sha256"]
          @file_size = response["file_size"]
          super(response)
        end

        def self.build_from_response(response:)
          return unless response["id"]

          new(response)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
whatsapp_sdk-0.3.2 lib/whatsapp_sdk/api/responses/media_data_response.rb
whatsapp_sdk-0.3.1 lib/whatsapp_sdk/api/responses/media_data_response.rb
whatsapp_sdk-0.3.0 lib/whatsapp_sdk/api/responses/media_data_response.rb
whatsapp_sdk-0.2.0 lib/whatsapp_sdk/api/responses/media_data_response.rb