Sha256: 3dbc152f81a2cb280ba1fe99157b052e839f3a21e665d431d3aaa0d38d5d2829
Contents?: true
Size: 1.08 KB
Versions: 4
Compression:
Stored size: 1.08 KB
Contents
# typed: strict # frozen_string_literal: true require_relative "data_response" require_relative "template_data_response" module WhatsappSdk module Api module Responses class TemplatesDataResponse < DataResponse sig { returns(T::Array[TemplateDataResponse]) } attr_reader :templates sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response) @templates = T.let( response['data']&.map { |template| parse_templates(template) }, T::Array[TemplateDataResponse] ) super(response) end sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(TemplatesDataResponse)) } def self.build_from_response(response:) return unless response["data"] new(response) end private sig { params(template: T::Hash[T.untyped, T.untyped]).returns(TemplateDataResponse) } def parse_templates(template) TemplateDataResponse.new(response: template) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems