Class: Inttegro::Schedule::ChimeRequest

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/inttegro/schedule/chime_request.rb

Overview

Typed representation of the chime request object in the Inttegro API.

This generated model is immutable. Construct it with .new, or decode a string-keyed API payload with .from_hash. #serialize produces a string-keyed hash using the original wire field names and serialized enum values.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#email ⇒ Inttegro::Chime::EmailMessageInput? (readonly)

Email content accepted for email chimes, broadcasts, and schedules.

Optional in the API payload; omitted values default to nil. Wire name: email.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/inttegro/schedule/chime_request.rb', line 72

class ChimeRequest < T::Struct
  const :request_meta, T.nilable(Inttegro::Schedule::ChimeRequestRequestMeta), default: nil
  const :recipients, T::Array[T.any(Inttegro::Chime::PhoneRecipient, Inttegro::Chime::EmailRecipient, Inttegro::Chime::SavedCustomerRecipient)]
  const :send_after, Time
  const :full_message, T.nilable(String), default: nil
  const :email, T.nilable(Inttegro::Chime::EmailMessageInput), default: nil
  const :message_template, T.nilable(Inttegro::MessageTemplate::Reference), default: nil
  const :sender_id, T.nilable(String), default: nil
  const :purpose, T.nilable(String), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (recipients_value = data["recipients"]).is_a?(Array)
      data["recipients"] = recipients_value.map do |item|
        next item unless item.is_a?(Hash)
        if item.key?("phone")
          Inttegro::Chime::PhoneRecipient.from_hash(item)
        elsif item.key?("email")
          Inttegro::Chime::EmailRecipient.from_hash(item)
        elsif item.key?("customer_id")
          Inttegro::Chime::SavedCustomerRecipient.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#full_message ⇒ String? (readonly)

Complete SMS message content. Use only with SMS recipients.

Optional in the API payload; omitted values default to nil. Wire name: full_message.

Returns:

  • (String, nil)


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/inttegro/schedule/chime_request.rb', line 72

class ChimeRequest < T::Struct
  const :request_meta, T.nilable(Inttegro::Schedule::ChimeRequestRequestMeta), default: nil
  const :recipients, T::Array[T.any(Inttegro::Chime::PhoneRecipient, Inttegro::Chime::EmailRecipient, Inttegro::Chime::SavedCustomerRecipient)]
  const :send_after, Time
  const :full_message, T.nilable(String), default: nil
  const :email, T.nilable(Inttegro::Chime::EmailMessageInput), default: nil
  const :message_template, T.nilable(Inttegro::MessageTemplate::Reference), default: nil
  const :sender_id, T.nilable(String), default: nil
  const :purpose, T.nilable(String), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (recipients_value = data["recipients"]).is_a?(Array)
      data["recipients"] = recipients_value.map do |item|
        next item unless item.is_a?(Hash)
        if item.key?("phone")
          Inttegro::Chime::PhoneRecipient.from_hash(item)
        elsif item.key?("email")
          Inttegro::Chime::EmailRecipient.from_hash(item)
        elsif item.key?("customer_id")
          Inttegro::Chime::SavedCustomerRecipient.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#message_template ⇒ Inttegro::MessageTemplate::Reference? (readonly)

Value of the message_template field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: message_template.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/inttegro/schedule/chime_request.rb', line 72

class ChimeRequest < T::Struct
  const :request_meta, T.nilable(Inttegro::Schedule::ChimeRequestRequestMeta), default: nil
  const :recipients, T::Array[T.any(Inttegro::Chime::PhoneRecipient, Inttegro::Chime::EmailRecipient, Inttegro::Chime::SavedCustomerRecipient)]
  const :send_after, Time
  const :full_message, T.nilable(String), default: nil
  const :email, T.nilable(Inttegro::Chime::EmailMessageInput), default: nil
  const :message_template, T.nilable(Inttegro::MessageTemplate::Reference), default: nil
  const :sender_id, T.nilable(String), default: nil
  const :purpose, T.nilable(String), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (recipients_value = data["recipients"]).is_a?(Array)
      data["recipients"] = recipients_value.map do |item|
        next item unless item.is_a?(Hash)
        if item.key?("phone")
          Inttegro::Chime::PhoneRecipient.from_hash(item)
        elsif item.key?("email")
          Inttegro::Chime::EmailRecipient.from_hash(item)
        elsif item.key?("customer_id")
          Inttegro::Chime::SavedCustomerRecipient.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#purpose ⇒ String? (readonly)

