datacash 0.0.1 → 0.0.2

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: fcc6b1f0993e561e5b5e93d37d6e4cef4445bc8e
4
- data.tar.gz: 133a4c6c605c49911cc3e02d644d2c80503a0dc2
3
+ metadata.gz: ff792474ed779f94f4a03035d6bc68556197e980
4
+ data.tar.gz: ce0eb169e211c1202fe73be2bf722b93e1106a91
5
5
  SHA512:
6
- metadata.gz: 0c06d551c2beedc9015f32c8e761d8e220c176eb02c7a4c6e58cdf9a4ec3595b73a8983dc2636c125bed7b94bb755cdc8781493d695a171711e06feb29855601
7
- data.tar.gz: b93e1fad07c9ebc94de5017339acdcc9e53b40f0ca59eae483ccd1418697cbd88feab2166a92acbef1a993a3c4981331058e8053e9399a281c0115a532b976a7
6
+ metadata.gz: 71208f0693b882aa07348fc8e9646fbb81c8787f5b20e738ea51a737be0ac885238bd2ce7ae6865380503ea769e78ed23d97e5f1b2b9230e566b8479ce590731
7
+ data.tar.gz: 705565a076ba7ee22ca8704efac62258300ce13daf21cc69e32a21fb1b83e41856c0f1f143768c3c92a3055bf076609cdbdf1d9e126354e1bbe3e1f177902ff6
@@ -52,6 +52,7 @@ module Datacash
52
52
 
53
53
  def handle_response(&block)
54
54
  response = Response::Response.new(parse_response_to_hash(yield))
55
+ response.raw = yield
55
56
  if response.reason =~ /invalid client\/pass/i
56
57
  raise AuthenticationError, response
57
58
  end
@@ -1,6 +1,8 @@
1
1
  module Datacash
2
2
  module Response
3
3
  class Response < Base
4
+ attr_accessor :raw
5
+
4
6
  key :query_transaction_result, from: 'QueryTxnResult'
5
7
  key :hps_transaction, from: 'HpsTxn'
6
8
 
@@ -1,3 +1,3 @@
1
1
  module Datacash
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -41,7 +41,7 @@ describe Datacash::Client, "#post" do
41
41
  end
42
42
 
43
43
  context "response containing an array of elements" do
44
- let(:response) do
44
+ let(:response_data) do
45
45
  '<?xml version="1.0" encoding="UTF-8"?>'\
46
46
  '<Response>'\
47
47
  '<HpsTxn>'\
@@ -64,7 +64,7 @@ describe Datacash::Client, "#post" do
64
64
 
65
65
  before do
66
66
  stub_request(:post, "https://accreditation.datacash.com/Transaction/cnp_a").
67
- to_return(:status => 200, :body => response)
67
+ to_return(:status => 200, :body => response_data)
68
68
  end
69
69
 
70
70
  it "should return all the elements" do
@@ -73,6 +73,10 @@ describe Datacash::Client, "#post" do
73
73
  attempt.should be_a(Datacash::Response::Attempt)
74
74
  end
75
75
  end
76
+
77
+ it 'should store raw response' do
78
+ subject.post(Datacash::Request::Request.new).raw.should eq(response_data)
79
+ end
76
80
  end
77
81
  end
78
82
 
@@ -93,7 +97,7 @@ describe Datacash::Client, "#post" do
93
97
  '</Request>'
94
98
  end
95
99
 
96
- let(:response) do
100
+ let(:response_data) do
97
101
  '<?xml version="1.0" encoding="UTF-8"?>'\
98
102
  '<Response>'\
99
103
  '<HpsTxn>'\
@@ -117,8 +121,17 @@ describe Datacash::Client, "#post" do
117
121
  it "should send the correct request" do
118
122
  stub_request(:post, "https://accreditation.datacash.com/Transaction/cnp_a").
119
123
  with(body: request).
120
- to_return(:status => 200, :body => response)
124
+ to_return(:status => 200, :body => response_data)
125
+
121
126
  subject.query("12345")
122
127
  end
128
+
129
+
130
+ it 'should store raw response' do
131
+ stub_request(:post, "https://accreditation.datacash.com/Transaction/cnp_a").
132
+ to_return(:status => 200, :body => response_data)
133
+
134
+ subject.query("12345").raw.should eq(response_data)
135
+ end
123
136
  end
124
137
  end
@@ -5,8 +5,8 @@ describe Datacash::Request::Thirdman do
5
5
  describe "#to_xml" do
6
6
  subject { MultiXml.parse(described_class.new.to_xml) }
7
7
 
8
- it "should have a root element of 'Thirdman'" do
9
- subject.should have_key('Thirdman')
8
+ it "should have a root element of 'The3rdMan'" do
9
+ subject.should have_key('The3rdMan')
10
10
  end
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datacash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Williams
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-11 00:00:00.000000000 Z
12
+ date: 2013-07-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder