jemquarie 1.2.4 → 1.2.5
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/lib/jemquarie/base.rb +1 -1
- data/lib/jemquarie/parser/expiry.rb +1 -1
- data/lib/jemquarie/parser/service.rb +13 -0
- data/lib/jemquarie/service.rb +29 -0
- data/lib/jemquarie/version.rb +1 -1
- data/lib/jemquarie.rb +2 -0
- data/spec/files/service/fail-date.xml +16 -0
- data/spec/files/service/failure.xml +1 -0
- data/spec/files/service/success.xml +15 -0
- data/spec/lib/service_spec.rb +58 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fb592b248f78020095a9bbc18c2a235ca199aff
|
4
|
+
data.tar.gz: 6abf2638c6f7d1e5412a18c992c6c8339ce9bba7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33b4814421fdd77edf666545811d3808a56ee9c8bdf45939bbbe1e283f381efec0b9e68c7cb87c20462e344dccc6d29b2d639a9066c5d20ed49a57a74b10108d
|
7
|
+
data.tar.gz: 0039afc9be83f53bd8e4168223a19bc59a4b28b5c88eaa1a7bc1cd5b3bd5c600636c4caacef00e29eb7e20f40b157a2e077cb1c694cae14c10e7723a665853e3
|
data/lib/jemquarie/base.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Jemquarie
|
2
|
+
|
3
|
+
class Service < Base
|
4
|
+
|
5
|
+
include Parser::Service
|
6
|
+
|
7
|
+
def date
|
8
|
+
response = @client.call :generate_xml_extract, :message => create_message
|
9
|
+
parse_service_date(response) if response.success?
|
10
|
+
rescue
|
11
|
+
{:error => "An error has occured, please try again later"}
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def create_message
|
17
|
+
{
|
18
|
+
:string => hash_key(Jemquarie.api_key), # base64 encoded of the sha1 hashed api key
|
19
|
+
:string0 => Jemquarie.app_key,
|
20
|
+
:string1 => hash_key(@username),
|
21
|
+
:string2 => hash_key(@password),
|
22
|
+
:string3 => 'your.clients Service Date',
|
23
|
+
:string4 => 'V1.1'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
data/lib/jemquarie/version.rb
CHANGED
data/lib/jemquarie.rb
CHANGED
@@ -5,11 +5,13 @@ require 'jemquarie/parser/cash_transactions'
|
|
5
5
|
require 'jemquarie/parser/expiry'
|
6
6
|
require 'jemquarie/parser/account_details'
|
7
7
|
require 'jemquarie/parser/balance'
|
8
|
+
require 'jemquarie/parser/service'
|
8
9
|
require 'jemquarie/base'
|
9
10
|
require 'jemquarie/importer'
|
10
11
|
require 'jemquarie/expiry'
|
11
12
|
require 'jemquarie/account_details'
|
12
13
|
require 'jemquarie/balance'
|
14
|
+
require 'jemquarie/service'
|
13
15
|
|
14
16
|
module Jemquarie
|
15
17
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:GenerateXMLExtractResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="wrapwebservices"><result xsi:type="xsd:string"><?xml version="1.0" ?>
|
2
|
+
<XMLExtract>
|
3
|
+
<RequestDetails>
|
4
|
+
<RequestStatus>Success</RequestStatus>
|
5
|
+
<RequestErrorNumber></RequestErrorNumber>
|
6
|
+
<RequestErrorDetails></RequestErrorDetails>
|
7
|
+
<RequestTime>2016-10-13 15:00:12.473</RequestTime>
|
8
|
+
</RequestDetails>
|
9
|
+
<XMLEntityDetails>
|
10
|
+
<XMLEntityName>your.clients Service Date</XMLEntityName>
|
11
|
+
<XMLEntityVersion>V1.1</XMLEntityVersion>
|
12
|
+
</XMLEntityDetails>
|
13
|
+
<ServiceDate>XXX-xx-XX</ServiceDate>
|
14
|
+
</XMLExtract>
|
15
|
+
</result></ns1:GenerateXMLExtractResponse></soapenv:Body></soapenv:Envelope>
|
16
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:GenerateXMLExtractResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="wrapwebservices"><result xsi:type="xsd:string"></result></ns1:GenerateXMLExtractResponse></soapenv:Body></soapenv:Envelope>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:GenerateXMLExtractResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="wrapwebservices"><result xsi:type="xsd:string"><?xml version="1.0" ?>
|
2
|
+
<XMLExtract>
|
3
|
+
<RequestDetails>
|
4
|
+
<RequestStatus>Success</RequestStatus>
|
5
|
+
<RequestErrorNumber></RequestErrorNumber>
|
6
|
+
<RequestErrorDetails></RequestErrorDetails>
|
7
|
+
<RequestTime>2016-10-13 15:00:12.473</RequestTime>
|
8
|
+
</RequestDetails>
|
9
|
+
<XMLEntityDetails>
|
10
|
+
<XMLEntityName>your.clients Service Date</XMLEntityName>
|
11
|
+
<XMLEntityVersion>V1.1</XMLEntityVersion>
|
12
|
+
</XMLEntityDetails>
|
13
|
+
<ServiceDate>2016-10-12</ServiceDate>
|
14
|
+
</XMLExtract>
|
15
|
+
</result></ns1:GenerateXMLExtractResponse></soapenv:Body></soapenv:Envelope>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Jemquarie::Service do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
Jemquarie::Jemquarie.api_credentials("testkey", "testapp")
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:importer) do
|
10
|
+
Jemquarie::Service.new('valid_code', 'valid_password')
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "success" do
|
14
|
+
before(:each) do
|
15
|
+
FakeWeb.register_uri(:post, Jemquarie::Jemquarie::BASE_URI,
|
16
|
+
body: File.read('spec/files/service/success.xml'),
|
17
|
+
content_type: 'text/xml'
|
18
|
+
)
|
19
|
+
@result = importer.date
|
20
|
+
end
|
21
|
+
it "should work" do
|
22
|
+
expect(@result).to eq(Date.parse("2016-10-12"))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "failures" do
|
27
|
+
before(:each) do
|
28
|
+
FakeWeb.register_uri(:post, Jemquarie::Jemquarie::BASE_URI,
|
29
|
+
body: File.read('spec/files/service/failure.xml'),
|
30
|
+
content_type: 'text/xml'
|
31
|
+
)
|
32
|
+
end
|
33
|
+
it "should raise nothing" do
|
34
|
+
expect{ importer.date }.to_not raise_error
|
35
|
+
end
|
36
|
+
it "should return error message" do
|
37
|
+
@result = importer.date
|
38
|
+
expect(@result).to eq({:error => "An error has occured, please try again later"})
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "with invalid date" do
|
43
|
+
before(:each) do
|
44
|
+
FakeWeb.register_uri(:post, Jemquarie::Jemquarie::BASE_URI,
|
45
|
+
body: File.read('spec/files/service/fail-date.xml'),
|
46
|
+
content_type: 'text/xml'
|
47
|
+
)
|
48
|
+
end
|
49
|
+
it "should raise nothing" do
|
50
|
+
expect{ importer.date }.to_not raise_error
|
51
|
+
end
|
52
|
+
it "should return error message" do
|
53
|
+
@result = importer.date
|
54
|
+
expect(@result).to eq({:error => "An error has occured, please try again later"})
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jemquarie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Contin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|
@@ -120,11 +120,16 @@ files:
|
|
120
120
|
- lib/jemquarie/parser/cash_transactions.rb
|
121
121
|
- lib/jemquarie/parser/expiry.rb
|
122
122
|
- lib/jemquarie/parser/generic.rb
|
123
|
+
- lib/jemquarie/parser/service.rb
|
124
|
+
- lib/jemquarie/service.rb
|
123
125
|
- lib/jemquarie/version.rb
|
124
126
|
- spec/files/account_details/details.xml
|
125
127
|
- spec/files/balance/balances.xml
|
126
128
|
- spec/files/balance/error_e0009.xml
|
127
129
|
- spec/files/expiry/expiry.xml
|
130
|
+
- spec/files/service/fail-date.xml
|
131
|
+
- spec/files/service/failure.xml
|
132
|
+
- spec/files/service/success.xml
|
128
133
|
- spec/files/transactions/no_data.xml
|
129
134
|
- spec/files/transactions/non_authenticated.xml
|
130
135
|
- spec/files/transactions/single_transaction.xml
|
@@ -136,6 +141,7 @@ files:
|
|
136
141
|
- spec/lib/expiry_spec.rb
|
137
142
|
- spec/lib/importer_spec.rb
|
138
143
|
- spec/lib/jemquarie_spec.rb
|
144
|
+
- spec/lib/service_spec.rb
|
139
145
|
- spec/spec_helper.rb
|
140
146
|
homepage: https://github.com/clod81/jemquarie
|
141
147
|
licenses:
|
@@ -166,6 +172,9 @@ test_files:
|
|
166
172
|
- spec/files/balance/balances.xml
|
167
173
|
- spec/files/balance/error_e0009.xml
|
168
174
|
- spec/files/expiry/expiry.xml
|
175
|
+
- spec/files/service/fail-date.xml
|
176
|
+
- spec/files/service/failure.xml
|
177
|
+
- spec/files/service/success.xml
|
169
178
|
- spec/files/transactions/no_data.xml
|
170
179
|
- spec/files/transactions/non_authenticated.xml
|
171
180
|
- spec/files/transactions/single_transaction.xml
|
@@ -177,4 +186,5 @@ test_files:
|
|
177
186
|
- spec/lib/expiry_spec.rb
|
178
187
|
- spec/lib/importer_spec.rb
|
179
188
|
- spec/lib/jemquarie_spec.rb
|
189
|
+
- spec/lib/service_spec.rb
|
180
190
|
- spec/spec_helper.rb
|