Class: MockServer::VerificationTimes

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(at_least: nil, at_most: nil) ⇒ VerificationTimes

Returns a new instance of VerificationTimes.



1354
1355
1356
1357
# File 'lib/mockserver/models.rb', line 1354

def initialize(at_least: nil, at_most: nil)
  @at_least = at_least
  @at_most = at_most
end

Instance Attribute Details

#at_leastObject

Returns the value of attribute at_least.



1352
1353
1354
# File 'lib/mockserver/models.rb', line 1352

def at_least
  @at_least
end

#at_mostObject

Returns the value of attribute at_most.



1352
1353
1354
# File 'lib/mockserver/models.rb', line 1352

def at_most
  @at_most
end

Class Method Details

.at_least(count) ⇒ Object



1375
1376
1377
# File 'lib/mockserver/models.rb', line 1375

def self.at_least(count)
  new(at_least: count)
end

.at_most(count) ⇒ Object



1379
1380
1381
# File 'lib/mockserver/models.rb', line 1379

def self.at_most(count)
  new(at_most: count)
end

.between(at_least, at_most) ⇒ Object



1391
1392
1393
# File 'lib/mockserver/models.rb', line 1391

def self.between(at_least, at_most)
  new(at_least: at_least, at_most: at_most)
end

.exactly(count) ⇒ Object



1383
1384
1385
# File 'lib/mockserver/models.rb', line 1383

def self.exactly(count)
  new(at_least: count, at_most: count)
end

.from_hash(data) ⇒ Object



1366
1367
1368
1369
1370
1371
1372
1373
# File 'lib/mockserver/models.rb', line 1366

def self.from_hash(data)
  return nil if data.nil?

  new(
    at_least: data['atLeast'],
    at_most:  data['atMost']
  )
end

.onceObject



1387
1388
1389
# File 'lib/mockserver/models.rb', line 1387

def self.once
  new(at_least: 1, at_most: 1)
end

Instance Method Details

#to_hObject



1359
1360
1361
1362
1363
1364
# File 'lib/mockserver/models.rb', line 1359

def to_h
  MockServer.strip_none({
    'atLeast' => @at_least,
    'atMost'  => @at_most
  })
end