Class: Pinnacle::Send::SendSmsResponse

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message_id:, message:, additional_properties: nil) ⇒ Pinnacle::Send::SendSmsResponse

Parameters:

  • message_id (String)

    The unique ID of the sent message.

  • message (String)

    A message indicating the status of the sent message.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



25
26
27
28
29
30
# File 'lib/rcs/send/types/send_sms_response.rb', line 25

def initialize(message_id:, message:, additional_properties: nil)
  @message_id = message_id
  @message = message
  @additional_properties = additional_properties
  @_field_set = { "messageId": message_id, "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



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

def additional_properties
  @additional_properties
end

#messageString (readonly)

Returns A message indicating the status of the sent message.

Returns:

  • (String)

    A message indicating the status of the sent message.



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

def message
  @message
end

#message_idString (readonly)

Returns The unique ID of the sent message.

Returns:

  • (String)

    The unique ID of the sent message.



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

def message_id
  @message_id
end

Class Method Details

.from_json(json_object:) ⇒ Pinnacle::Send::SendSmsResponse

Deserialize a JSON object to an instance of SendSmsResponse

Parameters:

  • json_object (String)

Returns:



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rcs/send/types/send_sms_response.rb', line 36

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  message_id = parsed_json["messageId"]
  message = parsed_json["message"]
  new(
    message_id: message_id,
    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)


61
62
63
64
# File 'lib/rcs/send/types/send_sms_response.rb', line 61

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of SendSmsResponse to a JSON object

Returns:

  • (String)


51
52
53
# File 'lib/rcs/send/types/send_sms_response.rb', line 51

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