Class: Pact::Response
- Inherits:
-
Hash
- Object
- Hash
- Pact::Response
show all
- Includes:
- SymbolizeKeys
- Defined in:
- lib/pact/consumer_contract/response.rb
Class Method Summary
collapse
Instance Method Summary
collapse
included, #symbolize_keys
Constructor Details
#initialize(attributes) ⇒ Response
Returns a new instance of Response.
10
11
12
|
# File 'lib/pact/consumer_contract/response.rb', line 10
def initialize attributes
merge!(attributes)
end
|
Class Method Details
.from_hash(hash) ⇒ Object
38
39
40
41
|
# File 'lib/pact/consumer_contract/response.rb', line 38
def self.from_hash hash
= Headers.new(hash[:headers] || hash['headers'] || {})
new(symbolize_keys(hash).merge(headers: ))
end
|
Instance Method Details
#[](key) ⇒ Object
34
35
36
|
# File 'lib/pact/consumer_contract/response.rb', line 34
def [] key
super key.to_sym
end
|
#body ⇒ Object
22
23
24
|
# File 'lib/pact/consumer_contract/response.rb', line 22
def body
self[:body]
end
|
#body_allows_any_value? ⇒ Boolean
30
31
32
|
# File 'lib/pact/consumer_contract/response.rb', line 30
def body_allows_any_value?
body_not_specified? || body_is_empty_hash?
end
|
18
19
20
|
# File 'lib/pact/consumer_contract/response.rb', line 18
def
self[:headers]
end
|
#specified?(key) ⇒ Boolean
26
27
28
|
# File 'lib/pact/consumer_contract/response.rb', line 26
def specified? key
self.key?(key.to_sym)
end
|
#status ⇒ Object
14
15
16
|
# File 'lib/pact/consumer_contract/response.rb', line 14
def status
self[:status]
end
|