Sha256: d7293c51bbb4b36b0376b0679c4d551d806e58843157aaceeaa9200e933e0756

Contents?: true

Size: 1.39 KB

Versions: 10

Compression:

Stored size: 1.39 KB

Contents

# typed: strict
# frozen_string_literal: true

require_relative "data_response"

module WhatsappSdk
  module Api
    module Responses
      class MediaDataResponse < DataResponse
        sig { returns(String) }
        attr_accessor :id

        sig { returns(T.nilable(String)) }
        attr_accessor :url

        sig { returns(T.nilable(String)) }
        attr_accessor :mime_type

        sig { returns(T.nilable(String)) }
        attr_accessor :sha256

        sig { returns(T.nilable(Integer)) }
        attr_accessor :file_size

        sig { returns(T.nilable(String)) }
        attr_accessor :messaging_product

        sig { params(response: T::Hash[T.untyped, T.untyped]).void }
        def initialize(response)
          @id = T.let(response["id"], String)
          @messaging_product = T.let(response["messaging_product"], T.nilable(String))
          @url = T.let(response["url"], T.nilable(String))
          @mime_type = T.let(response["mime_type"], T.nilable(String))
          @sha256 = T.let(response["sha256"], T.nilable(String))
          @file_size = T.let(response["file_size"], T.nilable(Integer))
          super(response)
        end

        sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(MediaDataResponse)) }
        def self.build_from_response(response:)
          return unless response["id"]

          new(response)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
whatsapp_sdk-0.12.1 lib/whatsapp_sdk/api/responses/media_data_response.rb
whatsapp_sdk-0.12.0 lib/whatsapp_sdk/api/responses/media_data_response.rb
whatsapp_sdk-0.11.0 lib/whatsapp_sdk/api/responses/media_data_response.rb
whatsapp_sdk-0.10.0 lib/whatsapp_sdk/api/responses/media_data_response.rb
whatsapp_sdk-0.9.2 lib/whatsapp_sdk/api/responses/media_data_response.rb
whatsapp_sdk-0.9.1 lib/whatsapp_sdk/api/responses/media_data_response.rb
whatsapp_sdk-0.9.0 lib/whatsapp_sdk/api/responses/media_data_response.rb
whatsapp_sdk-0.8.0 lib/whatsapp_sdk/api/responses/media_data_response.rb
whatsapp_sdk-0.7.3 lib/whatsapp_sdk/api/responses/media_data_response.rb
whatsapp_sdk-0.7.2 lib/whatsapp_sdk/api/responses/media_data_response.rb