![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Nap is an extremely simple REST client for Ruby. It was built to quickly fire off HTTP requests without having to research net/http internals.
gem 'nap'
require 'rest'
require 'json'
response = REST.get('http://twitter.com/statuses/friends_timeline.json', {},
{:username => '_evan', :password => 'buttonscat'}
)
if response.ok?
timeline = JSON.parse(response.body)
puts(timeline.map do |item|
"#{item['user']['name']}\n\n#{item['text']}"
end.join("\n\n--\n\n"))
elsif response.forbidden?
puts "Are you sure you're `_evan' and your password is the name of your cat?"
else
puts "Something went wrong (#{response.status_code})"
puts response.body
end
If you need more control over the Net::HTTP request you can pass a block to all of the request methods.
response = REST.get('http://google.com') do |http_request|
http_request.open_timeout = 15
http_request.set_debug_output(STDERR)
end
To enable the proxy settings in Nap, you can either use the HTTP_PROXY or http_proxy enviroment variable.
$ env HTTP_PROXY=http://rob:secret@192.167.1.254:665 ruby app.rb
Nap defines one top-level and three main error types which allow you to catch a whole range of exceptions thrown by underlying protocol implementations.
In the most basic case you can rescue from the top-level type to warn about fetching problems.
begin
REST.get('http://example.com/pigeons/12')
rescue REST::Error
puts "[!] Failed to fetch Pigeon number 12."
end
Nap couldn't be the shining beacon in the eternal darkness without help from:
For all other great human beings, please visit the GitHub contributors page.
FAQs
Unknown package
We found that nap 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.