Class: Pinnacle::CarouselRcs

Inherits:
Object
  • Object
show all
Defined in:
lib/rcs/types/carousel_rcs.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(phone_number:, message_type:, message:, additional_properties: nil) ⇒ Pinnacle::CarouselRcs

Parameters:

  • phone_number (String)

    Phone number to send the SMS message to

  • message_type (String)

    The type of message being sent

  • message (Pinnacle::CarouselRcsMessage)

    The content of the message

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



28
29
30
31
32
33
34
# File 'lib/rcs/types/carousel_rcs.rb', line 28

def initialize(phone_number:, message_type:, message:, additional_properties: nil)
  @phone_number = phone_number
  @message_type = message_type
  @message = message
  @additional_properties = additional_properties
  @_field_set = { "phone_number": phone_number, "message_type": message_type, "message": message }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



16
17
18
# File 'lib/rcs/types/carousel_rcs.rb', line 16

def additional_properties
  @additional_properties
end

#messagePinnacle::CarouselRcsMessage (readonly)

Returns The content of the message.

Returns:



14
15
16
# File 'lib/rcs/types/carousel_rcs.rb', line 14

def message
  @message
end

#message_typeString (readonly)

Returns The type of message being sent.

Returns:

  • (String)

    The type of message being sent



12
13
14
# File 'lib/rcs/types/carousel_rcs.rb', line 12

def message_type
  @message_type
end

#phone_numberString (readonly)

Returns Phone number to send the SMS message to.

Returns:

  • (String)

    Phone number to send the SMS message to



10
11
12
# File 'lib/rcs/types/carousel_rcs.rb', line 10

def phone_number
  @phone_number
end

Class Method Details

.from_json(json_object:) ⇒ Pinnacle::CarouselRcs

Deserialize a JSON object to an instance of CarouselRcs

Parameters:

  • json_object (String)

Returns:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/rcs/types/carousel_rcs.rb', line 40

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  phone_number = parsed_json["phone_number"]
  message_type = parsed_json["message_type"]
  if parsed_json["message"].nil?
    message = nil
  else
    message = parsed_json["message"].to_json
    message = Pinnacle::CarouselRcsMessage.from_json(json_object: message)
  end
  new(
    phone_number: phone_number,
    message_type: message_type,
    message: message,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


72
73
74
75
76
# File 'lib/rcs/types/carousel_rcs.rb', line 72

def self.validate_raw(obj:)
  obj.phone_number.is_a?(String) != false || raise("Passed value for field obj.phone_number is not the expected type, validation failed.")
  obj.message_type.is_a?(String) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.")
  Pinnacle::CarouselRcsMessage.validate_raw(obj: obj.message)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CarouselRcs to a JSON object

Returns:

  • (String)


62
63
64
# File 'lib/rcs/types/carousel_rcs.rb', line 62

def to_json(*_args)
  @_field_set&.to_json
end