Module: CoverMyMeds::Tokens

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

Constant Summary collapse

CURRENT_VERSION =
1

Instance Method Summary collapse

Methods included from HostAndPath

included

Instance Method Details

#create_access_token(request_id, version = CURRENT_VERSION) ⇒ Object



7
8
9
10
11
# File 'lib/covermymeds_api/client/tokens.rb', line 7

def create_access_token request_id, version=CURRENT_VERSION
  params = {'request_ids[]' => request_id, v: version}
  data = tokens_request POST, params: params
  Hashie::Mash.new data['tokens'].first
end

#revoke_access_token?(token_id, version = CURRENT_VERSION) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/covermymeds_api/client/tokens.rb', line 13

def revoke_access_token? token_id, version=CURRENT_VERSION
   params = { v: version }
   tokens_request DELETE, path: token_id, params: params
end

#tokens_pathObject

Override the meta-programming in this oddball case



19
20
21
# File 'lib/covermymeds_api/client/tokens.rb', line 19

def tokens_path
  @tokens_path || "/requests/tokens/"
end