Skip to content

Instantly share code, notes, and snippets.

@satyatechsavy
Created November 25, 2013 10:33
Show Gist options
  • Save satyatechsavy/7639411 to your computer and use it in GitHub Desktop.
Save satyatechsavy/7639411 to your computer and use it in GitHub Desktop.
class Api::Foobar
include HTTParty
base_uri 'http://demo.foobar.es/vweb/xml'
GLOBAL_OPTIONS = {edad: 'anciano', farmacovigilancia: false, deportista: false, administrativas: false}
def initialize(user)
@user = user
end
def perform
if @user.country=='France'
contraindications
else
medications_by_name(@user.country_name)
end
end
private
def contraindications
self.class.get("/ws_patient/alertas", query: GLOBAL_OPTIONS.merge(user_options) )
end
def self.medications_by_name(name)
response = get("/ws_drug/SearchByName", query: {value: name} )
response['object']['drug_set']['drug']
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment