pixi_client 0.0.5 → 1.0.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4e906af2abeefa982eba85ec8af7252d18b32b1
|
4
|
+
data.tar.gz: 978ae4cf6668ed4059eab66cb7e6e46e2bda9197
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13fbd1caeeb20063f636971f48f3593de23b0daeea68fee89f8a4969c59026814abd88cca442a056c68d63b0b9164a1e44ad860cf5f1bc50eecd4ffa4fd0a005
|
7
|
+
data.tar.gz: f648ce0eb0035836a6600dcbbd0a192a5ea164f1afbb0b50860c7ac23916acb85fed744eba7ba675fb05ceeb0bc69e34cc764754d86187bd0b996cfcc5b978e3
|
@@ -5,8 +5,15 @@ module PixiClient
|
|
5
5
|
|
6
6
|
# Pixi* documentation says that the pixi order number
|
7
7
|
# is mandatory for this requests
|
8
|
-
def initialize(
|
9
|
-
|
8
|
+
def initialize(options = {})
|
9
|
+
|
10
|
+
if options[:pixi_order_number]
|
11
|
+
@pixi_order_number = options[:pixi_order_number]
|
12
|
+
elsif options[:message]
|
13
|
+
@message = options[:message]
|
14
|
+
else
|
15
|
+
fail('Parameters must include either pixi_order_number or message-Hash')
|
16
|
+
end
|
10
17
|
end
|
11
18
|
|
12
19
|
def api_method
|
@@ -14,6 +21,7 @@ module PixiClient
|
|
14
21
|
end
|
15
22
|
|
16
23
|
def message
|
24
|
+
return @message if @message
|
17
25
|
{ 'OrderNR' => pixi_order_number }
|
18
26
|
end
|
19
27
|
end
|
data/lib/pixi_client/version.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe PixiClient::Requests::GetOrderLines do
|
4
4
|
let(:pixi_order_number) { 1 }
|
5
|
-
subject { PixiClient::Requests::GetOrderLines.new(pixi_order_number) }
|
5
|
+
subject { PixiClient::Requests::GetOrderLines.new(pixi_order_number: pixi_order_number) }
|
6
6
|
|
7
7
|
before do
|
8
8
|
set_default_config
|
@@ -16,18 +16,11 @@ describe PixiClient::Requests::GetOrderLines do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
let(:expected_response) { double(body: { pixi_get_orderline_response: { pixi_get_orderline_result: sql_row_set_response_mock } }) }
|
21
|
-
let(:double_client) { double }
|
22
|
-
|
23
|
-
before do
|
24
|
-
allow(subject).to receive(:client).and_return(double_client)
|
25
|
-
end
|
26
|
-
|
19
|
+
shared_examples "call_behaviour" do
|
27
20
|
it 'should call the client with the appropriate parameters' do
|
28
21
|
expect(double_client).to receive(:call)
|
29
|
-
|
30
|
-
|
22
|
+
.with(:pixi_get_orderline, attributes: { xmlns: PixiClient.configuration.endpoint }, message: { 'OrderNR' => pixi_order_number})
|
23
|
+
.and_return(expected_response)
|
31
24
|
|
32
25
|
subject.call
|
33
26
|
end
|
@@ -44,4 +37,22 @@ describe PixiClient::Requests::GetOrderLines do
|
|
44
37
|
end
|
45
38
|
end
|
46
39
|
|
40
|
+
|
41
|
+
describe 'call behaviour' do
|
42
|
+
let(:expected_response) { double(body: { pixi_get_orderline_response: { pixi_get_orderline_result: sql_row_set_response_mock } }) }
|
43
|
+
let(:double_client) { double }
|
44
|
+
|
45
|
+
before do
|
46
|
+
allow(subject).to receive(:client).and_return(double_client)
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'given pixi_order_number' do
|
50
|
+
it_should_behave_like 'call_behaviour'
|
51
|
+
end
|
52
|
+
context 'given message-hash' do
|
53
|
+
subject { PixiClient::Requests::GetOrderLines.new(message: {'OrderNR' => pixi_order_number}) }
|
54
|
+
it_should_behave_like 'call_behaviour'
|
55
|
+
end
|
56
|
+
end
|
47
57
|
end
|
58
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixi_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- heragu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|