Class: MockServer::TimeToLive
- Inherits:
-
Object
- Object
- MockServer::TimeToLive
- Defined in:
- lib/mockserver/models.rb
Instance Attribute Summary collapse
-
#time_to_live ⇒ Object
Returns the value of attribute time_to_live.
-
#time_unit ⇒ Object
Returns the value of attribute time_unit.
-
#unlimited ⇒ Object
Returns the value of attribute unlimited.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(time_unit: nil, time_to_live: nil, unlimited: nil) ⇒ TimeToLive
constructor
A new instance of TimeToLive.
- #to_h ⇒ Object
Constructor Details
#initialize(time_unit: nil, time_to_live: nil, unlimited: nil) ⇒ TimeToLive
Returns a new instance of TimeToLive.
277 278 279 280 281 |
# File 'lib/mockserver/models.rb', line 277 def initialize(time_unit: nil, time_to_live: nil, unlimited: nil) @time_unit = time_unit @time_to_live = time_to_live @unlimited = unlimited end |
Instance Attribute Details
#time_to_live ⇒ Object
Returns the value of attribute time_to_live.
275 276 277 |
# File 'lib/mockserver/models.rb', line 275 def time_to_live @time_to_live end |
#time_unit ⇒ Object
Returns the value of attribute time_unit.
275 276 277 |
# File 'lib/mockserver/models.rb', line 275 def time_unit @time_unit end |
#unlimited ⇒ Object
Returns the value of attribute unlimited.
275 276 277 |
# File 'lib/mockserver/models.rb', line 275 def unlimited @unlimited end |
Class Method Details
.exactly(time_to_live, time_unit) ⇒ Object
305 306 307 308 309 310 311 |
# File 'lib/mockserver/models.rb', line 305 def self.exactly(time_to_live, time_unit) new( time_unit: time_unit, time_to_live: time_to_live, unlimited: false ) end |
.from_hash(data) ⇒ Object
291 292 293 294 295 296 297 298 299 |
# File 'lib/mockserver/models.rb', line 291 def self.from_hash(data) return nil if data.nil? new( time_unit: data['timeUnit'], time_to_live: data['timeToLive'], unlimited: data['unlimited'] ) end |
.unlimited ⇒ Object
301 302 303 |
# File 'lib/mockserver/models.rb', line 301 def self.unlimited new(unlimited: true) end |
Instance Method Details
#to_h ⇒ Object
283 284 285 286 287 288 289 |
# File 'lib/mockserver/models.rb', line 283 def to_h MockServer.strip_none({ 'timeUnit' => @time_unit, 'timeToLive' => @time_to_live, 'unlimited' => @unlimited }) end |