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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11e54fafb755b94f2d1af995804b3edd0673cf0e
4
- data.tar.gz: ec19734274a2649d80b8e887ffc7fb9d8b98067e
3
+ metadata.gz: 292836e8b724ca01543917d37caa4ea5967a8292
4
+ data.tar.gz: b13e1333ad781b3f5703722558dc6718e31170ac
5
5
  SHA512:
6
- metadata.gz: 65641ecc16b5501b3c24c4fd872617de0867577c84f4aa4ec4f6a7f45d1eecd1c8a28464740fd2959b350866e19988f20d6524af9f088dac17fcf1258e87b9b9
7
- data.tar.gz: 4416a3e0e564d6d01b5f27f0fab4931aecc62768dfe3459492ec61c22295785d148db48b0854f882d1a6a9623e52ad3f80cac6696878ba79ad0855ecc1bbb9c0
6
+ metadata.gz: 967a5bb4e363b33f7e14ea3bc43e55a9aed82f1c2b2e561b4314350f2d785a99719bf8b0e33cc437646a4f5e34ddd7c3bd4b8f3899522a6ea68e60571fa12cb7
7
+ data.tar.gz: bf1d8e2b12266a782c83130f01bffad3f2e4fcaf9f083fa46c0b0a7aa34d00cc3aca4dee0acce698669adfa4afa53d3c4272b7f40655689b69c042f945fc59d8
data/.DS_Store CHANGED
Binary file
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
@@ -1,5 +1,6 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
+ - 1.9.3
4
5
  - 2.3.0
5
6
  before_install: gem install bundler -v 1.12.5
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', {'body' => {}})
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', {'body' => {'id' => 1}})
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', {'body' => {'id' => 1}})
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
- message = {'body' => {}, 'credentials' => {'username' => 'user', 'password' => 'secret'}}
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.0"
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
- request = Net::HTTP::Get.new uri
18
+
19
+ request = Net::HTTP::Get.new path
12
20
  elsif verb.upcase == 'POST'
13
- request = Net::HTTP::Post.new(uri)
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.0
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-06-17 00:00:00.000000000 Z
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