https://github.com/Fingertips/nap
Nap is a really simple REST library.
https://github.com/Fingertips/nap
Keywords from Contributors
cocoapods dependency-manager mac objective-c activerecord deployment apps fastlane screenshots feature-flag
Last synced: about 22 hours ago
JSON representation
Repository metadata
Nap is a really simple REST library.
- Host: GitHub
- URL: https://github.com/Fingertips/nap
- Owner: Fingertips
- License: mit
- Created: 2008-08-12T08:52:10.000Z (over 17 years ago)
- Default Branch: master
- Last Pushed: 2020-02-29T10:02:15.000Z (about 6 years ago)
- Last Synced: 2026-02-18T17:28:57.100Z (13 days ago)
- Language: Ruby
- Homepage:
- Size: 431 KB
- Stars: 33
- Watchers: 3
- Forks: 9
- Open Issues: 0
- Releases: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
README.md
Nap
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.
Example
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
Advanced request configuration
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
Proxy support
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
Exceptions
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.
- REST::Error: Any type of error
- REST::Error::Timeout: Read timeouts of various sorts
- REST::Error::Connection: Connection errors caused by dropped sockets
- REST::Error::Protocol: Request failed because of a problem when handling the HTTP request or response
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
Contributions
Nap couldn't be the shining beacon in the eternal darkness without help from:
- Eloy Durán
- Joshua Sierles
- Thijs van der Vossen
For all other great human beings, please visit the GitHub contributors page.
Changes from 1.0.0 to 1.1.0
- REST::Request now allows all HTTP verbs to send a body entity.
Changes from 0.8.0 to 1.0.0
- Removed REST::DisconnectedError, please use REST::Error::Connection instead.
Owner metadata
- Name: Fingertips
- Login: Fingertips
- Email:
- Kind: organization
- Description:
- Website: http://www.fngtps.com
- Location: Amsterdam, the Netherlands
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/20369?v=4
- Repositories: 78
- Last ynced at: 2023-04-09T06:01:39.196Z
- Profile URL: https://github.com/Fingertips
GitHub Events
Total
Last Year
Committers metadata
Last synced: 2 days ago
Total Commits: 109
Total Committers: 9
Avg Commits per committer: 12.111
Development Distribution Score (DDS): 0.138
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Manfred Stienstra | m****d@f****m | 94 |
| Eloy Durán | e****e@g****m | 5 |
| Orta Therox | o****x@g****m | 2 |
| Kyle Fuller | i****x@k****k | 2 |
| Joshua Sierles | j****s@g****m | 2 |
| dependabot[bot] | 4****] | 1 |
| Thijs van der Vossen | t****s@f****m | 1 |
| Felix Krause | K****x | 1 |
| Clemens Gruber | c****u@g****m | 1 |
Committer domains:
- fngtps.com: 2
- kylefuller.co.uk: 1
Issue and Pull Request metadata
Last synced: 6 days ago
Total issues: 2
Total pull requests: 11
Average time to close issues: 25 days
Average time to close pull requests: 17 days
Total issue authors: 1
Total pull request authors: 8
Average comments per issue: 6.0
Average comments per pull request: 4.55
Merged pull request: 9
Bot issues: 0
Bot pull requests: 1
Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- alloy (2)
Top Pull Request Authors
- alloy (3)
- Manfred (2)
- clemensg (1)
- kylef (1)
- KrauseFx (1)
- dependabot[bot] (1)
- orta (1)
- neonichu (1)
Top Issue Labels
Top Pull Request Labels
- dependencies (1)
Package metadata
- Total packages: 2
-
Total downloads:
- rubygems: 338,784,199 total
- Total docker downloads: 914,262,254
- Total dependent packages: 17 (may contain duplicates)
- Total dependent repositories: 31,250 (may contain duplicates)
- Total versions: 30
- Total maintainers: 3
gem.coop: nap
Nap is a really simple REST library. It allows you to perform HTTP requests with minimal amounts of code.
- Homepage: https://github.com/Fingertips/nap
- Documentation: http://www.rubydoc.info/gems/nap/
- Licenses: MIT
- Latest release: 1.1.0 (published about 10 years ago)
- Last Synced: 2026-03-01T15:32:07.172Z (2 days ago)
- Versions: 15
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 169,399,848 Total
- Docker Downloads: 457,131,127
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.098%
- Downloads: 0.153%
- Docker downloads count: 0.24%
- Maintainers (3)
rubygems.org: nap
Nap is a really simple REST library. It allows you to perform HTTP requests with minimal amounts of code.
- Homepage: https://github.com/Fingertips/nap
- Documentation: http://www.rubydoc.info/gems/nap/
- Licenses: MIT
- Latest release: 1.1.0 (published about 10 years ago)
- Last Synced: 2026-02-28T23:22:47.715Z (3 days ago)
- Versions: 15
- Dependent Packages: 17
- Dependent Repositories: 31,250
- Downloads: 169,384,351 Total
- Docker Downloads: 457,131,127
-
Rankings:
- Downloads: 0.172%
- Dependent repos count: 0.196%
- Docker downloads count: 0.342%
- Dependent packages count: 1.232%
- Average: 3.372%
- Stargazers count: 9.124%
- Forks count: 9.168%
- Maintainers (3)
Dependencies
- peck >= 0
- rake >= 0
- peck 0.5.4
- rake 12.3.3
- peck ~> 0.5 development
- rake ~> 12 development
Score: 26.642601258641733