Module: CoverMyMeds::Credentials

Includes:
HostAndPath
Included in:
Client
Defined in:
lib/covermymeds_api/client/credentials.rb

Constant Summary collapse

CURRENT_VERSION =
1

Instance Method Summary collapse

Methods included from HostAndPath

included

Instance Method Details

#create_credential(npi: npi, callback_url: '', callback_verb: '', fax_numbers: fax_numbers, contact_hint: {}, version: CURRENT_VERSION) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/covermymeds_api/client/credentials.rb', line 7

def create_credential npi: npi, callback_url: '', callback_verb: '', fax_numbers: fax_numbers, contact_hint: {}, version: CURRENT_VERSION
  params = { v: version }
  data = credentials_request POST, params: params do
    {
      credential: {
        npi: npi,
        callback_url: callback_url,
        callback_verb: callback_verb,
        fax_numbers: Array(fax_numbers),
        contact_hint: contact_hint,
      }
    }
  end
  Hashie::Mash.new data['credential']
end

#credentials_pathObject

Override the meta-programming in this oddball case



24
25
26
# File 'lib/covermymeds_api/client/credentials.rb', line 24

def credentials_path
  @credentials_path || "/prescribers/credentials/"
end

#delete_credential(npi, version = CURRENT_VERSION) ⇒ Object



28
29
30
# File 'lib/covermymeds_api/client/credentials.rb', line 28

def delete_credential(npi, version=CURRENT_VERSION)
  data = credentials_request DELETE, path: npi, params: { v: version }
end