Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename Savon::Response#hash #985

Merged
merged 3 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/savon/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def to_array(*path)
result.kind_of?(Array) ? result.compact : [result].compact
end

def hash
def response_hash
@hash ||= nori.parse(xml)
pcai marked this conversation as resolved.
Show resolved Hide resolved
end

Expand All @@ -79,7 +79,7 @@ def xpath(path, namespaces = nil)
end

def find(*path)
envelope = nori.find(hash, 'Envelope')
envelope = nori.find(response_hash, 'Envelope')
raise_invalid_response_error! unless envelope.is_a?(Hash)

nori.find(envelope, *path)
Expand Down
6 changes: 3 additions & 3 deletions spec/savon/options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ def to_s

response = client.call(:authenticate, :xml => Fixture.response(:authentication))

expect(response.hash["soap:envelope"]["soap:body"]).to include("ns2:authenticate_response")
expect(response.response_hash["soap:envelope"]["soap:body"]).to include("ns2:authenticate_response")
end
end

Expand Down Expand Up @@ -880,7 +880,7 @@ def to_s
client = new_client(:endpoint => @server.url(:repeat), :convert_response_tags_to => lambda { |tag| tag.snakecase.upcase })
response = client.call(:authenticate, :xml => Fixture.response(:authentication))

expect(response.hash["ENVELOPE"]["BODY"]).to include("AUTHENTICATE_RESPONSE")
expect(response.response_hash["ENVELOPE"]["BODY"]).to include("AUTHENTICATE_RESPONSE")
end

it "accepts a block in the block-based interface" do
Expand All @@ -895,7 +895,7 @@ def to_s
locals.xml Fixture.response(:authentication)
end

expect(response.hash["ENVELOPE"]["BODY"]).to include("AUTHENTICATE_RESPONSE")
expect(response.response_hash["ENVELOPE"]["BODY"]).to include("AUTHENTICATE_RESPONSE")
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/savon/response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
describe "#hash" do
it "should return the complete SOAP response XML as a Hash" do
response = soap_response :body => Fixture.response(:header)
expect(response.hash[:envelope][:header][:session_number]).to eq("ABCD1234")
expect(response.response_hash[:envelope][:header][:session_number]).to eq("ABCD1234")
end
end

Expand Down