Class: Svix::EndpointStats
- Inherits:
-
Object
- Object
- Svix::EndpointStats
- Defined in:
- lib/svix/models/endpoint_stats.rb
Instance Attribute Summary collapse
-
#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.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/svix/models/endpoint_stats.rb', line 15 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
#fail ⇒ Object
Returns the value of attribute fail.
7 8 9 |
# File 'lib/svix/models/endpoint_stats.rb', line 7 def fail @fail end |
#pending ⇒ Object
Returns the value of attribute pending.
8 9 10 |
# File 'lib/svix/models/endpoint_stats.rb', line 8 def pending @pending end |
#sending ⇒ Object
Returns the value of attribute sending.
9 10 11 |
# File 'lib/svix/models/endpoint_stats.rb', line 9 def sending @sending end |
#success ⇒ Object
Returns the value of attribute success.
10 11 12 |
# File 'lib/svix/models/endpoint_stats.rb', line 10 def success @success end |
Class Method Details
.deserialize(attributes = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/svix/models/endpoint_stats.rb', line 30 def self.deserialize(attributes = {}) attributes = attributes.transform_keys(&:to_s) attrs = Hash.new attrs["fail"] = attributes["fail"] attrs["pending"] = attributes["pending"] attrs["sending"] = attributes["sending"] attrs["success"] = attributes["success"] new(attrs) end |
Instance Method Details
#serialize ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/svix/models/endpoint_stats.rb', line 40 def serialize out = Hash.new 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
51 52 53 |
# File 'lib/svix/models/endpoint_stats.rb', line 51 def to_json JSON.dump(serialize) end |