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.



2639
2640
2641
2642
# File 'lib/mockserver/models.rb', line 2639

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.



2637
2638
2639
# File 'lib/mockserver/models.rb', line 2637

def at_least
  @at_least
end

#at_mostObject

Returns the value of attribute at_most.



2637
2638
2639
# File 'lib/mockserver/models.rb', line 2637

def at_most
  @at_most
end

Class Method Details

.at_least(count) ⇒ Object



2660
2661
2662
# File 'lib/mockserver/models.rb', line 2660

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

.at_most(count) ⇒ Object



2664
2665
2666
# File 'lib/mockserver/models.rb', line 2664

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

.between(at_least, at_most) ⇒ Object



2676
2677
2678
# File 'lib/mockserver/models.rb', line 2676

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

.exactly(count) ⇒ Object



2668
2669
2670
# File 'lib/mockserver/models.rb', line 2668

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

.from_hash(data) ⇒ Object



2651
2652
2653
2654
2655
2656
2657
2658
# File 'lib/mockserver/models.rb', line 2651

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

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

.onceObject



2672
2673
2674
# File 'lib/mockserver/models.rb', line 2672

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

Instance Method Details

#to_hObject



2644
2645
2646
2647
2648
2649
# File 'lib/mockserver/models.rb', line 2644

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