covermymeds/cover_my_meds

View on GitHub
lib/cover_my_meds/client/indicators.rb

Summary

Maintainability
A
0 mins
Test Coverage
module CoverMyMeds
  module Indicators
    include HostAndPath

    CURRENT_VERSION = 1

    def post_indicators(prescription: prescription(), patient: patient(), payer: {}, prescriber: {}, pharmacy: {}, rxnorm: nil, version: CURRENT_VERSION)
      params = { prescription: prescription, prescriber: prescriber, patient: patient, payer: payer, pharmacy: pharmacy, rxnorm: rxnorm }
      data = indicators_request POST, params: { v: version, headers: { content_type: "application/json" } } do
        params.to_json
      end
      Hashie::Mash.new(data)
    end

    def search_indicators(prescriptions: prescriptions(), patient: {}, payer: {}, prescriber: {}, version: CURRENT_VERSION)
      params = { prescriptions: Array(prescriptions), prescriber: prescriber, patient: patient, payer: payer }
      data = indicators_request POST, path: 'search/', params: { v: version, headers: { content_type: "application/json" } } do
        params.to_json
      end
      Hashie::Mash.new(data)
    end

  end
end