Optional purpose or category for this scheduled chime

Optional in the API payload; omitted values default to nil. Wire name: purpose.

Returns:

  • (String, nil)


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/inttegro/schedule/chime_request.rb', line 72

class ChimeRequest < T::Struct
  const :request_meta, T.nilable(Inttegro::Schedule::ChimeRequestRequestMeta), default: nil
  const :recipients, T::Array[T.any(Inttegro::Chime::PhoneRecipient, Inttegro::Chime::EmailRecipient, Inttegro::Chime::SavedCustomerRecipient)]
  const :send_after, Time
  const :full_message, T.nilable(String), default: nil
  const :email, T.nilable(Inttegro::Chime::EmailMessageInput), default: nil
  const :message_template, T.nilable(Inttegro::MessageTemplate::Reference), default: nil
  const :sender_id, T.nilable(String), default: nil
  const :purpose, T.nilable(String), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (recipients_value = data["recipients"]).is_a?(Array)
      data["recipients"] = recipients_value.map do |item|
        next item unless item.is_a?(Hash)
        if item.key?("phone")
          Inttegro::Chime::PhoneRecipient.from_hash(item)
        elsif item.key?("email")
          Inttegro::Chime::EmailRecipient.from_hash(item)
        elsif item.key?("customer_id")
          Inttegro::Chime::SavedCustomerRecipient.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#recipients ⇒ Array<Inttegro::Chime::PhoneRecipient, Inttegro::Chime::EmailRecipient, Inttegro::Chime::SavedCustomerRecipient> (readonly)

Recipient objects for this scheduled chime. Each item must include transport and either inline contact details or customer_id.

Required in the API payload. Wire name: recipients.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/inttegro/schedule/chime_request.rb', line 72

class ChimeRequest < T::Struct
  const :request_meta, T.nilable(Inttegro::Schedule::ChimeRequestRequestMeta), default: nil
  const :recipients, T::Array[T.any(Inttegro::Chime::PhoneRecipient, Inttegro::Chime::EmailRecipient, Inttegro::Chime::SavedCustomerRecipient)]
  const :send_after, Time
  const :full_message, T.nilable(String), default: nil
  const :email, T.nilable(Inttegro::Chime::EmailMessageInput), default: nil
  const :message_template, T.nilable(Inttegro::MessageTemplate::Reference), default: nil
  const :sender_id, T.nilable(String), default: nil
  const :purpose, T.nilable(String), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (recipients_value = data["recipients"]).is_a?(Array)
      data["recipients"] = recipients_value.map do |item|
        next item unless item.is_a?(Hash)
        if item.key?("phone")
          Inttegro::Chime::PhoneRecipient.from_hash(item)
        elsif item.key?("email")
          Inttegro::Chime::EmailRecipient.from_hash(item)
        elsif item.key?("customer_id")
          Inttegro::Chime::SavedCustomerRecipient.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#request_meta ⇒ Inttegro::Schedule::ChimeRequestRequestMeta? (readonly)

Value of the request_meta field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: request_meta.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/inttegro/schedule/chime_request.rb', line 72

