@@ -26,14 +26,14 @@ $ gem install phaxio
2626
2727## Usage
2828
29- Set up your API Key, API Secret, and, optionally, Callback Token.
29+ Set up your API Key, API Secret, and, optionally, Webhook Token.
3030
3131``` ruby
3232require ' phaxio'
3333
3434Phaxio .api_key = ' 11111'
3535Phaxio .api_secret = ' 22222'
36- Phaxio .callback_token = ' 33333'
36+ Phaxio .webhook_token = ' 33333'
3737```
3838
3939Try sending a fax:
@@ -243,32 +243,32 @@ Account.get
243243# => Account(balance: 1000, faxes_today: 0, faxes_this_month: 100)
244244```
245245
246- #### Callback
246+ #### Webhook
247247
248- ##### ` Callback .valid_signature?`
248+ ##### ` Webhook .valid_signature?`
249249
250- Validate the callback signature sent with a Phaxio callback . Requires that Phaxio.callback_token be
250+ Validate the webhook signature sent with a Phaxio webhook . Requires that Phaxio.webhook_token be
251251set.
252252
253253``` ruby
254- Callback .valid_signature? received_signature, callback_url , received_params, received_files
254+ Webhook .valid_signature? received_signature, webhook_url , received_params, received_files
255255# => true
256256```
257257
258- ## Callback Validation Example with Sinatra
258+ ## Webhook Validation Example with Sinatra
259259
260260``` ruby
261261require ' sinatra/base'
262262require ' phaxio'
263263
264264class PhaxioWebhookExample < Sinatra ::Base
265- Phaxio .callback_token = ' YOUR WEBHOOK TOKEN HERE'
266-
265+ Phaxio .webhook_token = ' YOUR WEBHOOK TOKEN HERE'
266+
267267 post ' /webhook' do
268268 signature = request.env[' HTTP_X_PHAXIO_SIGNATURE' ]
269269 url = request.url
270270 file_params = params[:file ]
271- if Phaxio ::Callback .valid_signature? signature, url, webhook_params, file_params
271+ if Phaxio ::Webhook .valid_signature? signature, url, webhook_params, file_params
272272 ' Success'
273273 else
274274 ' Invalid webhook signature'
@@ -289,22 +289,22 @@ end
289289class WebhookController < ApplicationController
290290 skip_before_action :verify_authenticity_token
291291
292- def index
292+ def index
293293 signature = request.headers[' X-Phaxio-Signature' ]
294- Phaxio .callback_token = ' YOUR WEBHOOK TOKEN HERE'
294+ Phaxio .webhook_token = ' YOUR WEBHOOK TOKEN HERE'
295295 url = request.original_url
296296
297297 Rails .logger.debug " URL: " + url
298298 Rails .logger.debug " Signature: " + signature
299299 Rails .logger.debug " params: " + params.inspect
300300 Rails .logger.debug " webhook_params: " + webhook_params.to_h.inspect
301-
302- if Phaxio ::Callback .valid_signature? signature, url, webhook_params.to_h, file_params
301+
302+ if Phaxio ::Webhook .valid_signature? signature, url, webhook_params.to_h, file_params
303303 Rails .logger.debug " Success"
304304 render plain: ' Success'
305305 else
306- Rails .logger.debug " Invalid callback signature"
307- render plain: ' Invalid callback signature'
306+ Rails .logger.debug " Invalid webhook signature"
307+ render plain: ' Invalid webhook signature'
308308 end
309309 end
310310
0 commit comments