Class: Svix::EndpointStats
- Inherits:
-
Object
- Object
- Svix::EndpointStats
- Defined in:
- lib/svix/models/endpoint_stats.rb
Instance Attribute Summary collapse
-
#canceled ⇒ Object
Returns the value of attribute canceled.
-
#fail ⇒ Object
Returns the value of attribute fail.
-
#pending ⇒ Object
Returns the value of attribute pending.
-
#sending ⇒ Object
Returns the value of attribute sending.
-
#success ⇒ Object
Returns the value of attribute success.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ EndpointStats
constructor
A new instance of EndpointStats.
- #serialize ⇒ Object
-
#to_json ⇒ Object
Serializes the object to a json string.
Constructor Details
#initialize(attributes = {}) ⇒ EndpointStats
Returns a new instance of EndpointStats.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/svix/models/endpoint_stats.rb', line 16 def initialize(attributes = {}) unless attributes.is_a?(Hash) fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::EndpointStats` 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::EndpointStats") end instance_variable_set("@#{k}", v) instance_variable_set("@__#{k}_is_defined", true) end end |
Instance Attribute Details
#canceled ⇒ Object
Returns the value of attribute canceled.
7 8 9 |
# File 'lib/svix/models/endpoint_stats.rb', line 7 def canceled @canceled end |
#fail ⇒ Object
Returns the value of attribute fail.
8 9 10 |
# File 'lib/svix/models/endpoint_stats.rb', line 8 def fail @fail end |
#pending ⇒ Object
Returns the value of attribute pending.
9 10 11 |
# File 'lib/svix/models/endpoint_stats.rb', line 9 def pending @pending end |
#sending ⇒ Object
Returns the value of attribute sending.
10 11 12 |
# File 'lib/svix/models/endpoint_stats.rb', line 10 def sending @sending end |
#success ⇒ Object
Returns the value of attribute success.
11 12 13 |
# File 'lib/svix/models/endpoint_stats.rb', line 11 def success @success end |
Class Method Details
.deserialize(attributes = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/svix/models/endpoint_stats.rb', line 31 def self.deserialize(attributes = {}) attributes = attributes.transform_keys(&:to_s) attrs = Hash.new attrs["canceled"] = attributes["canceled"] attrs["fail"] = attributes["fail"] attrs["pending"] = attributes["pending"] attrs["sending"] = attributes["sending"] attrs["success"] = attributes["success"] new(attrs) end |
Instance Method Details
#serialize ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/svix/models/endpoint_stats.rb', line 42 def serialize out = Hash.new out["canceled"] = Svix::serialize_primitive(@canceled) if @canceled out["fail"] = Svix::serialize_primitive(@fail) if @fail out["pending"] = Svix::serialize_primitive(@pending) if @pending out["sending"] = Svix::serialize_primitive(@sending) if @sending out["success"] = Svix::serialize_primitive(@success) if @success out end |
#to_json ⇒ Object
Serializes the object to a json string
54 55 56 |
# File 'lib/svix/models/endpoint_stats.rb', line 54 def to_json JSON.dump(serialize) end |