Sha256: fa1d61f689b2d315e9ccd2fd74594cb8cd945db8b1b183baa755714da31e04dc

Contents?: true

Size: 578 Bytes

Versions: 44

Compression:

Stored size: 578 Bytes

Contents

module Pact
  class ProviderState

    attr_reader :name, :params

    def initialize name, params = {}
      @name = name
      @params = params
    end

    def self.from_hash(hash)
      new(hash["name"], hash["params"])
    end

    def ==(other)
      other.is_a?(Pact::ProviderState) && other.name == self.name && other.params == self.params
    end

    def to_hash
      {
        "name" => name,
        "params" => params
      }
    end

    def to_json(opts = {})
      as_json(opts).to_json(opts)
    end

    def as_json(opts = {})
      to_hash
    end
  end
end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
pact-support-1.10.0 lib/pact/consumer_contract/provider_state.rb
pact-support-1.9.0 lib/pact/consumer_contract/provider_state.rb
pact-support-1.8.1 lib/pact/consumer_contract/provider_state.rb
pact-support-1.8.0 lib/pact/consumer_contract/provider_state.rb