Created
November 25, 2013 10:33
Revisions
-
satyatechsavy created this gist
Nov 25, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ 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