class ChimeRequest < T::Struct
  const :request_meta, T.nilable(Inttegro::Schedule::ChimeRequestRequestMeta), default: nil
  const :recipients, T::Array[T.any(Inttegro::Chime::PhoneRecipient, Inttegro::Chime::EmailRecipient, Inttegro::Chime::SavedCustomerRecipient)]
  const :send_after, Time
  const :full_message, T.nilable(String), default: nil
  const :email, T.nilable(Inttegro::Chime::EmailMessageInput), default: nil
  const :message_template, T.nilable(Inttegro::MessageTemplate::Reference), default: nil
  const :sender_id, T.nilable(String), default: nil
  const :purpose, T.nilable(String), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (recipients_value = data["recipients"]).is_a?(Array)
      data["recipients"] = recipients_value.map do |item|
        next item unless item.is_a?(Hash)
        if item.key?("phone")
          Inttegro::Chime::PhoneRecipient.from_hash(item)
        elsif item.key?("email")
          Inttegro::Chime::EmailRecipient.from_hash(item)
        elsif item.key?("customer_id")
          Inttegro::Chime::SavedCustomerRecipient.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#send_after ⇒ Time (readonly)

ISO 8601 timestamp for when to send the chime (must be in the future)

Required in the API payload. Wire name: send_after.

Returns:

  • (Time)


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/inttegro/schedule/chime_request.rb', line 72

class ChimeRequest < T::Struct
  const :request_meta, T.nilable(Inttegro::Schedule::ChimeRequestRequestMeta), default: nil
  const :recipients, T::Array[T.any(Inttegro::Chime::PhoneRecipient, Inttegro::Chime::EmailRecipient, Inttegro::Chime::SavedCustomerRecipient)]
  const :send_after, Time
  const :full_message, T.nilable(String), default: nil
  const :email, T.nilable(Inttegro::Chime::EmailMessageInput), default: nil
  const :message_template, T.nilable(Inttegro::MessageTemplate::Reference), default: nil
  const :sender_id, T.nilable(String), default: nil
  const :purpose, T.nilable(String), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (recipients_value = data["recipients"]).is_a?(Array)
      data["recipients"] = recipients_value.map do |item|
        next item unless item.is_a?(Hash)
        if item.key?("phone")
          Inttegro::Chime::PhoneRecipient.from_hash(item)
        elsif item.key?("email")
          Inttegro::Chime::EmailRecipient.from_hash(item)
        elsif item.key?("customer_id")
          Inttegro::Chime::SavedCustomerRecipient.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#sender_id ⇒ String? (readonly)

Sender identifier displayed to recipients

Optional in the API payload; omitted values default to nil. Wire name: sender_id.

Returns:

  • (String, nil)


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/inttegro/schedule/chime_request.rb', line 72

class ChimeRequest < T::Struct
  const :request_meta, T.nilable(Inttegro::Schedule::ChimeRequestRequestMeta), default: nil
  const :recipients, T::Array[T.any(Inttegro::Chime::PhoneRecipient, Inttegro::Chime::EmailRecipient, Inttegro::Chime::SavedCustomerRecipient)]
  const :send_after, Time
  const :full_message, T.nilable(String), default: nil
  const :email, T.nilable(Inttegro::Chime::EmailMessageInput), default: nil
  const :message_template, T.nilable(Inttegro::MessageTemplate::Reference), default: nil
  const :sender_id, T.nilable(String), default: nil
  const :purpose, T.nilable(String), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (recipients_value = data["recipients"]).is_a?(Array)
      data["recipients"] = recipients_value.map do |item|
        next item unless item.is_a?(Hash)
        if item.key?("phone")
          Inttegro::Chime::PhoneRecipient.from_hash(item)
        elsif item.key?("email")
          Inttegro::Chime::EmailRecipient.from_hash(item)
        elsif item.key?("customer_id")
          Inttegro::Chime::SavedCustomerRecipient.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

Class Method Details

.from_hash(hash, strict = false) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/inttegro/schedule/chime_request.rb', line 85

def self.from_hash(hash, strict = false)
  data = hash.dup
  if (recipients_value = data["recipients"]).is_a?(Array)
    data["recipients"] = recipients_value.map do |item|
      next item unless item.is_a?(Hash)
      if item.key?("phone")
        Inttegro::Chime::PhoneRecipient.from_hash(item)
      elsif item.key?("email")
        Inttegro::Chime::EmailRecipient.from_hash(item)
      elsif item.key?("customer_id")
        Inttegro::Chime::SavedCustomerRecipient.from_hash(item)
      else
        item
      end
    end
  end
  super(data, strict)
end