class Queryitis::Query

Public Class Methods

query_by_name(search_key) click to toggle source
# File lib/queryitis.rb, line 6
def self.query_by_name(search_key)
        @@client = Savon.client(wsdl: "http://www.itis.gov/ITISWebService.xml", log: false, pretty_print_xml: true)
    # first try searching by common name
    @@response = @@client.call(:search_for_any_match, message: { srchKey: search_key } )

    # convert the response into an array containing hashes for each itis entry returned
    Response.new(@@response.body[:search_for_any_match_response][:return][:any_match_list])
end