epics 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +6 -2
- data/epics.gemspec +1 -0
- data/lib/epics/client.rb +12 -2
- data/lib/epics/version.rb +1 -1
- data/lib/epics.rb +1 -0
- data/spec/client_spec.rb +10 -0
- data/spec/fixtures/test.zip +0 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 374545797bb76c3cca30bc9e628692dc7e1d3667
|
4
|
+
data.tar.gz: 73abda6207abda78a72706b8e76161acfb1e73f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34ff475ce4c532e56308cb300db75f1c87c0b9bf09e51093e80d4d09cef3c37510a49c48eef769277e32d74fa59dfb296dda228b91ca6e23a996585bd3e03fcd
|
7
|
+
data.tar.gz: 327e51904471698d960b82888a39eff70fb3516008f40d56af39ad6878e2c4444448eebbcf963f5fc061102d5b33cd8d21e813acb6058e2f51daa3af3b68077f
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -168,8 +168,12 @@ puts e.STA('2014-09-01', '2014-09-11')
|
|
168
168
|
Example:
|
169
169
|
|
170
170
|
```ruby
|
171
|
-
puts e.CD1("i-am-
|
172
|
-
# res is a the transaction id of the order
|
171
|
+
puts e.CD1("i-am-PAIN-xml")
|
172
|
+
# res is a the transaction id and id of the order
|
173
|
+
|
174
|
+
# if the XML is a file in your FS, read it first and give if epics to consume
|
175
|
+
puts e.CD1(File.read("/where/the/xml/is/stored.xml"))
|
176
|
+
|
173
177
|
```
|
174
178
|
|
175
179
|
### Lazy Mode
|
data/epics.gemspec
CHANGED
@@ -40,6 +40,7 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_dependency "nokogiri"
|
41
41
|
spec.add_dependency "gyoku"
|
42
42
|
spec.add_dependency "faraday"
|
43
|
+
spec.add_dependency "rubyzip", ">= 1.0.0"
|
43
44
|
|
44
45
|
spec.add_development_dependency "bundler", ">= 1.6.2"
|
45
46
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/epics/client.rb
CHANGED
@@ -128,11 +128,11 @@ class Epics::Client
|
|
128
128
|
end
|
129
129
|
|
130
130
|
def C52(from, to)
|
131
|
-
|
131
|
+
download_and_unzip(Epics::C52, from, to)
|
132
132
|
end
|
133
133
|
|
134
134
|
def C53(from, to)
|
135
|
-
|
135
|
+
download_and_unzip(Epics::C53, from, to)
|
136
136
|
end
|
137
137
|
|
138
138
|
def HAA
|
@@ -191,6 +191,16 @@ class Epics::Client
|
|
191
191
|
res.order_data
|
192
192
|
end
|
193
193
|
|
194
|
+
def download_and_unzip(order_type, *args)
|
195
|
+
[].tap do |entries|
|
196
|
+
Zip::InputStream.open(StringIO.new( download(order_type, *args) )) do |stream|
|
197
|
+
while stream.get_next_entry
|
198
|
+
entries << stream.read
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
194
204
|
def connection
|
195
205
|
@connection ||= Faraday.new(headers: {user_agent: "EPICS v#{Epics::VERSION}"}) do |faraday|
|
196
206
|
faraday.use Epics::XMLSIG, { client: self }
|
data/lib/epics/version.rb
CHANGED
data/lib/epics.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -130,4 +130,14 @@ RSpec.describe Epics::Client do
|
|
130
130
|
expect { subject.HTD }.to change { subject.instance_variable_get("@name") }
|
131
131
|
end
|
132
132
|
end
|
133
|
+
|
134
|
+
describe '#C53/C52 types with zipped data' do
|
135
|
+
before do
|
136
|
+
allow(subject).to receive(:download).and_return( File.read(File.join(File.dirname(__FILE__), 'fixtures', 'test.zip') ))
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'will unzip the returned data' do
|
140
|
+
expect(subject.C53(:today, :yesterday)).to eq(["ebics is great\n"])
|
141
|
+
end
|
142
|
+
end
|
133
143
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lars Brillert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubyzip
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,6 +213,7 @@ files:
|
|
199
213
|
- spec/fixtures/a006.pem
|
200
214
|
- spec/fixtures/bank_e.pem
|
201
215
|
- spec/fixtures/e002.pem
|
216
|
+
- spec/fixtures/test.zip
|
202
217
|
- spec/fixtures/x002.pem
|
203
218
|
- spec/fixtures/xml/cd1.xml
|
204
219
|
- spec/fixtures/xml/cd1_init_response.xml
|
@@ -291,6 +306,7 @@ test_files:
|
|
291
306
|
- spec/fixtures/a006.pem
|
292
307
|
- spec/fixtures/bank_e.pem
|
293
308
|
- spec/fixtures/e002.pem
|
309
|
+
- spec/fixtures/test.zip
|
294
310
|
- spec/fixtures/x002.pem
|
295
311
|
- spec/fixtures/xml/cd1.xml
|
296
312
|
- spec/fixtures/xml/cd1_init_response.xml
|