Class: Svix::MessageAttemptOut

Inherits:
Object
  • Object
show all
Defined in:
lib/svix/models/message_attempt_out.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MessageAttemptOut

Returns a new instance of MessageAttemptOut.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/svix/models/message_attempt_out.rb', line 40

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::MessageAttemptOut` new method")
  end

  attributes.each do |k, v|
    unless ALL_FIELD.include?(k.to_s)
      fail(ArgumentError, "The field #{k} is not part of Svix::MessageAttemptOut")
    end

    instance_variable_set("@#{k}", v)
    instance_variable_set("@__#{k}_is_defined", true)
  end
end

Instance Attribute Details

#endpoint_idObject

The Endpoint’s ID.



8
9
10
# File 'lib/svix/models/message_attempt_out.rb', line 8

def endpoint_id
  @endpoint_id
end

#idObject

The MessageAttempt’s ID.



10
11
12
# File 'lib/svix/models/message_attempt_out.rb', line 10

def id
  @id
end

#msgObject

Returns the value of attribute msg.



11
12
13
# File 'lib/svix/models/message_attempt_out.rb', line 11

def msg
  @msg
end

#msg_idObject

The Message’s ID.



13
14
15
# File 'lib/svix/models/message_attempt_out.rb', line 13

def msg_id
  @msg_id
end

#responseObject

Returns the value of attribute response.



14
15
16
# File 'lib/svix/models/message_attempt_out.rb', line 14

def response
  @response
end

#response_duration_msObject

Response duration in milliseconds.



16
17
18
# File 'lib/svix/models/message_attempt_out.rb', line 16

def response_duration_ms
  @response_duration_ms
end

#response_status_codeObject

Returns the value of attribute response_status_code.



17
18
19
# File 'lib/svix/models/message_attempt_out.rb', line 17

def response_status_code
  @response_status_code
end

#statusObject

Returns the value of attribute status.



18
19
20
# File 'lib/svix/models/message_attempt_out.rb', line 18

def status
  @status
end

#status_textObject

Returns the value of attribute status_text.



19
20
21
# File 'lib/svix/models/message_attempt_out.rb', line 19

def status_text
  @status_text
end

#timestampObject

Returns the value of attribute timestamp.



20
21
22
# File 'lib/svix/models/message_attempt_out.rb', line 20

def timestamp
  @timestamp
end

#trigger_typeObject

Returns the value of attribute trigger_type.



21
22
23
# File 'lib/svix/models/message_attempt_out.rb', line 21

def trigger_type
  @trigger_type
end

#urlObject

Returns the value of attribute url.



22
23
24
# File 'lib/svix/models/message_attempt_out.rb', line 22

def url
  @url
end

Class Method Details

.deserialize(attributes = {}) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/svix/models/message_attempt_out.rb', line 55

def self.deserialize(attributes = {})
  attributes = attributes.transform_keys(&:to_s)
  attrs = Hash.new
  attrs["endpoint_id"] = attributes["endpointId"]
  attrs["id"] = attributes["id"]
  attrs["msg"] = Svix::MessageOut.deserialize(attributes["msg"]) if attributes["msg"]
  attrs["msg_id"] = attributes["msgId"]
  attrs["response"] = attributes["response"]
  attrs["response_duration_ms"] = attributes["responseDurationMs"]
  attrs["response_status_code"] = attributes["responseStatusCode"]
  attrs["status"] = Svix::MessageStatus.deserialize(attributes["status"])
  attrs["status_text"] = Svix::MessageStatusText.deserialize(attributes["statusText"])
  attrs["timestamp"] = DateTime.rfc3339(attributes["timestamp"]).to_time
  attrs["trigger_type"] = Svix::MessageAttemptTriggerType.deserialize(attributes["triggerType"])
  attrs["url"] = attributes["url"]
  new(attrs)
end

Instance Method Details

#serializeObject



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/svix/models/message_attempt_out.rb', line 73

def serialize
  out = Hash.new
  out["endpointId"] = Svix::serialize_primitive(@endpoint_id) if @endpoint_id
  out["id"] = Svix::serialize_primitive(@id) if @id
  out["msg"] = Svix::serialize_schema_ref(@msg) if @msg
  out["msgId"] = Svix::serialize_primitive(@msg_id) if @msg_id
  out["response"] = Svix::serialize_primitive(@response) if @response
  out["responseDurationMs"] = Svix::serialize_primitive(@response_duration_ms) if @response_duration_ms
  out["responseStatusCode"] = Svix::serialize_primitive(@response_status_code) if @response_status_code
  out["status"] = Svix::serialize_schema_ref(@status) if @status
  out["statusText"] = Svix::serialize_schema_ref(@status_text) if @status_text
  out["timestamp"] = Svix::serialize_primitive(@timestamp) if @timestamp
  out["triggerType"] = Svix::serialize_schema_ref(@trigger_type) if @trigger_type
  out["url"] = Svix::serialize_primitive(@url) if @url
  out
end

#to_jsonObject

Serializes the object to a json string

Returns:

  • String



92
93
94
# File 'lib/svix/models/message_attempt_out.rb', line 92

def to_json
  JSON.dump(serialize)
end