<commit_before>class TestServiceWithWsdl
  include SoapObject

  wsdl 'http://www.webservicex.net/airport.asmx?WSDL'
end

class TestServiceWithLocalWsdl
  include SoapObject

  wsdl "#{File.dirname(__FILE__)}/../wsdl/airport.asmx.wsdl"
end



Given /^I have the url for a remote wsdl$/ do
  @cls = TestServiceWithWsdl
end

Given /^I have a wsdl file residing locally$/ do
  @cls = TestServiceWithLocalWsdl
end

When /^I create an instance of the SoapObject class$/ do
  @so = @cls.new
end

Then /^I should have a connection$/ do
  @so.should be_connected
end

Then /^I should be able to determine the operations$/ do
  @so.operations.should include :get_airport_information_by_airport_code
end

Then /^I should be able to make a call and receive the correct results$/ do
  response = @so.get_airport_information_by_airport_code airport_code: 'SFO'
  doc = Nokogiri::XML(response)
  doc.xpath('//Table/AirportCode').first.content.should == 'SFO'
end<commit_msg>modified example to put logic into soap object<commit_after>class TestServiceWithWsdl
  include SoapObject

  wsdl 'http://www.webservicex.net/airport.asmx?WSDL'

  def get_airport_name_for(airport_code)
    response = get_airport_information_by_airport_code airport_code: airport_code
    doc = Nokogiri::XML(response)
    doc.xpath('//Table/CityOrAirportName').first.content
  end
end

class TestServiceWithLocalWsdl
  include SoapObject

  wsdl "#{File.dirname(__FILE__)}/../wsdl/airport.asmx.wsdl"
end



Given /^I have the url for a remote wsdl$/ do
  @cls = TestServiceWithWsdl
end

Given /^I have a wsdl file residing locally$/ do
  @cls = TestServiceWithLocalWsdl
end

When /^I create an instance of the SoapObject class$/ do
  @so = @cls.new
end

Then /^I should have a connection$/ do
  @so.should be_connected
end

Then /^I should be able to determine the operations$/ do
  @so.operations.should include :get_airport_information_by_airport_code
end

Then /^I should be able to make a call and receive the correct results$/ do
  @so.get_airport_name_for('SFO').should == 'SAN FRANCISCO INTL'
end
{'fraction_non_alphanumeric': 0.0910411622276029, 'fraction_numerical': 0.0, 'mean_word_length': 4.394255874673629, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4735997', 'n_tokens_mistral': 746, 'n_tokens_neox': 695, 'n_words': 212}