emmy-http-client 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -36
- data/lib/emmy_http/client/client.rb +1 -0
- data/lib/emmy_http/client/version.rb +1 -1
- metadata +2 -5
- data/bin/console +0 -14
- data/bin/setup +0 -7
- data/lib/emmy_http/client/agent.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52d1bbbfc9f210e48a6f7d8dd98631f3783e9202
|
4
|
+
data.tar.gz: 85c2d04387f9e94b8ec898f9c309e3521db19fe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a43d921938468c52fa7cfa850b5a42671831043a277f5207179e9bbb5f01905fba0bd30674337a9bc16b1e836153c333c38bdc132edb03a806f912df8401658
|
7
|
+
data.tar.gz: fb891ed56dc5f0a45622f9c88e460fe9c15a1a3bb77df63db70be8bcf182f7c6a49e79a63e8cb59193baff7e4c099ffb3be22a2b0179ba6f02e0e83819e1a109
|
data/README.md
CHANGED
@@ -1,26 +1,20 @@
|
|
1
|
-
#
|
1
|
+
# EmmyHttp::Client
|
2
2
|
|
3
|
-
|
3
|
+
This gem is part of Emmy framework
|
4
4
|
|
5
|
-
|
5
|
+
> gem install emmy
|
6
6
|
|
7
|
-
##
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
7
|
+
## Usage
|
10
8
|
|
11
9
|
```ruby
|
12
|
-
|
10
|
+
response = Emmy.request(url: "http://httpbin.org/get").sync
|
13
11
|
```
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install emmy-http-client
|
13
|
+
or,
|
22
14
|
|
23
|
-
|
15
|
+
```ruby
|
16
|
+
request = Emmy.request(url: "http://httpbin.org/post", form: {param: 'foo'}).post.sync
|
17
|
+
```
|
24
18
|
|
25
19
|
Long way,
|
26
20
|
|
@@ -30,27 +24,16 @@ operation = EmmyHttp::Operation.new(request, EmmyHttp::Client::Adapter)
|
|
30
24
|
response = operation.sync
|
31
25
|
```
|
32
26
|
|
33
|
-
|
27
|
+
### Asynchronous requests
|
34
28
|
|
35
29
|
```ruby
|
36
|
-
|
30
|
+
Emmy.run_block {
|
31
|
+
responses = {
|
32
|
+
get_request: Emmy.request!(url: "http://httpbin.org/get")
|
33
|
+
post_request: Emmy.request!(url: "http://httpbin.org/post", type: "POST", form: {param: 'foo'})
|
34
|
+
}.sync
|
35
|
+
|
36
|
+
p responses[:get_request]
|
37
|
+
p responses[:post_request]
|
38
|
+
}
|
37
39
|
```
|
38
|
-
|
39
|
-
|
40
|
-
```ruby
|
41
|
-
request = Emmy.http.defauls(post: "http://google.com", body: {param: 'foo'})
|
42
|
-
```
|
43
|
-
|
44
|
-
## Development
|
45
|
-
|
46
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
47
|
-
|
48
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
49
|
-
|
50
|
-
## Contributing
|
51
|
-
|
52
|
-
1. Fork it ( https://github.com/inre/emmy-http-client/fork )
|
53
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
54
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
55
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
56
|
-
5. Create a new Pull Request
|
@@ -37,6 +37,7 @@ module EmmyHttp
|
|
37
37
|
conn.comm_inactivity_timeout = request.timeouts.inactivity
|
38
38
|
|
39
39
|
conn.on :connect do
|
40
|
+
conn.start_tls(client.request.ssl ? client.request.ssl.serializable_hash : {}) if client.request.ssl?
|
40
41
|
send_request
|
41
42
|
change_state(:wait_response)
|
42
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emmy-http-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- inre
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http_parser.rb
|
@@ -123,12 +123,9 @@ files:
|
|
123
123
|
- README.md
|
124
124
|
- Rakefile
|
125
125
|
- TODO.md
|
126
|
-
- bin/console
|
127
|
-
- bin/setup
|
128
126
|
- emmy-http-client.gemspec
|
129
127
|
- lib/emmy_http/client.rb
|
130
128
|
- lib/emmy_http/client/adapter.rb
|
131
|
-
- lib/emmy_http/client/agent.rb
|
132
129
|
- lib/emmy_http/client/client.rb
|
133
130
|
- lib/emmy_http/client/cookie.rb
|
134
131
|
- lib/emmy_http/client/encoding.rb
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "emmy_http/client"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/setup
DELETED