Class: WalmartApIs::TokenEndpointAuthMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/walmart_ap_is/models/token_endpoint_auth_method.rb

Overview

none for public clients (PKCE), client_secret_post/client_secret_basic for confidential.

Constant Summary collapse

TOKEN_ENDPOINT_AUTH_METHOD =
[
  # TODO: Write general description for NONE
  NONE = 'none'.freeze,

  # TODO: Write general description for CLIENT_SECRET_POST
  CLIENT_SECRET_POST = 'client_secret_post'.freeze,

  # TODO: Write general description for CLIENT_SECRET_BASIC
  CLIENT_SECRET_BASIC = 'client_secret_basic'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = NONE) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/walmart_ap_is/models/token_endpoint_auth_method.rb', line 27

def self.from_value(value, default_value = NONE)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'none' then NONE
  when 'client_secret_post' then CLIENT_SECRET_POST
  when 'client_secret_basic' then CLIENT_SECRET_BASIC
  else
    default_value
  end
end

.validate(value) ⇒ Object



21
22
23
24
25
# File 'lib/walmart_ap_is/models/token_endpoint_auth_method.rb', line 21

def self.validate(value)
  return false if value.nil?

  TOKEN_ENDPOINT_AUTH_METHOD.include?(value)
end