Sha256: d63ca2e10e5d314d7714dcd9901129d5ce643da3766cae35cf8bbf2b75dfa573

Contents?: true

Size: 1.37 KB

Versions: 10

Compression:

Stored size: 1.37 KB

Contents

# typed: strict
# frozen_string_literal: true

module WhatsappSdk
  module Resource
    class Contact
      extend T::Sig

      sig { returns(T::Array[Address]) }
      attr_accessor :addresses

      sig { returns(String) }
      attr_accessor :birthday

      sig { returns(T::Array[Email]) }
      attr_accessor :emails

      sig { returns(Name) }
      attr_accessor :name

      sig { returns(Org) }
      attr_accessor :org

      sig { returns(T::Array[PhoneNumber]) }
      attr_accessor :phones

      sig { returns(T::Array[Url]) }
      attr_accessor :urls

      sig do
        params(
          addresses: T::Array[Address], birthday: String, emails: T::Array[Email],
          name: Name, org: Org, phones: T::Array[PhoneNumber], urls: T::Array[Url]
        ).void
      end
      def initialize(addresses:, birthday:, emails:, name:, org:, phones:, urls:)
        @addresses = addresses
        @birthday = birthday
        @emails = emails
        @name = name
        @org = org
        @phones = phones
        @urls = urls
      end

      sig { returns(T::Hash[T.untyped, T.untyped]) }
      def to_h
        {
          addresses: addresses.map(&:to_h),
          birthday: birthday,
          emails: emails.map(&:to_h),
          name: name.to_h,
          org: org.to_h,
          phones: phones.map(&:to_h),
          urls: urls.map(&:to_h)
        }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
whatsapp_sdk-0.12.1 lib/whatsapp_sdk/resource/contact.rb
whatsapp_sdk-0.12.0 lib/whatsapp_sdk/resource/contact.rb
whatsapp_sdk-0.11.0 lib/whatsapp_sdk/resource/contact.rb
whatsapp_sdk-0.10.0 lib/whatsapp_sdk/resource/contact.rb
whatsapp_sdk-0.9.2 lib/whatsapp_sdk/resource/contact.rb
whatsapp_sdk-0.9.1 lib/whatsapp_sdk/resource/contact.rb
whatsapp_sdk-0.9.0 lib/whatsapp_sdk/resource/contact.rb
whatsapp_sdk-0.8.0 lib/whatsapp_sdk/resource/contact.rb
whatsapp_sdk-0.7.3 lib/whatsapp_sdk/resource/contact.rb
whatsapp_sdk-0.7.2 lib/whatsapp_sdk/resource/contact.rb