Sha256: e504d8cd44337a08ccc76efc43c8dde6e59a2c15fea0b8a98b5613f5d42a1f4b

Contents?: true

Size: 825 Bytes

Versions: 15

Compression:

Stored size: 825 Bytes

Contents

# encoding: UTF-8
require_relative './enum'

#
# A model for a delay in a response.
# @author: Nayyara Samuel (mailto: nayyara.samuel@opower.com)
#
module MockServer::Model
  # Enum for time unit
  class TimeUnit < SymbolizedEnum
    def allowed_values
      [:NANOSECONDS, :MICROSECONDS, :MILLISECONDS, :SECONDS, :MINUTES, :HOURS, :DAYS]
    end
  end

  # Model a delay object
  class Delay < Hashie::Dash
    include Hashie::Extensions::MethodAccess
    include Hashie::Extensions::IgnoreUndeclared
    include Hashie::Extensions::Coercion

    property :time_unit, default: 'SECONDS'
    property :value, required: true

    coerce_key :time_unit, TimeUnit
  end

  # DSL methods related to delay model
  module DSL
    def delay_by(time_unit, value)
      Delay.new(time_unit: time_unit, value: value)
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
flipp-mockserver-client-0.1.0 lib/mockserver/model/delay.rb
mockserver-client-1.0.8.pre lib/mockserver/model/delay.rb
mockserver-client-1.0.7 lib/mockserver/model/delay.rb
mockserver-client-1.0.7.pre lib/mockserver/model/delay.rb
mockserver-client-1.0.6 lib/mockserver/model/delay.rb
mockserver-client-1.0.6.pre lib/mockserver/model/delay.rb
mockserver-client-1.0.4 lib/mockserver/model/delay.rb
mockserver-client-1.0.3 lib/mockserver/model/delay.rb
mockserver-client-1.0.2.pre lib/mockserver/model/delay.rb
mockserver-client-1.0.1.pre lib/mockserver/model/delay.rb
mockserver-client-1.0.1 lib/mockserver/model/delay.rb
mockserver-client-1.0.0 lib/mockserver/model/delay.rb
mockserver-client-1.0.0.pre lib/mockserver/model/delay.rb
mockserver-client-0.0.3 lib/mockserver/model/delay.rb
mockserver-client-0.0.1 lib/mockserver/model/delay.rb