Sha256: ed9e7547db6448c637e8d4c76c3bca5639dccb3cb32c1cd34a336a5afa056f33

Contents?: true

Size: 1.87 KB

Versions: 10

Compression:

Stored size: 1.87 KB

Contents

# typed: strict
# frozen_string_literal: true

require_relative "data_response"

module WhatsappSdk
  module Api
    module Responses
      class BusinessProfileDataResponse < DataResponse
        sig { returns(T.nilable(String)) }
        attr_accessor :about

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

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

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

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

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

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

        sig { returns(T::Array[String]) }
        attr_accessor :websites

        sig { params(response: T::Hash[T.untyped, T.untyped]).void }
        def initialize(response)
          @about = T.let(response["data"][0]["about"], T.nilable(String))
          @address = T.let(response["data"][0]["address"], T.nilable(String))
          @description = T.let(response["data"][0]["description"], T.nilable(String))
          @email = T.let(response["data"][0]["email"], T.nilable(String))
          @messaging_product = T.let(response["data"][0]["messaging_product"], T.nilable(String))
          @profile_picture_url = T.let(response["data"][0]["profile_picture_url"], T.nilable(String))
          @vertical = T.let(response["data"][0]["vertical"], T.nilable(String))
          @websites = T.let(response["data"][0]["websites"], T.nilable(T::Array[String]))
          super(response)
        end

        sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(BusinessProfileDataResponse)) }
        def self.build_from_response(response:)
          return nil if response['error']

          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/business_profile_data_response.rb
whatsapp_sdk-0.12.0 lib/whatsapp_sdk/api/responses/business_profile_data_response.rb
whatsapp_sdk-0.11.0 lib/whatsapp_sdk/api/responses/business_profile_data_response.rb
whatsapp_sdk-0.10.0 lib/whatsapp_sdk/api/responses/business_profile_data_response.rb
whatsapp_sdk-0.9.2 lib/whatsapp_sdk/api/responses/business_profile_data_response.rb
whatsapp_sdk-0.9.1 lib/whatsapp_sdk/api/responses/business_profile_data_response.rb
whatsapp_sdk-0.9.0 lib/whatsapp_sdk/api/responses/business_profile_data_response.rb
whatsapp_sdk-0.8.0 lib/whatsapp_sdk/api/responses/business_profile_data_response.rb
whatsapp_sdk-0.7.3 lib/whatsapp_sdk/api/responses/business_profile_data_response.rb
whatsapp_sdk-0.7.2 lib/whatsapp_sdk/api/responses/business_profile_data_response.rb