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.



1870
1871
1872
1873
# File 'lib/mockserver/models.rb', line 1870

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.



1868
1869
1870
# File 'lib/mockserver/models.rb', line 1868

def at_least
  @at_least
end

#at_mostObject

Returns the value of attribute at_most.



1868
1869
1870
# File 'lib/mockserver/models.rb', line 1868

def at_most
  @at_most
end

Class Method Details

.at_least(count) ⇒ Object



1891
1892
1893
# File 'lib/mockserver/models.rb', line 1891

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

.at_most(count) ⇒ Object



1895
1896
1897
# File 'lib/mockserver/models.rb', line 1895

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

.between(at_least, at_most) ⇒ Object



1907
1908
1909
# File 'lib/mockserver/models.rb', line 1907

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

.exactly(count) ⇒ Object



1899
1900
1901
# File 'lib/mockserver/models.rb', line 1899

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

.from_hash(data) ⇒ Object



1882
1883
1884
1885
1886
1887
1888
1889
# File 'lib/mockserver/models.rb', line 1882

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

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

.onceObject



1903
1904
1905
# File 'lib/mockserver/models.rb', line 1903

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

Instance Method Details

#to_hObject



1875
1876
1877
1878
1879
1880
# File 'lib/mockserver/models.rb', line 1875

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