hippie 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +41 -0
- data/hippie.gemspec +23 -0
- data/lib/cacert.pem +5026 -0
- data/lib/hippie.rb +110 -0
- data/makefile +2 -0
- data/tests/hippie_test.rb +90 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 82c5deb0ce5f8c497fade22b08b618fe56079c34
|
4
|
+
data.tar.gz: 44c5511dab804cc882a7a2d5597dc34a1bbd0093
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 37ee47fe5c1ce78a799a0473aea5eebe81a31c617262508aa0361ab8da3bf870ca5a2d4af4bce1d40381f993547f0cdae98c392301a6f14384344e00d156ead9
|
7
|
+
data.tar.gz: 49f8d631d06da861ffb83b8374bcb5e2561fa46970452dc7dcb62f87d4719a171829711c3bffed7ea9bdb4229afcb967b05fbe9b4925340703352d446366c9db
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Cyril David
|
2
|
+
2014 Martin Manelli
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
12
|
+
all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Hippie: Simple HTTP wrapper for Net::HTTP
|
2
|
+
|
3
|
+
## Usage
|
4
|
+
Here's an example of a GET request:
|
5
|
+
|
6
|
+
```ruby
|
7
|
+
require 'hippie'
|
8
|
+
|
9
|
+
response = Hippie.get("http://example.com")
|
10
|
+
|
11
|
+
# Now you have these methods available
|
12
|
+
response.status #=> Number with the status code
|
13
|
+
response.headers #=> Hash with the response headers
|
14
|
+
response.body #=> String with the response body
|
15
|
+
response.error? #=> true / false
|
16
|
+
response.valid? #=> true / false
|
17
|
+
```
|
18
|
+
|
19
|
+
You can also pass parameters with a query string:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
# GET http://example.com?foo=bar
|
23
|
+
Hippie.get("http://example.com", params: { foo: "bar" })
|
24
|
+
```
|
25
|
+
|
26
|
+
If you want to send data with a POST request, you can add a `data`
|
27
|
+
option with the value.
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
Hippie.post("http://example.com", data: "hello world")
|
31
|
+
```
|
32
|
+
|
33
|
+
For Basic Authentication, you can provide the option `auth`, which
|
34
|
+
should contain an array with the username and password:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
Hippie.get("http://example.com", auth: ["username", "password"])
|
38
|
+
```
|
39
|
+
|
40
|
+
# Disclaimer
|
41
|
+
This is a fork of the awesome 'requests' gem from cyx (https://github.com/cyx/requests)
|
data/hippie.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'hippie'
|
3
|
+
s.version = '0.5.0'
|
4
|
+
s.summary = 'Simple HTTP'
|
5
|
+
s.description = 'Simple wrapper for Net::HTTP'
|
6
|
+
s.author = 'Martin Manelli'
|
7
|
+
s.email = 'manelli.ml@gmail.com'
|
8
|
+
s.homepage = 'http://github.com/manelli/hippie'
|
9
|
+
s.license = 'MIT'
|
10
|
+
s.require_paths = ['lib']
|
11
|
+
|
12
|
+
s.files = Dir[
|
13
|
+
'LICENSE',
|
14
|
+
'README.md',
|
15
|
+
'makefile',
|
16
|
+
'lib/hippie.rb',
|
17
|
+
'lib/cacert.pem',
|
18
|
+
'tests/hippie_test.rb',
|
19
|
+
'hippie.gemspec'
|
20
|
+
]
|
21
|
+
|
22
|
+
s.add_development_dependency 'cutest', '~> 1.2', '>= 1.2.0'
|
23
|
+
end
|