Sha256: 4c8de36b843d36d06d06a198e4a16c6ee1afe7b35b073b9bf04b634ddbd200e2

Contents?: true

Size: 835 Bytes

Versions: 11

Compression:

Stored size: 835 Bytes

Contents

 require "spec_helper"

describe "Stockquote example" do

  it "returns the result in a CDATA tag" do
    client = Savon.client(
      # The WSDL document provided by the service.
      :wsdl => "http://www.webservicex.net/stockquote.asmx?WSDL",

      # Lower timeouts so these specs don't take forever when the service is not available.
      :open_timeout => 10,
      :read_timeout => 10,

      # Disable logging for cleaner spec output.
      :log => false
    )

    response = call_and_fail_gracefully(client, :get_quote, :message => { :symbol => "AAPL" })

    cdata = response.body[:get_quote_response][:get_quote_result]

    nori_options = { :convert_tags_to => lambda { |tag| tag.snakecase.to_sym } }
    result = Nori.new(nori_options).parse(cdata)

    result[:stock_quotes][:stock][:symbol].should == "AAPL"
  end

end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
savon-2.5.1 spec/integration/stockquote_example_spec.rb
savon-2.5.0 spec/integration/stockquote_example_spec.rb
savon_with_adapter-2.4.1 spec/integration/stockquote_example_spec.rb
savon-2.4.0 spec/integration/stockquote_example_spec.rb
savon-2.3.3 spec/integration/stockquote_example_spec.rb
savon-2.3.2 spec/integration/stockquote_example_spec.rb
savon-2.3.1 spec/integration/stockquote_example_spec.rb
savon-ng-1.6-2.4.1 spec/integration/stockquote_example_spec.rb
savon-ng-1.6-2.4.0 spec/integration/stockquote_example_spec.rb
savon-2.3.0 spec/integration/stockquote_example_spec.rb
savon-2.2.0 spec/integration/stockquote_example_spec.rb