aws_agcod 0.0.8 → 0.0.9
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c62905715b36e6f50edf5a79a5f55027940effc6
|
4
|
+
data.tar.gz: c7406bab523f76258c16bd98f04e076e9a9da1ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 069a1abb237039f17a2fef84de221671bad676b3705a8740207224d2bdd8f860124faa16c6532f8d58b64333abe421de5aa4a7c0a680425c0f57951360d4b6ed
|
7
|
+
data.tar.gz: 532311192f70cbde08458aec5b67730f7c54473869f7ce19d5767a5b291a57abe7ec288d692399583343aef6de0b8f83b6eb43e0570a0b401b293ac483864b13
|
@@ -8,7 +8,7 @@ module AGCOD
|
|
8
8
|
|
9
9
|
CURRENCIES = %w(USD EUR JPY CNY CAD)
|
10
10
|
|
11
|
-
def_delegators :@response, :success?, :error_message
|
11
|
+
def_delegators :@response, :status, :success?, :error_message
|
12
12
|
|
13
13
|
def initialize(request_id, amount, currency = "USD")
|
14
14
|
unless CURRENCIES.include?(currency.to_s)
|
data/lib/aws_agcod/version.rb
CHANGED
@@ -3,6 +3,7 @@ require "aws_agcod/cancel_gift_card"
|
|
3
3
|
|
4
4
|
describe AGCOD::CancelGiftCard do
|
5
5
|
let(:partner_id) { "Testa" }
|
6
|
+
let(:response) { spy }
|
6
7
|
|
7
8
|
before do
|
8
9
|
AGCOD.configure do |config|
|
@@ -19,9 +20,29 @@ describe AGCOD::CancelGiftCard do
|
|
19
20
|
expect(action).to eq("CancelGiftCard")
|
20
21
|
expect(params["creationRequestId"]).to eq(request_id)
|
21
22
|
expect(params["gcId"]).to eq(gc_id)
|
22
|
-
end.and_return(
|
23
|
+
end.and_return(response)
|
23
24
|
|
24
25
|
AGCOD::CancelGiftCard.new(request_id, gc_id)
|
25
26
|
end
|
26
27
|
end
|
28
|
+
|
29
|
+
shared_context "request with response" do
|
30
|
+
let(:gc_id) { "BAR" }
|
31
|
+
let(:creation_request_id) { "BAZ" }
|
32
|
+
let(:status) { "SUCCESS" }
|
33
|
+
let(:request) { AGCOD::CancelGiftCard.new(creation_request_id, gc_id) }
|
34
|
+
|
35
|
+
before do
|
36
|
+
allow(AGCOD::Request).to receive(:new) { double(response: response) }
|
37
|
+
allow(response).to receive(:status) { status }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context "#status" do
|
42
|
+
include_context "request with response"
|
43
|
+
|
44
|
+
it "returns the response status" do
|
45
|
+
expect(request.status).to eq(status)
|
46
|
+
end
|
47
|
+
end
|
27
48
|
end
|
@@ -49,12 +49,14 @@ describe AGCOD::CreateGiftCard do
|
|
49
49
|
let(:expiration_date) { "Wed Mar 12 22:59:59 UTC 2025" }
|
50
50
|
let(:gc_id) { "BAR" }
|
51
51
|
let(:creation_request_id) { "BAZ" }
|
52
|
+
let(:status) { "SUCCESS" }
|
52
53
|
let(:payload) { {"gcClaimCode" => claim_code, "gcId" => gc_id, "creationRequestId" => creation_request_id, "gcExpirationDate" => expiration_date} }
|
53
54
|
let(:request) { AGCOD::CreateGiftCard.new(request_id, amount, currency) }
|
54
55
|
|
55
56
|
before do
|
56
57
|
allow(AGCOD::Request).to receive(:new) { double(response: response) }
|
57
58
|
allow(response).to receive(:payload) { payload }
|
59
|
+
allow(response).to receive(:status) { status }
|
58
60
|
end
|
59
61
|
end
|
60
62
|
|
@@ -89,4 +91,12 @@ describe AGCOD::CreateGiftCard do
|
|
89
91
|
expect(request.request_id).to eq(creation_request_id)
|
90
92
|
end
|
91
93
|
end
|
94
|
+
|
95
|
+
context "#status" do
|
96
|
+
include_context "request with response"
|
97
|
+
|
98
|
+
it "returns the response status" do
|
99
|
+
expect(request.status).to eq(status)
|
100
|
+
end
|
101
|
+
end
|
92
102
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_agcod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xenor Chang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|