Class: Pact::ProviderState
- Inherits:
-
Object
- Object
- Pact::ProviderState
- Defined in:
- lib/pact/consumer_contract/provider_state.rb
Instance Attribute Summary collapse
- #name ⇒ Object readonly
- #params ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #as_json(opts = {}) ⇒ Object
-
#initialize(name, params = {}) ⇒ ProviderState
constructor
A new instance of ProviderState.
- #to_hash ⇒ Object
- #to_json(opts = {}) ⇒ Object
Constructor Details
#initialize(name, params = {}) ⇒ ProviderState
Returns a new instance of ProviderState.
6 7 8 9 |
# File 'lib/pact/consumer_contract/provider_state.rb', line 6 def initialize name, params = {} @name = name @params = params end |
Instance Attribute Details
#name ⇒ Object (readonly)
4 5 6 |
# File 'lib/pact/consumer_contract/provider_state.rb', line 4 def name @name end |
#params ⇒ Object (readonly)
4 5 6 |
# File 'lib/pact/consumer_contract/provider_state.rb', line 4 def params @params end |
Class Method Details
.from_hash(hash) ⇒ Object
11 12 13 |
# File 'lib/pact/consumer_contract/provider_state.rb', line 11 def self.from_hash(hash) new(hash["name"], hash["params"]) end |
Instance Method Details
#==(other) ⇒ Object
15 16 17 |
# File 'lib/pact/consumer_contract/provider_state.rb', line 15 def ==(other) other.is_a?(Pact::ProviderState) && other.name == self.name && other.params == self.params end |
#as_json(opts = {}) ⇒ Object
30 31 32 |
# File 'lib/pact/consumer_contract/provider_state.rb', line 30 def as_json(opts = {}) to_hash end |
#to_hash ⇒ Object
19 20 21 22 23 24 |
# File 'lib/pact/consumer_contract/provider_state.rb', line 19 def to_hash { "name" => name, "params" => params } end |
#to_json(opts = {}) ⇒ Object
26 27 28 |
# File 'lib/pact/consumer_contract/provider_state.rb', line 26 def to_json(opts = {}) as_json(opts).to_json(opts) end |