<commit_before>require 'rest_client'
require 'uri'
module HealthDataStandards
  module Util
		class VSApi			
			attr_accessor :api_url, :ticket_url,  :username, :password

			def initialize(ticket_url, api_url, username, password, effective_date=nil)
				@api_url = api_url
				@ticket_url = ticket_url
				@username = username
				@password = password
				@effective_date = effective_date
			end

			def get_valueset(oid,&block)
				params = {id: oid, ticket: get_ticket}
				params[:effective_date] = @effective_date if @effective_date
				vs = RestClient.get api_url, {:params=>params}
				yield oid,vs if block_given?
				vs
			end

			def process_valuesets(oids, &block)
				oids.each do |oid|
		     		vs = get_valueset(oid)
		     		yield oid,vs
				end
			end

			def proxy_ticket
			 	@proxy_ticket ||= get_proxy_ticket
			end

			def get_proxy_ticket
				# the content type is set and the body is a string becuase the NLM service does not support urlencoded content and
				# throws an error on that contnet type<commit_msg>NLM API Effective Date Updates<commit_after>require 'rest_client'
require 'uri'
module HealthDataStandards
  module Util
		class VSApi			
			attr_accessor :api_url, :ticket_url, :username, :password

			def initialize(ticket_url, api_url, username, password, effective_date=nil)
				@api_url = api_url
				@ticket_url = ticket_url
				@username = username
				@password = password
				@effective_date = effective_date
			end

			def get_valueset(oid,&block)
				params = {id: oid, ticket: get_ticket}
				params[:effective_date] = @effective_date if @effective_date
				vs = RestClient.get api_url, {:params=>params}
				yield oid,vs if block_given?
				vs
			end

			def process_valuesets(oids, &block)
				oids.each do |oid|
		     		vs = get_valueset(oid)
		     		yield oid,vs
				end
			end

			def proxy_ticket
			 	@proxy_ticket ||= get_proxy_ticket
			end

			def get_proxy_ticket
				# the content type is set and the body is a string becuase the NLM service does not support urlencoded content and
				# throws an error on that contnet type
{'fraction_non_alphanumeric': 0.0710172744721689, 'fraction_numerical': 0.0, 'mean_word_length': 3.3987341772151898, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '355387', 'n_tokens_mistral': 839, 'n_tokens_neox': 659, 'n_words': 203}