Class: Svix::MessageAttemptLog

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MessageAttemptLog

Returns a new instance of MessageAttemptLog.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/svix/models/message_attempt_log.rb', line 50

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::MessageAttemptLog` 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::MessageAttemptLog")
    end

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

Instance Attribute Details

#app_idObject

The Application’s ID.



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

def app_id
  @app_id
end

#app_uidObject

The Application’s UID.



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

def app_uid
  @app_uid
end

#attempt_countObject

Returns the value of attribute attempt_count.



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

def attempt_count
  @attempt_count
end

#attempt_endObject

Returns the value of attribute attempt_end.



12
13
14
# File 'lib/svix/models/message_attempt_log.rb', line 12

def attempt_end
  @attempt_end
end

#attempt_idObject

The MessageAttempt’s ID.



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

def attempt_id
  @attempt_id
end

#attempt_startObject

Returns the value of attribute attempt_start.



15
16
17
# File 'lib/svix/models/message_attempt_log.rb', line 15

def attempt_start
  @attempt_start
end

#endpoint_idObject

The Endpoint’s ID.



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

def endpoint_id
  @endpoint_id
end

#event_typeObject

The event type’s name



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

def event_type
  @event_type
end

#http_timesObject

Returns the value of attribute http_times.



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

def http_times
  @http_times
end

#msg_createdObject

Returns the value of attribute msg_created.



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

def msg_created
  @msg_created
end

#msg_event_idObject

The Message’s UID.



23
24
25
# File 'lib/svix/models/message_attempt_log.rb', line 23

def msg_event_id
  @msg_event_id
end

#msg_idObject

The Message’s ID.



25
26
27
# File 'lib/svix/models/message_attempt_log.rb', line 25

def msg_id
  @msg_id
end

#org_idObject

The Environment’s ID.



27
28
29
# File 'lib/svix/models/message_attempt_log.rb', line 27

def org_id
  @org_id
end

#response_status_codeObject

Returns the value of attribute response_status_code.



28
29
30
# File 'lib/svix/models/message_attempt_log.rb', line 28

def response_status_code
  @response_status_code
end

#statusObject

Returns the value of attribute status.



29
30
31
# File 'lib/svix/models/message_attempt_log.rb', line 29

def status
  @status
end

Class Method Details

.deserialize(attributes = {}) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/svix/models/message_attempt_log.rb', line 65

def self.deserialize(attributes = {})
  attributes = attributes.transform_keys(&:to_s)
  attrs = Hash.new
  attrs["app_id"] = attributes["appId"]
  attrs["app_uid"] = attributes["appUid"]
  attrs["attempt_count"] = attributes["attemptCount"]
  attrs["attempt_end"] = DateTime.rfc3339(attributes["attemptEnd"]).to_time
  attrs["attempt_id"] = attributes["attemptId"]
  attrs["attempt_start"] = DateTime.rfc3339(attributes["attemptStart"]).to_time
  attrs["endpoint_id"] = attributes["endpointId"]
  attrs["event_type"] = attributes["eventType"]
  attrs["http_times"] = Svix::HttpAttemptTimes.deserialize(attributes["httpTimes"]) if attributes["httpTimes"]
  attrs["msg_created"] = DateTime.rfc3339(attributes["msgCreated"]).to_time
  attrs["msg_event_id"] = attributes["msgEventId"]
  attrs["msg_id"] = attributes["msgId"]
  attrs["org_id"] = attributes["orgId"]
  attrs["response_status_code"] = attributes["responseStatusCode"]
  attrs["status"] = Svix::MessageStatus.deserialize(attributes["status"])
  new(attrs)
end

Instance Method Details

#serializeObject



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/svix/models/message_attempt_log.rb', line 86

def serialize
  out = Hash.new
  out["appId"] = Svix::serialize_primitive(@app_id) if @app_id
  out["appUid"] = Svix::serialize_primitive(@app_uid) if @app_uid
  out["attemptCount"] = Svix::serialize_primitive(@attempt_count) if @attempt_count
  out["attemptEnd"] = Svix::serialize_primitive(@attempt_end) if @attempt_end
  out["attemptId"] = Svix::serialize_primitive(@attempt_id) if @attempt_id
  out["attemptStart"] = Svix::serialize_primitive(@attempt_start) if @attempt_start
  out["endpointId"] = Svix::serialize_primitive(@endpoint_id) if @endpoint_id
  out["eventType"] = Svix::serialize_primitive(@event_type) if @event_type
  out["httpTimes"] = Svix::serialize_schema_ref(@http_times) if @http_times
  out["msgCreated"] = Svix::serialize_primitive(@msg_created) if @msg_created
  out["msgEventId"] = Svix::serialize_primitive(@msg_event_id) if @msg_event_id
  out["msgId"] = Svix::serialize_primitive(@msg_id) if @msg_id
  out["orgId"] = Svix::serialize_primitive(@org_id) if @org_id
  out["responseStatusCode"] = Svix::serialize_primitive(@response_status_code) if @response_status_code
  out["status"] = Svix::serialize_schema_ref(@status) if @status
  out
end

#to_jsonObject

Serializes the object to a json string

Returns:

  • String



108
109
110
# File 'lib/svix/models/message_attempt_log.rb', line 108

def to_json
  JSON.dump(serialize)
end