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