
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Nestful is a simple Ruby HTTP/REST client with a sane API.
sudo gem install nestful
Nestful.get 'http://example.com' #=> "body"
# url-encoded form POST
Nestful.post 'http://example.com', :foo => 'bar'
# JSON POST
Nestful.post 'http://example.com', {:foo => 'bar'}, :format => :json
# You can also provide nestled params
Nestful.get 'http://example.com', :nestled => {:vars => 1}
Request
is the base class for making HTTP requests - everthing else is just an abstraction upon it.
Nestful::Request.new(url, options).execute #=> <Nestful::Response>
Valid Request
options are:
Requests are run via the execute
method.
The Endpoint
class provides a single object to work with restful services. The following example does a GET request to the URL; http://example.com/assets/1/
Nestful::Endpoint.new('http://example.com')['assets'][1].get #=> Nestful::Response
If you're building a binding for a REST API, then you should consider using the Resource
class.
class Charge < Nestful::Resource
endpoint 'https://api.stripe.com/v1/charges'
options :auth_type => :bearer, :password => 'sk_bar'
def self.all
self.new(get)
end
def self.find(id)
self.new(get(id))
end
def refund
post(:refund)
end
end
Charge.all #=> []
Charge.find('ch_bar').amount
All HTTP responses are in the form of a Nestful::Response
instance. This contains the raw HTTP response, body, headers and a few helper methods:
response = Nestful.get('http://www.google.com')
response.body #=> '<html>...'
response.headers #=> {'Content-Type' => 'text/html'}
response.status #=> 200
You can also access the decoded body if available, such as for JSON responses:
response = Nestful.get('http://api.stripe.com/v1/charges')
charges = response.decoded
All calls are proxied to the decoded body, so you can access JSON properties like this:
charges = Nestful.get('http://api.stripe.com/v1/charges')['data']
Parts of the connection code were inspired from ActiveResource.
FAQs
Unknown package
We found that nestful 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
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.