Class: ThePlaidApi::ProxyType

Inherits:
Object
  • Object
show all
Defined in:
lib/the_plaid_api/models/proxy_type.rb

Overview

An enum indicating whether a network proxy is present and if so what type it is. ‘none_detected` indicates the user is not on a detectable proxy network. `tor` indicates the user was using a Tor browser, which sends encrypted traffic on a decentralized network and is somewhat similar to a VPN (Virtual Private Network). `vpn` indicates the user is on a VPN (Virtual Private Network) `web_proxy` indicates the user is on a web proxy server, which may allow them to conceal information such as their IP address or other identifying information. `public_proxy` indicates the user is on a public web proxy server, which is similar to a web proxy but can be shared by multiple users. This may allow multiple users to appear as if they have the same IP address for instance.

Constant Summary collapse

PROXY_TYPE =
[
  # TODO: Write general description for NONE_DETECTED
  NONE_DETECTED = 'none_detected'.freeze,

  # TODO: Write general description for TOR
  TOR = 'tor'.freeze,

  # TODO: Write general description for VPN
  VPN = 'vpn'.freeze,

  # TODO: Write general description for WEB_PROXY
  WEB_PROXY = 'web_proxy'.freeze,

  # TODO: Write general description for PUBLIC_PROXY
  PUBLIC_PROXY = 'public_proxy'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = NONE_DETECTED) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/the_plaid_api/models/proxy_type.rb', line 42

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

  str = value.to_s.strip

  case str.downcase
  when 'none_detected' then NONE_DETECTED
  when 'tor' then TOR
  when 'vpn' then VPN
  when 'web_proxy' then WEB_PROXY
  when 'public_proxy' then PUBLIC_PROXY
  else
    default_value
  end
end

.validate(value) ⇒ Object



36
37
38
39
40
# File 'lib/the_plaid_api/models/proxy_type.rb', line 36

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

  PROXY_TYPE.include?(value)
end