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.



2132
2133
2134
2135
# File 'lib/mockserver/models.rb', line 2132

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.



2130
2131
2132
# File 'lib/mockserver/models.rb', line 2130

def at_least
  @at_least
end

#at_mostObject

Returns the value of attribute at_most.



2130
2131
2132
# File 'lib/mockserver/models.rb', line 2130

def at_most
  @at_most
end

Class Method Details

.at_least(count) ⇒ Object



2153
2154
2155
# File 'lib/mockserver/models.rb', line 2153

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

.at_most(count) ⇒ Object



2157
2158
2159
# File 'lib/mockserver/models.rb', line 2157

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

.between(at_least, at_most) ⇒ Object



2169
2170
2171
# File 'lib/mockserver/models.rb', line 2169

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

.exactly(count) ⇒ Object



2161
2162
2163
# File 'lib/mockserver/models.rb', line 2161

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

.from_hash(data) ⇒ Object



2144
2145
2146
2147
2148
2149
2150
2151
# File 'lib/mockserver/models.rb', line 2144

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

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

.onceObject



2165
2166
2167
# File 'lib/mockserver/models.rb', line 2165

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

Instance Method Details

#to_hObject



2137
2138
2139
2140
2141
2142
# File 'lib/mockserver/models.rb', line 2137

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