pandexio 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'minitest/autorun'
4
- require_relative '../lib/pandexio.rb'
4
+ require 'pandexio'
5
5
 
6
6
  describe Pandexio do
7
7
  describe "#to_authorized_request" do
@@ -0,0 +1,98 @@
1
+ # encoding: utf-8
2
+
3
+ require "minitest/autorun"
4
+ require "pandexio"
5
+
6
+ describe Pandexio::Request do
7
+ describe "#initialize" do
8
+
9
+ describe "when passing no params" do
10
+
11
+ before do
12
+ @request = Pandexio::Request.new()
13
+ end
14
+
15
+ it "should initialize method as nil" do
16
+ assert_nil(@request.method)
17
+ end
18
+
19
+ it "should initialize path as nil" do
20
+ assert_nil(@request.path)
21
+ end
22
+
23
+ it "should initialize query_parameters as an empty hash" do
24
+ @request.query_parameters.count.must_equal(0)
25
+ end
26
+
27
+ it "should initialize headers as an empty hash" do
28
+ @request.headers.count.must_equal(0)
29
+ end
30
+
31
+ it "should initialize payload as nil" do
32
+ assert_nil(@request.payload)
33
+ end
34
+
35
+ end
36
+
37
+ describe "when passing params" do
38
+
39
+ before do
40
+ @request = Pandexio::Request.new(:method => "test_method", :path => "test_path", :query_parameters => { "a" => "b", "c" => "d" }, :headers => { "w" => "x", "y" => "z" }, :payload => "test_payload")
41
+ end
42
+
43
+ it "should initialize method from params" do
44
+ @request.method.must_equal("test_method")
45
+ end
46
+
47
+ it "should initialize path from params" do
48
+ @request.path.must_equal("test_path")
49
+ end
50
+
51
+ it "should initialize query_parameters from params" do
52
+ @request.query_parameters.count.must_equal(2)
53
+ @request.query_parameters["a"].must_equal("b")
54
+ @request.query_parameters["c"].must_equal("d")
55
+ end
56
+
57
+ it "should initialize headers from params" do
58
+ @request.headers.count.must_equal(2)
59
+ @request.headers["w"].must_equal("x")
60
+ @request.headers["y"].must_equal("z")
61
+ end
62
+
63
+ it "should initialize payload from params" do
64
+ @request.payload.must_equal("test_payload")
65
+ end
66
+
67
+ end
68
+
69
+ end
70
+
71
+ describe "#to_s" do
72
+
73
+ describe "when passing no params" do
74
+
75
+ before do
76
+ @rstr = Pandexio::Request.new().to_s
77
+ end
78
+
79
+ it "returns and empty string" do
80
+ @rstr.must_equal(" \r\nquery_parameters: {}\r\nheaders: {}\r\npayload: ")
81
+ end
82
+
83
+ end
84
+
85
+ describe "when passing params" do
86
+
87
+ before do
88
+ @rstr = Pandexio::Request.new(:method => "test_method", :path => "test_path", :query_parameters => { "a" => "b", "c" => "d" }, :headers => { "w" => "x", "y" => "z" }, :payload => "test_payload").to_s
89
+ end
90
+
91
+ it "returns and empty string" do
92
+ @rstr.must_equal("test_method test_path\r\nquery_parameters: {\"a\"=>\"b\", \"c\"=>\"d\"}\r\nheaders: {\"w\"=>\"x\", \"y\"=>\"z\"}\r\npayload: test_payload")
93
+ end
94
+
95
+ end
96
+
97
+ end
98
+ end
data/test/test_scope.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'minitest/autorun'
4
- require_relative '../lib/scope.rb'
4
+ require 'pandexio'
5
5
 
6
6
  describe Pandexio::Scope do
7
7
  describe "#initialize" do
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'minitest/autorun'
4
- require_relative '../lib/scope_patterns.rb'
4
+ require 'pandexio'
5
5
 
6
6
  describe Pandexio::ScopePatterns do
7
7
 
data/test/test_signer.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'minitest/autorun'
4
- require_relative '../lib/signer.rb'
4
+ require 'pandexio'
5
5
 
6
6
  describe Pandexio::Signer do
7
7
  describe "#scope_and_sign" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pandexio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-09 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2015-08-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: json
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.8.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.8.1
14
30
  description: Pandexio SDK for Ruby
15
31
  email: bvarilone@gmail.com
16
32
  executables: []
@@ -19,6 +35,7 @@ extra_rdoc_files: []
19
35
  files:
20
36
  - README.md
21
37
  - Rakefile
38
+ - lib/http_client.rb
22
39
  - lib/pandexio.rb
23
40
  - lib/request.rb
24
41
  - lib/scope.rb
@@ -29,7 +46,9 @@ files:
29
46
  - lib/signing_mechanisms.rb
30
47
  - lib/signing_options.rb
31
48
  - test/test_header_signing.rb
49
+ - test/test_http_client.rb
32
50
  - test/test_query_string_signing.rb
51
+ - test/test_request.rb
33
52
  - test/test_scope.rb
34
53
  - test/test_scope_patterns.rb
35
54
  - test/test_signer.rb