Class: Whatsapp::Configuration
- Inherits:
-
Object
- Object
- Whatsapp::Configuration
- Defined in:
- lib/ruby/whatsapp/configuration.rb
Defined Under Namespace
Modules: Defaults
Instance Attribute Summary collapse
- #api_key ⇒ String
-
#app_secret ⇒ String?
Used to verify the
X-Hub-Signature-256header on incoming webhook POSTs. - #host ⇒ String
- #media_host_allowlist ⇒ Array<String>
- #phone_id ⇒ String
-
#verify_token ⇒ String?
The token Meta must echo back during the webhook GET verification handshake.
- #version ⇒ String
- #waba_id ⇒ String
Instance Method Summary collapse
-
#initialize(host: Defaults::HOST, version: Defaults::VERSION, api_key: nil, phone_id: nil, waba_id: nil, media_host_allowlist: Defaults::MEDIA_HOST_ALLOWLIST, verify_token: nil, app_secret: nil) ⇒ Configuration
constructor
A new instance of Configuration.
-
#inspect ⇒ String
Redacts the api_key, app_secret, and verify_token so they never leak into logs or console output.
Constructor Details
#initialize(host: Defaults::HOST, version: Defaults::VERSION, api_key: nil, phone_id: nil, waba_id: nil, media_host_allowlist: Defaults::MEDIA_HOST_ALLOWLIST, verify_token: nil, app_secret: nil) ⇒ Configuration
Returns a new instance of Configuration.
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ruby/whatsapp/configuration.rb', line 56 def initialize(host: Defaults::HOST, version: Defaults::VERSION, api_key: nil, phone_id: nil, waba_id: nil, media_host_allowlist: Defaults::MEDIA_HOST_ALLOWLIST, verify_token: nil, app_secret: nil) @host = host @version = version @api_key = api_key @phone_id = phone_id @waba_id = waba_id @media_host_allowlist = media_host_allowlist @verify_token = verify_token @app_secret = app_secret end |
Instance Attribute Details
#api_key ⇒ String
24 25 26 |
# File 'lib/ruby/whatsapp/configuration.rb', line 24 def api_key @api_key end |
#app_secret ⇒ String?
Used to verify the X-Hub-Signature-256 header on incoming webhook POSTs.
46 47 48 |
# File 'lib/ruby/whatsapp/configuration.rb', line 46 def app_secret @app_secret end |
#host ⇒ String
16 17 18 |
# File 'lib/ruby/whatsapp/configuration.rb', line 16 def host @host end |
#media_host_allowlist ⇒ Array<String>
36 37 38 |
# File 'lib/ruby/whatsapp/configuration.rb', line 36 def media_host_allowlist @media_host_allowlist end |
#phone_id ⇒ String
28 29 30 |
# File 'lib/ruby/whatsapp/configuration.rb', line 28 def phone_id @phone_id end |
#verify_token ⇒ String?
The token Meta must echo back during the webhook GET verification handshake.
41 42 43 |
# File 'lib/ruby/whatsapp/configuration.rb', line 41 def verify_token @verify_token end |
#version ⇒ String
20 21 22 |
# File 'lib/ruby/whatsapp/configuration.rb', line 20 def version @version end |
#waba_id ⇒ String
32 33 34 |
# File 'lib/ruby/whatsapp/configuration.rb', line 32 def waba_id @waba_id end |
Instance Method Details
#inspect ⇒ String
Redacts the api_key, app_secret, and verify_token so they never leak into logs or console output.
70 71 72 73 74 75 76 77 |
# File 'lib/ruby/whatsapp/configuration.rb', line 70 def inspect redacted_api_key = api_key.nil? ? "nil" : "[REDACTED]" redacted_app_secret = app_secret.nil? ? "nil" : "[REDACTED]" redacted_verify_token = verify_token.nil? ? "nil" : "[REDACTED]" "#<#{self.class.name} host=#{host.inspect} version=#{version.inspect} " \ "api_key=#{redacted_api_key} phone_id=#{phone_id.inspect} waba_id=#{waba_id.inspect} " \ "verify_token=#{redacted_verify_token} app_secret=#{redacted_app_secret}>" end |