vault-invoice-builder-client 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +11 -3
- data/lib/vault-invoice-builder-client/client.rb +3 -2
- data/lib/vault-invoice-builder-client/version.rb +1 -1
- data/test/client_test.rb +7 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d133898637556b60b1b42dfd36ec3c9ec334c229
|
4
|
+
data.tar.gz: 745b364b00e69abd3bbb3c0ac2ce590084193023
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a91fe5e9f61ad580e9f6a49bdc715919ced237fd54ea3c5626728c14de081401249c40b351a35da87cec476da5bfbcb85107fbc2f089b4c3cc51a1b7b5f8388a
|
7
|
+
data.tar.gz: 091b769faab4fbd7cede084bf253e8bd65066bb6974e2c0a6f95ee842c03dfc056659219c1938cd1c178c3db2bd9be7646db15fba407ff85f7549725153953fb
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
vault-invoice-builder-client (0.0.
|
4
|
+
vault-invoice-builder-client (0.0.5)
|
5
5
|
excon
|
6
6
|
multi_json
|
7
7
|
yajl-ruby
|
@@ -12,24 +12,31 @@ GEM
|
|
12
12
|
ansi (1.5.0)
|
13
13
|
byebug (5.0.0)
|
14
14
|
columnize (= 0.9.0)
|
15
|
+
coderay (1.1.1)
|
15
16
|
columnize (0.9.0)
|
16
|
-
excon (0.
|
17
|
+
excon (0.56.0)
|
17
18
|
guard-compat (1.2.1)
|
18
19
|
guard-minitest (2.4.4)
|
19
20
|
guard-compat (~> 1.2)
|
20
21
|
minitest (>= 3.0)
|
21
22
|
logfmt (0.0.7)
|
23
|
+
method_source (0.8.2)
|
22
24
|
mini_portile (0.6.2)
|
23
25
|
minitest (4.7.5)
|
24
26
|
multi_json (1.11.1)
|
25
27
|
nokogiri (1.6.6.2)
|
26
28
|
mini_portile (~> 0.6.0)
|
29
|
+
pry (0.10.4)
|
30
|
+
coderay (~> 1.1.0)
|
31
|
+
method_source (~> 0.8.1)
|
32
|
+
slop (~> 3.4)
|
27
33
|
rack (1.6.4)
|
28
34
|
rack-test (0.6.3)
|
29
35
|
rack (>= 1.0)
|
30
36
|
rake (10.4.2)
|
31
37
|
rr (1.1.2)
|
32
38
|
scrolls (0.3.8)
|
39
|
+
slop (3.6.0)
|
33
40
|
turn (0.9.7)
|
34
41
|
ansi
|
35
42
|
minitest (~> 4)
|
@@ -51,6 +58,7 @@ PLATFORMS
|
|
51
58
|
DEPENDENCIES
|
52
59
|
byebug
|
53
60
|
multi_json
|
61
|
+
pry
|
54
62
|
rake
|
55
63
|
rr
|
56
64
|
vault-invoice-builder-client!
|
@@ -58,4 +66,4 @@ DEPENDENCIES
|
|
58
66
|
yard
|
59
67
|
|
60
68
|
BUNDLED WITH
|
61
|
-
1.
|
69
|
+
1.15.4
|
@@ -36,15 +36,16 @@ module Vault::InvoiceBuilder
|
|
36
36
|
#
|
37
37
|
# @param statement_url [String] An encrypted URL to an object matching the
|
38
38
|
# statement format described in the `Vault::InvoiceBuilder` README.
|
39
|
+
# @param json_size [Integer] The size of the json statement in bytes
|
39
40
|
# @raise [Excon::Errors::HTTPStatusError] Raised if the server returns an
|
40
41
|
# unsuccessful HTTP status code.
|
41
42
|
# @return [Excon::Response] The response object.
|
42
|
-
def post_url(statement_url)
|
43
|
+
def post_url(statement_url, json_size=nil)
|
43
44
|
connection = Excon.new(@url)
|
44
45
|
response = connection.post(
|
45
46
|
path: "/statements",
|
46
47
|
headers: {'Content-Type' => 'application/json'},
|
47
|
-
body: JSON.generate(url: statement_url),
|
48
|
+
body: JSON.generate(url: statement_url, json_size: json_size),
|
48
49
|
expects: [202])
|
49
50
|
end
|
50
51
|
|
data/test/client_test.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
require 'multi_json'
|
3
|
+
require 'pry'
|
3
4
|
|
4
5
|
class ClientTest < Vault::TestCase
|
5
6
|
include Vault::Test::EnvironmentHelpers
|
@@ -133,7 +134,7 @@ class ClientTest < Vault::TestCase
|
|
133
134
|
|
134
135
|
# Client.post_url makes a POST request to the canonical statement drain API
|
135
136
|
def test_post_url_with_url
|
136
|
-
json = { url: 'http://encrypted.url.example' }
|
137
|
+
json = { url: 'http://encrypted.url.example', json_size: 100 }
|
137
138
|
Excon.stub(method: :post) do |request|
|
138
139
|
assert_equal('vault-invoice-builder.herokuapp.com', request[:host])
|
139
140
|
assert_equal(443, request[:port])
|
@@ -141,10 +142,13 @@ class ClientTest < Vault::TestCase
|
|
141
142
|
assert_equal('application/json', request[:headers]['Content-Type'])
|
142
143
|
assert_equal(json, MultiJson.load(request[:body], {symbolize_keys: true}))
|
143
144
|
Excon.stubs.pop
|
144
|
-
{status: 202}
|
145
|
+
{status: 202, body: JSON.generate(url: 'http://encrypted.url.example', json_size: 100)}
|
145
146
|
end
|
146
|
-
response = @client.post_url('http://encrypted.url.example')
|
147
|
+
response = @client.post_url('http://encrypted.url.example', 100)
|
148
|
+
doc = MultiJson.load(response.body, symbolize_keys: true)
|
147
149
|
assert_equal(202, response.status)
|
150
|
+
assert_equal('http://encrypted.url.example', doc[:url])
|
151
|
+
assert_equal(100, doc[:json_size])
|
148
152
|
end
|
149
153
|
|
150
154
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vault-invoice-builder-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Continanza
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2017-08-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: excon
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.5.1
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: A simple wrapper for the Vault::InvoiceBuilder HTTP API
|