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

Nori converts String to Nori::StringWithAttributes #19

Closed
jedbeard opened this issue Jul 10, 2012 · 8 comments
Closed

Nori converts String to Nori::StringWithAttributes #19

jedbeard opened this issue Jul 10, 2012 · 8 comments

Comments

@jedbeard
Copy link

If i use savon for a soap call, i get a Hash with the response. In that hash i have Strings.
All Strings of the hash are from type Nori::StringWithAttributes instead String.
Only a result[:something].class shows that.

In my case i store the values in a Object wich i convert to yaml and this is the result:

test_id: !ruby/string:Nori::StringWithAttributes
str: '9482202'
attributes: {}

And a YAML.load(from_yaml) returns test_id = nil

@rubiii: if you need more input call me or weidenfreak ;)

cu
Jedbeard

@rubiii
Copy link
Contributor

rubiii commented Jul 11, 2012

what's this test_id thing? can you reproduce the problem or create a gist for the soap response xml?

@wilg
Copy link

wilg commented Aug 9, 2012

I'm encountering this as well. It wouldn't seem like a problem, except Nori::StringWithAttributes doesn't seem to unserialize correctly from YAML.

It doesn't happen in all situations. I'll try to find a test case or something.

@wilg
Copy link

wilg commented Aug 9, 2012

Here's a relevant spec (currently fails):

it "should be able to serialize and deserialize the hash to yaml losslessly" do
  xml = <<-EOT
    <product>
      <item>1</item>
    </product>
  EOT
  hash = parse(xml)
  unserialized = YAML::load(YAML::dump(hash))
  unserialized.should == hash
end

@statique
Copy link

statique commented Sep 5, 2012

This issue also exists when parsing an XML file. I created a Gist to demonstrate the problem. https://gist.github.com/3630294

@wilg
Copy link

wilg commented Sep 7, 2012

This turned out not to be a bug in nori, and you can find the solution in the discussion on #24.

I think this issue can probably be closed.

@rubiii
Copy link
Contributor

rubiii commented Sep 7, 2012

yep. thanks!

@rubiii rubiii closed this as completed Sep 7, 2012
@gnilrets
Copy link

gnilrets commented Jun 5, 2014

So yeah, this is an old issue, but I think it's coming up again in the latest version 2.5.1. The YAML.dump below gives me the same Nori::StringWithAttributes stuff mentioned in the first post.

      result = @client.call command_name,
                            cookies: @auth_cookies,
                            message: { :token => @token }.merge(message)

      YAML.dump result.hash[:envelope][:body][response_key][result_key]

@tjarratt
Copy link
Contributor

tjarratt commented Jun 5, 2014

@gnilrets would you mind opening a new issue for this behavior you described? If possible, could you provide a stand alone example? It's really hard to glean enough context from the snippet you posted to determine what's going on and to know how to start investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants