pixi_client 0.0.5 → 1.0.0

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: 77cfd8b058cb754f613001a1baa7c8e1c817d66f
4
- data.tar.gz: bc7b81ec4fae4646a02d0819a0409a244e7dc9d6
3
+ metadata.gz: c4e906af2abeefa982eba85ec8af7252d18b32b1
4
+ data.tar.gz: 978ae4cf6668ed4059eab66cb7e6e46e2bda9197
5
5
  SHA512:
6
- metadata.gz: f61855a79f76b7a03cc4530c50f6f599ff4c3ab5df3f957ebc680ee0551499dc40f65a6f416ba932808cb9f6c7504ff67abe22d9a9cefae8109679c0e23129e2
7
- data.tar.gz: 574bb4b37a33be78f8b2b1341785517a363eaf221e530b70a2c747696a88a31e37ce931b603224ba20960fb1dac6c32fc246fd0c1af4504eed12652fbc85c51a
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(pixi_order_number)
9
- self.pixi_order_number = pixi_order_number
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
@@ -1,3 +1,3 @@
1
1
  module PixiClient
2
- VERSION = "0.0.5"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -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
- describe 'call behaviour' do
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
- .with(:pixi_get_orderline, attributes: { xmlns: PixiClient.configuration.endpoint }, message: { 'OrderNR' => pixi_order_number})
30
- .and_return(expected_response)
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.5
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-03 00:00:00.000000000 Z
11
+ date: 2015-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon