http_transport_provider 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.gitignore +1 -0
- data/.travis.yml +1 -0
- data/README.md +11 -8
- data/http_transport_provider.gemspec +1 -1
- data/lib/http_transport_provider/request.rb +16 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 292836e8b724ca01543917d37caa4ea5967a8292
|
4
|
+
data.tar.gz: b13e1333ad781b3f5703722558dc6718e31170ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 967a5bb4e363b33f7e14ea3bc43e55a9aed82f1c2b2e561b4314350f2d785a99719bf8b0e33cc437646a4f5e34ddd7c3bd4b8f3899522a6ea68e60571fa12cb7
|
7
|
+
data.tar.gz: bf1d8e2b12266a782c83130f01bffad3f2e4fcaf9f083fa46c0b0a7aa34d00cc3aca4dee0acce698669adfa4afa53d3c4272b7f40655689b69c042f945fc59d8
|
data/.DS_Store
CHANGED
Binary file
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -17,35 +17,38 @@ Or install it yourself as:
|
|
17
17
|
$ gem install http_transport_provider
|
18
18
|
|
19
19
|
## Usage
|
20
|
-
The provider currently only supports GET & POST.
|
20
|
+
The provider currently only supports GET & POST. In these examples _'my_identifier'_ is the name you are giving your instance.
|
21
21
|
|
22
22
|
GET:
|
23
23
|
```ruby
|
24
24
|
htp = HttpTransportProvider.new('my_identifier')
|
25
|
-
htp.configure({'verb' => "GET")
|
26
|
-
htp.send_message('http://localhost:3000',
|
25
|
+
htp.configure({'verb' => "GET"})
|
26
|
+
htp.send_message('http://localhost:3000', 'body' => {'id' => 1})
|
27
27
|
htp.receive_message
|
28
28
|
```
|
29
29
|
|
30
30
|
GET with parameters:
|
31
31
|
```ruby
|
32
32
|
htp = HttpTransportProvider.new('my_identifier')
|
33
|
-
htp.configure({'verb' => "GET")
|
34
|
-
htp.send_message('http://localhost:3000',
|
33
|
+
htp.configure({'verb' => "GET"})
|
34
|
+
htp.send_message('http://localhost:3000', 'body' => {})
|
35
35
|
htp.receive_message
|
36
36
|
```
|
37
37
|
|
38
38
|
POST:
|
39
39
|
```ruby
|
40
40
|
htp = HttpTransportProvider.new('my_identifier')
|
41
|
-
htp.configure({'verb' => "POST")
|
42
|
-
htp.send_message('http://localhost:3000',
|
41
|
+
htp.configure({'verb' => "POST"})
|
42
|
+
htp.send_message('http://localhost:3000', 'body' => {'id' => 1})
|
43
43
|
htp.receive_message
|
44
44
|
```
|
45
45
|
|
46
46
|
Basic Auth:
|
47
47
|
```ruby
|
48
|
-
|
48
|
+
htp = HttpTransportProvider.new('my_identifier')
|
49
|
+
htp.configure({'verb' => 'POST', 'credentials' => {'username' => 'user', 'password' => 'secret'}})
|
50
|
+
htp.send_message('http://localhost:3000', 'body' => {'id' => 1})
|
51
|
+
htp.receive_message
|
49
52
|
```
|
50
53
|
|
51
54
|
## Development
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "http_transport_provider"
|
7
|
-
spec.version = "0.1.
|
7
|
+
spec.version = "0.1.1"
|
8
8
|
spec.authors = ["Tiaan van Deventer"]
|
9
9
|
spec.email = ["tiaanvandeventer@gmail.com"]
|
10
10
|
|
@@ -7,10 +7,24 @@
|
|
7
7
|
if verb.upcase == 'GET'
|
8
8
|
if params.empty? == false
|
9
9
|
uri.query = URI.encode_www_form(params)
|
10
|
+
path = "#{uri.path}#{'?' + uri.query if uri.query}"
|
11
|
+
else
|
12
|
+
if uri.path == ''
|
13
|
+
path = '/'
|
14
|
+
else
|
15
|
+
path = uri.path
|
16
|
+
end
|
10
17
|
end
|
11
|
-
|
18
|
+
|
19
|
+
request = Net::HTTP::Get.new path
|
12
20
|
elsif verb.upcase == 'POST'
|
13
|
-
|
21
|
+
if uri.path != ''
|
22
|
+
path = uri.path
|
23
|
+
else
|
24
|
+
path = '/'
|
25
|
+
end
|
26
|
+
|
27
|
+
request = Net::HTTP::Post.new(path)
|
14
28
|
if params.empty? == false
|
15
29
|
request.set_form_data(params)
|
16
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_transport_provider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiaan van Deventer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: soar_transport_api
|