
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Pokey is a Ruby gem designed to easily simulate webhooks / other HTTP requests common to a production environment.
Add this line to your application's Gemfile:
gem 'pokey'
And then execute:
$ bundle
Or install it yourself as:
$ gem install pokey
If you're using Rails, create the initializer by running:
$ rails g pokey:install
Otherwise, create a new file in your initializers directory named pokey.rb
. You'll be
setting the default hook directory and (optionally) defining custom hooks here.
Pokey.configure do |config|
config.hook_dir = "app/pokey" # Defaults to app/pokey
config.run_on = [:development, :qa] # Only set environments you want pokey to
# simulate requests for. If not using Rails,
# this currently has no effect
config.add_hook do |hook|
hook.destination = "/my/webhook/endpoint"
hook.data = {
name: "Test endpoint",
endpoint_id: 1
}
hook.interval = 20 # in seconds
hook.http_method = :post # supports GET and POST for right now
end
end
If you would like to add many hooks to your project, you can place them in the hook_dir
you specified in the initializer. If you're using Rails, you can run
$ rails g pokey:hook sendgrid_event
to create a new Pokey::Hook
template. Otherwise, create a file like the following:
# app/pokey/sendgrid_event_hook.rb
class SendgridEventHook < Pokey::Hook
def destination
if Rails.env.development?
"http://localhost:3000/api/sendgrid/events"
elsif Rails.env.qa?
"http://our-qa-environment.domain.com/api/sendgrid/events"
end
end
def data
{
name: event,
email: email,
category: category,
useragent: user_agent,
ip: ip_address,
stmp_id: stmp_id
}
end
def http_method
:post
end
def interval
5
end
protected
def stmp_id
"<54d39f028d4ab_#{Random.rand(200000)}@web3.mail>"
end
def ip_address
"192.168.0.#{Random.rand(255)}"
end
def user_agent
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36"
end
def category
[
["User", "Welcome Email"],
["User", "Forgot Password"]
].sample
end
def event
['delivered', 'open', 'click'].sample
end
def email
"autogen-#{Random.rand(200)}@domain.com"
end
end
As your data will inevitably get more complex to simulate actual events,
Pokey::Hook
subclasses are preferred over ad-hoc hook definitions.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that pokey demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.