Skip to content

Instantly share code, notes, and snippets.

@faraazkhan
Created February 19, 2014 21:28
Show Gist options
  • Save faraazkhan/9102019 to your computer and use it in GitHub Desktop.
Save faraazkhan/9102019 to your computer and use it in GitHub Desktop.
require 'csv'
require 'json'
require 'net/http'
class ServiceValidator
@url = 'http://medicare.gov/physiciancompare/(X(1)S(tposse1fuc432hcyz5boheok))/services/PhysicianCompare.svc/GetSymptomSpecialties?symptomid=279&bodypartid=1&selected=M&AspxAutoDetectCookieSupport=1'
def validate
call_service
parse_expected_response
validate_response
end
def call_service
raw_response = Net::HTTP.get(@url)
@response = JSON.parse(raw_response)
end
def parse_expected_response
CSV.read('services_test.csv')
#return an array of expected responses for each node.
end
def validate_response
@response.each do |resp|
value_at_node_for_request(resp) == value_at_node_for_response(parse_expected_response)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment