apruve 1.0.0 → 1.0.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/apruve.rb +1 -1
- data/lib/apruve/version.rb +1 -1
- data/spec/apruve/apruve_spec.rb +1 -1
- metadata +3 -4
- data/spec/apruve/resources/payment_request_spec.rb +0 -153
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ddb4521101f0a5877ffb405e4b8e1f5a3169f7a
|
4
|
+
data.tar.gz: 047c4dfbcfd1551d9d5034f3dbe900c8057a60e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fba5abd0e0cab1753902b25c50cb0a40c6540a90ed60976f1330b9ec8a11301345af38fc87b8102c36abdb2fa62d9c49bdb469ed069280ba6242cced640a70f2
|
7
|
+
data.tar.gz: 3fb4fcc5a61e2f7491f781e333d9292055777ad6f3bff696642044a7f7d1f37b8b1d64fbadc43249ec1ae6b042bb661f7c3e9e14d6e8fc12bd69cd0eb866c96d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -26,7 +26,7 @@ integrate Apruve.
|
|
26
26
|
|
27
27
|
### Create an account on Apruve.
|
28
28
|
|
29
|
-
Have a look though our [Getting Started documentation](https://
|
29
|
+
Have a look though our [Getting Started documentation](https://docs.apruve.com/guides/getting-started-f09a17ef-053e-4eba-9141-6fe8ce3b774d) and be sure to use
|
30
30
|
test.apruve.com for test accounts.
|
31
31
|
|
32
32
|
### Initialize the library
|
@@ -34,7 +34,7 @@ test.apruve.com for test accounts.
|
|
34
34
|
For [test.apruve.com](test.apruve.com)
|
35
35
|
Apruve.configure('YOUR_APRUVE_API_KEY', 'test')
|
36
36
|
|
37
|
-
For [
|
37
|
+
For [app.apruve.com](app.apruve.com)
|
38
38
|
Apruve.configure('YOUR_APRUVE_API_KEY', 'prod')
|
39
39
|
|
40
40
|
### Create an Order
|
data/lib/apruve.rb
CHANGED
data/lib/apruve/version.rb
CHANGED
data/spec/apruve/apruve_spec.rb
CHANGED
@@ -22,7 +22,7 @@ describe 'Apruve' do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
describe 'local' do
|
25
|
-
let (:script_tag) { '<script type="text/javascript" src="https://
|
25
|
+
let (:script_tag) { '<script type="text/javascript" src="https://app.apruve.com/js/v4/apruve.js"></script>' }
|
26
26
|
it 'should print the tag' do
|
27
27
|
Apruve.configure(nil, 'prod')
|
28
28
|
expect(Apruve.js).to eq script_tag
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apruve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Apruve, Inc.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -130,7 +130,6 @@ files:
|
|
130
130
|
- spec/apruve/resources/merchant_spec.rb
|
131
131
|
- spec/apruve/resources/order_item_spec.rb
|
132
132
|
- spec/apruve/resources/order_spec.rb
|
133
|
-
- spec/apruve/resources/payment_request_spec.rb
|
134
133
|
- spec/apruve/resources/subscription_adjustment_spec.rb
|
135
134
|
- spec/apruve/resources/subscription_spec.rb
|
136
135
|
- spec/apruve/resources/webhook_endpoint_spec.rb
|
@@ -169,9 +168,9 @@ test_files:
|
|
169
168
|
- spec/apruve/resources/merchant_spec.rb
|
170
169
|
- spec/apruve/resources/order_item_spec.rb
|
171
170
|
- spec/apruve/resources/order_spec.rb
|
172
|
-
- spec/apruve/resources/payment_request_spec.rb
|
173
171
|
- spec/apruve/resources/subscription_adjustment_spec.rb
|
174
172
|
- spec/apruve/resources/subscription_spec.rb
|
175
173
|
- spec/apruve/resources/webhook_endpoint_spec.rb
|
176
174
|
- spec/apruve/response/apruve_exception_middleware_spec.rb
|
177
175
|
- spec/spec_helper.rb
|
176
|
+
has_rdoc:
|
@@ -1,153 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Apruve::PaymentRequest do
|
4
|
-
before :each do
|
5
|
-
Apruve.configure('f5fbe71d68772d1f562ed6f598b995b3', 'local')
|
6
|
-
end
|
7
|
-
|
8
|
-
let (:line_items) do
|
9
|
-
[
|
10
|
-
Apruve::LineItem.new(
|
11
|
-
title: 'line 1',
|
12
|
-
amount_cents: '1230',
|
13
|
-
price_ea_cents: '123',
|
14
|
-
quantity: 10,
|
15
|
-
description: 'A line item',
|
16
|
-
variant_info: 'small',
|
17
|
-
sku: 'LINE1SKU',
|
18
|
-
vendor: 'acme, inc.',
|
19
|
-
view_product_url: 'http://www.apruve.com/doc'
|
20
|
-
),
|
21
|
-
Apruve::LineItem.new(
|
22
|
-
title: 'line 2',
|
23
|
-
amount_cents: '40'
|
24
|
-
)
|
25
|
-
]
|
26
|
-
end
|
27
|
-
|
28
|
-
let (:payment_request) do
|
29
|
-
Apruve::PaymentRequest.new(
|
30
|
-
merchant_id: '9999',
|
31
|
-
merchant_order_id: 'ABC',
|
32
|
-
amount_cents: 12340,
|
33
|
-
tax_cents: 0,
|
34
|
-
shipping_cents: 0,
|
35
|
-
expire_at: '2014-07-22T00:00:00+00:00',
|
36
|
-
line_items: line_items
|
37
|
-
)
|
38
|
-
end
|
39
|
-
subject { payment_request }
|
40
|
-
|
41
|
-
it { should respond_to(:merchant_id) }
|
42
|
-
it { should respond_to(:merchant_order_id) }
|
43
|
-
it { should respond_to(:amount_cents) }
|
44
|
-
it { should respond_to(:tax_cents) }
|
45
|
-
it { should respond_to(:shipping_cents) }
|
46
|
-
it { should respond_to(:line_items) }
|
47
|
-
it { should respond_to(:api_url) }
|
48
|
-
it { should respond_to(:view_url) }
|
49
|
-
it { should respond_to(:created_at) }
|
50
|
-
it { should respond_to(:updated_at) }
|
51
|
-
|
52
|
-
describe '#to_json' do
|
53
|
-
let(:expected) do
|
54
|
-
"{\"merchant_id\":\"9999\",\"merchant_order_id\":\"ABC\",\"amount_cents\":12340,\"tax_cents\":0,"\
|
55
|
-
"\"shipping_cents\":0,\"expire_at\":\"2014-07-22T00:00:00+00:00\",\"line_items\":[{\"title\":\"line 1\",\"amount_cents\":\"1230\","\
|
56
|
-
"\"price_ea_cents\":\"123\",\"quantity\":10,\"description\":\"A line item\",\"variant_info\":\"small\","\
|
57
|
-
"\"sku\":\"LINE1SKU\",\"vendor\":\"acme, inc.\",\"view_product_url\":\"http://www.apruve.com/doc\"},"\
|
58
|
-
"{\"title\":\"line 2\",\"amount_cents\":\"40\"}]}"
|
59
|
-
end
|
60
|
-
its(:to_json) { should eq expected }
|
61
|
-
end
|
62
|
-
|
63
|
-
describe '#value_string' do
|
64
|
-
let(:expected) do
|
65
|
-
'9999ABC12340002014-07-22T00:00:00+00:00line 1123012310A line itemsmallLINE1SKUacme, inc.http://www.apruve.com/docline 240'
|
66
|
-
end
|
67
|
-
its(:value_string) { should eq expected }
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '#secure_hash' do
|
71
|
-
describe 'no api_key' do
|
72
|
-
let (:error) { 'api_key has not been set. Set it with Apruve.configure(api_key, environment, options)' }
|
73
|
-
before :each do
|
74
|
-
Apruve.configure
|
75
|
-
end
|
76
|
-
it 'should raise' do
|
77
|
-
expect { payment_request.secure_hash }.to raise_error(error)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
describe 'with api_key' do
|
81
|
-
let (:hash) { '7a4df9a9a47e88c3c1957853341d5e9a1abc2028ede3a0a9e4f894a2925a187f' }
|
82
|
-
let (:api_key) { 'an_api_key' }
|
83
|
-
before :each do
|
84
|
-
Apruve.configure(api_key)
|
85
|
-
end
|
86
|
-
it 'should hash' do
|
87
|
-
expect(payment_request.secure_hash).to eq hash
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe '#finalize!' do
|
93
|
-
let (:id) { '89ea2488fe0a5c7bb38aa7f9b088874a' }
|
94
|
-
describe 'success' do
|
95
|
-
# stub out a successful post
|
96
|
-
let! (:stubs) do
|
97
|
-
faraday_stubs do |stub|
|
98
|
-
stub.post("/api/v3/payment_requests/#{id}/finalize") { [201, {}, '{}'] }
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'should do a post' do
|
103
|
-
Apruve::PaymentRequest.finalize!(id)
|
104
|
-
stubs.verify_stubbed_calls
|
105
|
-
end
|
106
|
-
end
|
107
|
-
# stub out a failed post
|
108
|
-
|
109
|
-
end
|
110
|
-
|
111
|
-
describe '#validate' do
|
112
|
-
describe 'no errors' do
|
113
|
-
it 'should not raise' do
|
114
|
-
expect { payment_request.validate }.not_to raise_error
|
115
|
-
end
|
116
|
-
end
|
117
|
-
describe 'errors' do
|
118
|
-
before :each do
|
119
|
-
payment_request.merchant_id = nil
|
120
|
-
end
|
121
|
-
it 'should raise on no merchant_id' do
|
122
|
-
expect { payment_request.validate }.to raise_error(Apruve::ValidationError, '["merchant_id must be set"]')
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
describe '#find' do
|
128
|
-
let (:id) { '89ea2488fe0a5c7bb38aa7f9b088874a' }
|
129
|
-
describe 'success' do
|
130
|
-
let! (:stubs) do
|
131
|
-
faraday_stubs do |stub|
|
132
|
-
stub.get("/api/v3/payment_requests/#{id}") { [200, {}, '{}'] }
|
133
|
-
end
|
134
|
-
end
|
135
|
-
it 'should do a get' do
|
136
|
-
Apruve::PaymentRequest.find(id)
|
137
|
-
stubs.verify_stubbed_calls
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
describe 'not found' do
|
142
|
-
let! (:stubs) do
|
143
|
-
faraday_stubs do |stub|
|
144
|
-
stub.get("/api/v3/payment_requests/#{id}") { [404, {}, 'Not Found'] }
|
145
|
-
end
|
146
|
-
end
|
147
|
-
it 'should raise' do
|
148
|
-
expect { Apruve::PaymentRequest.find(id) }.to raise_error(Apruve::NotFound)
|
149
|
-
stubs.verify_stubbed_calls
|
150
|
-
end
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|