Class: HealthDataStandards::Util::VSApiV2
- Defined in:
- lib/health-data-standards/util/vs_api.rb
Instance Attribute Summary
Attributes inherited from VSApi
#api_url, #password, #ticket_url, #username
Instance Method Summary collapse
- #get_valueset(oid, options = {}) {|oid, vs| ... } ⇒ Object
-
#initialize(ticket_url, api_url, username, password) ⇒ VSApiV2
constructor
A new instance of VSApiV2.
- #process_valuesets(oids, options = {}, &block) ⇒ Object
Methods inherited from VSApi
#get_proxy_ticket, #get_ticket, #proxy_ticket
Constructor Details
#initialize(ticket_url, api_url, username, password) ⇒ VSApiV2
Returns a new instance of VSApiV2.
50 51 52 |
# File 'lib/health-data-standards/util/vs_api.rb', line 50 def initialize(ticket_url, api_url, username, password) super(ticket_url, api_url, username, password) end |
Instance Method Details
#get_valueset(oid, options = {}) {|oid, vs| ... } ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/health-data-standards/util/vs_api.rb', line 54 def get_valueset(oid, = {}, &block) version = .fetch(:version, nil) include_draft = .fetch(:include_draft, false) params = {id: oid, ticket: get_ticket} params[:version] = version if version params[:includeDraft] = 'yes' if include_draft begin vs = RestClient.get api_url, {:params=>params} rescue RestClient::ResourceNotFound raise VSNotFoundError, "No ValueSet found for oid '#{oid}'" end yield oid,vs if block_given? vs end |
#process_valuesets(oids, options = {}, &block) ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'lib/health-data-standards/util/vs_api.rb', line 69 def process_valuesets(oids, = {}, &block) version = .fetch(:version, nil) include_draft = .fetch(:include_draft, false) oids.each do |oid| vs = get_valueset(oid, version: version, include_draft: include_draft) yield oid,vs end end |