pixi_client 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +34 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Guardfile +45 -0
- data/LICENSE.txt +22 -0
- data/README.md +171 -0
- data/Rakefile +8 -0
- data/lib/pixi_client/configuration.rb +5 -0
- data/lib/pixi_client/requests/add_comment_to_order.rb +20 -0
- data/lib/pixi_client/requests/base.rb +25 -0
- data/lib/pixi_client/requests/cancel_order.rb +19 -0
- data/lib/pixi_client/requests/cancel_order_line.rb +19 -0
- data/lib/pixi_client/requests/get_changed_item_stock.rb +27 -0
- data/lib/pixi_client/requests/get_changed_items.rb +19 -0
- data/lib/pixi_client/requests/get_invoice.rb +19 -0
- data/lib/pixi_client/requests/get_item_info.rb +19 -0
- data/lib/pixi_client/requests/get_item_stock_bins.rb +18 -0
- data/lib/pixi_client/requests/get_items_info.rb +34 -0
- data/lib/pixi_client/requests/get_items_on_stock_bin.rb +19 -0
- data/lib/pixi_client/requests/get_items_stock_history.rb +18 -0
- data/lib/pixi_client/requests/get_order_comments.rb +19 -0
- data/lib/pixi_client/requests/get_order_header.rb +19 -0
- data/lib/pixi_client/requests/get_order_line_history.rb +22 -0
- data/lib/pixi_client/requests/get_order_lines.rb +21 -0
- data/lib/pixi_client/requests/get_order_nr_external_by_box_nr.rb +19 -0
- data/lib/pixi_client/requests/get_stock.rb +19 -0
- data/lib/pixi_client/requests/get_stock_by_bin.rb +19 -0
- data/lib/pixi_client/requests/get_unshippable_orders.rb +19 -0
- data/lib/pixi_client/requests/itemable.rb +24 -0
- data/lib/pixi_client/requests/read_items.rb +23 -0
- data/lib/pixi_client/requests/read_orderlines.rb +18 -0
- data/lib/pixi_client/requests/set_stock_multiple.rb +19 -0
- data/lib/pixi_client/requests/shipping_get_picklist_details.rb +19 -0
- data/lib/pixi_client/requests/shipping_get_picklist_headers.rb +19 -0
- data/lib/pixi_client/requests.rb +27 -0
- data/lib/pixi_client/response.rb +12 -0
- data/lib/pixi_client/response_parser.rb +137 -0
- data/lib/pixi_client/version.rb +3 -0
- data/lib/pixi_client.rb +17 -0
- data/pixi_client.gemspec +32 -0
- data/spec/fixtures/get_order_nr_external_by_box_nr.xml +51 -0
- data/spec/fixtures/pixi_get_changed_item_stock.xml +140 -0
- data/spec/integration/pixi_get_changed_item_stock_spec.rb +85 -0
- data/spec/lib/pixi_client/configuration_spec.rb +47 -0
- data/spec/lib/pixi_client/requests/add_comment_to_order_spec.rb +48 -0
- data/spec/lib/pixi_client/requests/cancel_order_line_spec.rb +47 -0
- data/spec/lib/pixi_client/requests/cancel_order_spec.rb +47 -0
- data/spec/lib/pixi_client/requests/get_changed_item_stock_spec.rb +61 -0
- data/spec/lib/pixi_client/requests/get_changed_items_spec.rb +54 -0
- data/spec/lib/pixi_client/requests/get_invoice_spec.rb +46 -0
- data/spec/lib/pixi_client/requests/get_item_info_spec.rb +48 -0
- data/spec/lib/pixi_client/requests/get_item_stock_bins_spec.rb +48 -0
- data/spec/lib/pixi_client/requests/get_items_info_spec.rb +60 -0
- data/spec/lib/pixi_client/requests/get_items_on_stock_bin_spec.rb +47 -0
- data/spec/lib/pixi_client/requests/get_items_stock_history_spec.rb +47 -0
- data/spec/lib/pixi_client/requests/get_order_comments_spec.rb +46 -0
- data/spec/lib/pixi_client/requests/get_order_header_spec.rb +47 -0
- data/spec/lib/pixi_client/requests/get_order_line_history_spec.rb +47 -0
- data/spec/lib/pixi_client/requests/get_order_lines_spec.rb +47 -0
- data/spec/lib/pixi_client/requests/get_order_nr_external_by_box_nr_spec.rb +51 -0
- data/spec/lib/pixi_client/requests/get_stock_by_bin_spec.rb +47 -0
- data/spec/lib/pixi_client/requests/get_stock_spec.rb +47 -0
- data/spec/lib/pixi_client/requests/get_unshippable_orders_spec.rb +47 -0
- data/spec/lib/pixi_client/requests/itemable_shared_examples.rb +52 -0
- data/spec/lib/pixi_client/requests/read_items_spec.rb +56 -0
- data/spec/lib/pixi_client/requests/read_orderlines_spec.rb +47 -0
- data/spec/lib/pixi_client/requests/set_stock_multiple_spec.rb +53 -0
- data/spec/lib/pixi_client/requests/shipping_get_picklist_details_spec.rb +47 -0
- data/spec/lib/pixi_client/requests/shipping_get_picklist_headers_spec.rb +47 -0
- data/spec/lib/pixi_client/response_parser_spec.rb +96 -0
- data/spec/lib/pixi_client/soap_request_spec.rb +30 -0
- data/spec/lib/pixi_client_spec.rb +19 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/test_helpers.rb +136 -0
- metadata +306 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 77cfd8b058cb754f613001a1baa7c8e1c817d66f
|
4
|
+
data.tar.gz: bc7b81ec4fae4646a02d0819a0409a244e7dc9d6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f61855a79f76b7a03cc4530c50f6f599ff4c3ab5df3f957ebc680ee0551499dc40f65a6f416ba932808cb9f6c7504ff67abe22d9a9cefae8109679c0e23129e2
|
7
|
+
data.tar.gz: 574bb4b37a33be78f8b2b1341785517a363eaf221e530b70a2c747696a88a31e37ce931b603224ba20960fb1dac6c32fc246fd0c1af4504eed12652fbc85c51a
|
data/.gitignore
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Documentation cache and generated files:
|
13
|
+
/.yardoc/
|
14
|
+
/_yardoc/
|
15
|
+
/doc/
|
16
|
+
/rdoc/
|
17
|
+
|
18
|
+
## Environment normalisation:
|
19
|
+
/.bundle/
|
20
|
+
/lib/bundler/man/
|
21
|
+
|
22
|
+
# for a library or gem, you might want to ignore these files since the code is
|
23
|
+
# intended to run in multiple environments; otherwise, check them in:
|
24
|
+
# Gemfile.lock
|
25
|
+
.ruby-version
|
26
|
+
.ruby-gemset
|
27
|
+
|
28
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
29
|
+
.rvmrc
|
30
|
+
|
31
|
+
# Pixi data connection
|
32
|
+
/config/pixi.yml
|
33
|
+
|
34
|
+
Gemfile.lock
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
## Uncomment and set this to only include directories you want to watch
|
2
|
+
# directories %w(app lib config test spec feature)
|
3
|
+
|
4
|
+
## Uncomment to clear the screen before every task
|
5
|
+
clearing :on
|
6
|
+
|
7
|
+
## Guard internally checks for changes in the Guardfile and exits.
|
8
|
+
## If you want Guard to automatically start up again, run guard in a
|
9
|
+
## shell loop, e.g.:
|
10
|
+
##
|
11
|
+
## $ while bundle exec guard; do echo "Restarting Guard..."; done
|
12
|
+
##
|
13
|
+
## Note: if you are using the `directories` clause above and you are not
|
14
|
+
## watching the project directory ('.'), the you will want to move the Guardfile
|
15
|
+
## to a watched dir and symlink it back, e.g.
|
16
|
+
#
|
17
|
+
# $ mkdir config
|
18
|
+
# $ mv Guardfile config/
|
19
|
+
# $ ln -s config/Guardfile .
|
20
|
+
#
|
21
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
22
|
+
|
23
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
24
|
+
# rspec may be run, below are examples of the most common uses.
|
25
|
+
# * bundler: 'bundle exec rspec'
|
26
|
+
# * bundler binstubs: 'bin/rspec'
|
27
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
28
|
+
# installed the spring binstubs per the docs)
|
29
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
30
|
+
# * 'just' rspec: 'rspec'
|
31
|
+
|
32
|
+
guard :rspec, cmd: "bundle exec rspec --color --format documentation --format Nc" do
|
33
|
+
require "guard/rspec/dsl"
|
34
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
35
|
+
|
36
|
+
# RSpec files
|
37
|
+
rspec = dsl.rspec
|
38
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
39
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
40
|
+
watch(rspec.spec_files)
|
41
|
+
|
42
|
+
# Ruby files
|
43
|
+
ruby = dsl.ruby
|
44
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
45
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 heragu
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
# PixiClient
|
2
|
+
|
3
|
+
PixiClient is a ruby client for the pixi SOAP API.
|
4
|
+
|
5
|
+
The intent behind it was to abstract all the SOAP and nasty Microsoft SqlRowSet1 details involved in the SOAP communication, letting the programmer to work with plain ruby objects, instead of XML response messages or hash objects.
|
6
|
+
|
7
|
+
It also offers an easy way to include new requests to the API.
|
8
|
+
|
9
|
+
## Background
|
10
|
+
|
11
|
+
Do I need to read this section to use the gem? No, at all. You can jump to Installation if you feel like it.
|
12
|
+
|
13
|
+
It's boring technical stuff about the implementation, but it could be useful if one day you run into troubles. ;-)
|
14
|
+
|
15
|
+
The pixi SOAP API always responses with messages that follow the Microsoft SqlRowSet1 XML schema. The messages that follow this schema contains esentially three parts:
|
16
|
+
* A collection of warning and/or error messages
|
17
|
+
* A collection of field descriptors, that indicates how the rows of the response are structured
|
18
|
+
* A collection of rows containing the data
|
19
|
+
|
20
|
+
The pixi_client gem uses the file descriptors to build ruby objects at runtime using OpenStruct.
|
21
|
+
The messages are also parsed and returned as Ruby objects using OpenStruct.
|
22
|
+
|
23
|
+
See also the [reference about the Microsoft SqlRowSet1 schema documentation](https://msdn.microsoft.com/en-us/library/ee320384(v=sql.105).aspx).
|
24
|
+
|
25
|
+
## Requirements
|
26
|
+
|
27
|
+
The gem has been tested with Ruby versions >= 2.1.
|
28
|
+
|
29
|
+
## Installation
|
30
|
+
|
31
|
+
Add this line to your application's Gemfile:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
gem 'pixi_client'
|
35
|
+
```
|
36
|
+
|
37
|
+
And then execute:
|
38
|
+
|
39
|
+
$ bundle
|
40
|
+
|
41
|
+
Or install it yourself as:
|
42
|
+
|
43
|
+
$ gem install pixi_client
|
44
|
+
|
45
|
+
## Usage
|
46
|
+
|
47
|
+
### Configuration
|
48
|
+
|
49
|
+
#### Rails
|
50
|
+
|
51
|
+
config/initializers/pixi_client.rb
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
PixiClient.configure do |config|
|
55
|
+
config.endpoint = <your_pixi_endpoing_url>
|
56
|
+
config.username = <your_pixi_username>
|
57
|
+
config.password = <your_pixi_password>
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
### Example of usage
|
62
|
+
|
63
|
+
To have a list of the implemented requests, have a look to the lib/requests folder.
|
64
|
+
|
65
|
+
All the requests have a common interface: the request to pixi is performed when the `call` method is invoked and it returns a response object.
|
66
|
+
|
67
|
+
The returned response object has two main methods:
|
68
|
+
* rows: an array of OpenStruct instances, where every instance has the attributes described in the API documentation with the data type described in the XML schema. If the response is empty, it returns an empty array.
|
69
|
+
* messages: an array of OpenStruct instances, where every instance represent a warning or error message.
|
70
|
+
|
71
|
+
For example, suppose you want to get the changed stock in the last 15 minutes using the API service `pixiGetChangedItemsStock` (`PixiClient::Requests::GetChangedItemStock`).
|
72
|
+
|
73
|
+
According to the pixi documentation the response is a collection of rows with the following columns:
|
74
|
+
* ItemKey
|
75
|
+
* ItemNrInt
|
76
|
+
* EANUPC
|
77
|
+
* ItemNrSuppl
|
78
|
+
* PhysicalStock
|
79
|
+
* AvailableStock
|
80
|
+
* StockChange
|
81
|
+
* EstimatedDelivery
|
82
|
+
* MinStockQty
|
83
|
+
* Enabled
|
84
|
+
* OpenSupplierOrderQTY
|
85
|
+
* UpdateDate
|
86
|
+
* OriginalUpdateDate
|
87
|
+
* BundleItem
|
88
|
+
* RowNr
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
response = PixiClient::Requests::GetChangedItemStock.new(since: 15.minutes.ago).call
|
92
|
+
|
93
|
+
single_row = response.rows.first
|
94
|
+
|
95
|
+
# Single row is an OpenStruct with the following ruby attributes:
|
96
|
+
# => item_key
|
97
|
+
# => item_nr_int
|
98
|
+
# => eanup
|
99
|
+
# => item_nr_suppl
|
100
|
+
# => physical_stock
|
101
|
+
# => available_stock
|
102
|
+
# => stock_change
|
103
|
+
# => estimated_delivery
|
104
|
+
# => min_stock_qty
|
105
|
+
# => enabled
|
106
|
+
# => open_supplier_order_qty
|
107
|
+
# => update_date
|
108
|
+
# => original_update_date
|
109
|
+
# => bundle_item
|
110
|
+
# => row_nr
|
111
|
+
|
112
|
+
```
|
113
|
+
### Extending it
|
114
|
+
|
115
|
+
We don't implement all the possible requests to the pixi SOAP API. Disappointed? You shouldn't.
|
116
|
+
|
117
|
+
We don't implement all, but we offer an easy way to add new requests without dealing with SOAP and Microsoft SqlRowSet1 dirty details.
|
118
|
+
|
119
|
+
To add a new request, you just need to extend `PixiClient::Requests::Base` and provide the following three methods:
|
120
|
+
* `initialize`: not mandatory, but useful to set the parameters your call needs.
|
121
|
+
* `api_method`: it must return a symbol with the name of the SOAP request following the lowercase separated by underscores naming convention. For example, if you want to call the service pixiGetStockBins the method should return `:pixi_get_stock_bins`.
|
122
|
+
* `message`: it must return a hash with the request parameters.
|
123
|
+
|
124
|
+
As example, let's implement `pixiGetStockBins` request. This request returns a list of all Bins available in the stock. It has three parameters, all optional:
|
125
|
+
* `LocID`: to filter bins by location ID.
|
126
|
+
* `RowCount`: Max rowcount to return. By default 0: return all.
|
127
|
+
* `Start`: Index of the row to start with. The default value is 0.
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
class GetStockBins < PixiClient::Requests::Base
|
131
|
+
attr_accessor :loc_id, :row_count, :start
|
132
|
+
|
133
|
+
def initialize(params = {})
|
134
|
+
self.loc_id = params[:loc_id]
|
135
|
+
self.row_count = params[:row_count] || 0
|
136
|
+
self.start = params[:start] || 0
|
137
|
+
end
|
138
|
+
|
139
|
+
def api_method
|
140
|
+
:pixi_get_stock_bins
|
141
|
+
end
|
142
|
+
|
143
|
+
def message
|
144
|
+
message = {}
|
145
|
+
message['LocID'] = loc_id if loc_id.present?
|
146
|
+
message.merge({
|
147
|
+
'RowCount' => row_count,
|
148
|
+
'Start' => start
|
149
|
+
})
|
150
|
+
end
|
151
|
+
end # That's it!
|
152
|
+
|
153
|
+
# Let's have fun printting out all our bins :-)
|
154
|
+
response = GetStockBins.new.call
|
155
|
+
response.rows.each do |bin|
|
156
|
+
puts "#{bin.bin_name}"
|
157
|
+
end
|
158
|
+
```
|
159
|
+
|
160
|
+
A couple of tips when you are adding new requests:
|
161
|
+
* Before you implement a new call, it is recommended that you install [Wizdler Chrome Extension](https://chrome.google.com/webstore/detail/wizdler/oebpmncolmhiapingjaagmapififiakb). This extesion will let you to play in your browser easily with the pixi API. It is also really helpful when the pixi documentation is incomplete or has errors, what happens often.
|
162
|
+
* Consider that the order of the parameters is relevant. If the documentation lists the parameters in the order `LocID`, `RowCount` and `Start`, they should be provided in this order in the message hash (or omitted if they are optional). If you don't do this way, the API will complaint and return an error.
|
163
|
+
|
164
|
+
|
165
|
+
## Contributing
|
166
|
+
|
167
|
+
1. Fork it ( https://github.com/[my-github-username]/pixi_client/fork )
|
168
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
169
|
+
3. Commit your changes (`git commit -am 'Add some feature'`). Here some tips how to write a good commit message: https://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message
|
170
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
171
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class AddCommentToOrder < Base
|
4
|
+
attr_accessor :order_nr, :comment
|
5
|
+
|
6
|
+
def initialize(order_nr, comment)
|
7
|
+
self.order_nr = order_nr
|
8
|
+
self.comment = comment
|
9
|
+
end
|
10
|
+
|
11
|
+
def api_method
|
12
|
+
:pixi_add_order_comment
|
13
|
+
end
|
14
|
+
|
15
|
+
def message
|
16
|
+
{ 'OrderNr' => order_nr, 'Comment' => comment }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'savon'
|
2
|
+
|
3
|
+
module PixiClient
|
4
|
+
module Requests
|
5
|
+
class Base
|
6
|
+
TIME_STRING_FORMAT = '%Y-%m-%dT%H:%M:%S.%3N'
|
7
|
+
FIVE_MINUTES = 5 * 60
|
8
|
+
|
9
|
+
def call
|
10
|
+
response = client.call(api_method, attributes: { xmlns: PixiClient.configuration.endpoint }, message: message)
|
11
|
+
Response.new(api_method, response.body)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def client
|
17
|
+
@client ||= Savon.client(
|
18
|
+
wsdl: PixiClient.configuration.endpoint + '?wsdl',
|
19
|
+
ssl_verify_mode: :none,
|
20
|
+
basic_auth: [PixiClient.configuration.username, PixiClient.configuration.password]
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class CancelOrder < Base
|
4
|
+
attr_accessor :order_nr
|
5
|
+
|
6
|
+
def initialize(order_nr)
|
7
|
+
self.order_nr = order_nr
|
8
|
+
end
|
9
|
+
|
10
|
+
def api_method
|
11
|
+
:pixi_cancel_order
|
12
|
+
end
|
13
|
+
|
14
|
+
def message
|
15
|
+
{ 'OrderNr' => order_nr }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class CancelOrderLine < Base
|
4
|
+
attr_accessor :order_line_key
|
5
|
+
|
6
|
+
def initialize(order_line_key)
|
7
|
+
self.order_line_key = order_line_key
|
8
|
+
end
|
9
|
+
|
10
|
+
def api_method
|
11
|
+
:pixi_cancel_orderline
|
12
|
+
end
|
13
|
+
|
14
|
+
def message
|
15
|
+
{ 'OrderlineKey' => order_line_key }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class GetChangedItemStock < Base
|
4
|
+
|
5
|
+
attr_accessor :since, :row_count, :offset, :location_id
|
6
|
+
|
7
|
+
def initialize(opts)
|
8
|
+
self.since = opts[:since]
|
9
|
+
self.row_count = opts[:row_count]
|
10
|
+
self.offset = opts[:offset]
|
11
|
+
self.location_id = opts[:location_id]
|
12
|
+
end
|
13
|
+
|
14
|
+
def api_method
|
15
|
+
:pixi_get_changed_item_stock
|
16
|
+
end
|
17
|
+
|
18
|
+
def message
|
19
|
+
{ 'Since' => since.strftime(TIME_STRING_FORMAT) }.tap do |opts|
|
20
|
+
opts['RowCount'] = row_count unless row_count.nil?
|
21
|
+
opts['LocID'] = location_id unless location_id.nil?
|
22
|
+
opts['Start'] = offset unless offset.nil?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class GetChangedItems < Base
|
4
|
+
attr_accessor :since
|
5
|
+
|
6
|
+
def initialize(opts)
|
7
|
+
self.since = opts[:since]
|
8
|
+
end
|
9
|
+
|
10
|
+
def api_method
|
11
|
+
:pixi_get_changed_items
|
12
|
+
end
|
13
|
+
|
14
|
+
def message
|
15
|
+
{ 'Since' => since.strftime(TIME_STRING_FORMAT) }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class GetInvoice < Base
|
4
|
+
attr_accessor :invoice_number
|
5
|
+
|
6
|
+
def initialize(invoice_number)
|
7
|
+
self.invoice_number = invoice_number
|
8
|
+
end
|
9
|
+
|
10
|
+
def api_method
|
11
|
+
:pixi_get_invoice
|
12
|
+
end
|
13
|
+
|
14
|
+
def message
|
15
|
+
{ 'InvoiceNr' => invoice_number }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class GetItemInfo < Base
|
4
|
+
include Itemable
|
5
|
+
|
6
|
+
attr_accessor :item_id_key, :item_id
|
7
|
+
|
8
|
+
def initialize(item_id_key, item_id)
|
9
|
+
self.item_id_key = item_id_key
|
10
|
+
self.item_id = item_id
|
11
|
+
end
|
12
|
+
|
13
|
+
def api_method
|
14
|
+
:pixi_get_item_info
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class GetItemStockBins < Base
|
4
|
+
include Itemable
|
5
|
+
|
6
|
+
attr_accessor :item_id_key, :item_id
|
7
|
+
|
8
|
+
def initialize(item_id_key, item_id)
|
9
|
+
self.item_id_key = item_id_key
|
10
|
+
self.item_id = item_id
|
11
|
+
end
|
12
|
+
|
13
|
+
def api_method
|
14
|
+
:pixi_get_item_stock_bins
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class GetItemsInfo < Base
|
4
|
+
attr_accessor :ean_codes, :location_id
|
5
|
+
|
6
|
+
def initialize(ean_codes, location_id)
|
7
|
+
self.ean_codes = ean_codes
|
8
|
+
self.location_id = location_id
|
9
|
+
end
|
10
|
+
|
11
|
+
def api_method
|
12
|
+
:pixi_get_item_info
|
13
|
+
end
|
14
|
+
|
15
|
+
def message
|
16
|
+
{ 'LocID' => location_id, 'ItemXML' => xml_message }
|
17
|
+
end
|
18
|
+
|
19
|
+
def xml_message
|
20
|
+
builder = Builder::XmlMarkup.new
|
21
|
+
|
22
|
+
builder.ITEMS do
|
23
|
+
ean_codes.each do |code|
|
24
|
+
builder.ITEM do
|
25
|
+
builder.EAN code
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
builder.target!
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class GetItemsOnStockBin < PixiClient::Requests::Base
|
4
|
+
attr_accessor :bin_name
|
5
|
+
|
6
|
+
def initialize(bin_name)
|
7
|
+
self.bin_name = bin_name
|
8
|
+
end
|
9
|
+
|
10
|
+
def api_method
|
11
|
+
:pixi_get_items_on_stock_bin
|
12
|
+
end
|
13
|
+
|
14
|
+
def message
|
15
|
+
{ 'BinName' => bin_name }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class GetItemsStockHistory < Base
|
4
|
+
attr_accessor :message
|
5
|
+
|
6
|
+
# Pixi* documentation says that the pixi order number
|
7
|
+
# is mandatory for this requests
|
8
|
+
def initialize(message)
|
9
|
+
self.message = message
|
10
|
+
end
|
11
|
+
|
12
|
+
def api_method
|
13
|
+
:pixi_get_items_stock_history
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class GetOrderComments < Base
|
4
|
+
attr_accessor :pixi_order_number
|
5
|
+
|
6
|
+
def initialize(pixi_order_number)
|
7
|
+
self.pixi_order_number = pixi_order_number
|
8
|
+
end
|
9
|
+
|
10
|
+
def api_method
|
11
|
+
:pixi_get_order_comments
|
12
|
+
end
|
13
|
+
|
14
|
+
def message
|
15
|
+
{ 'OrderNr' => pixi_order_number }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class GetOrderHeader < Base
|
4
|
+
attr_accessor :order_id
|
5
|
+
|
6
|
+
def initialize(order_id)
|
7
|
+
self.order_id = order_id
|
8
|
+
end
|
9
|
+
|
10
|
+
def api_method
|
11
|
+
:pixi_get_order_header
|
12
|
+
end
|
13
|
+
|
14
|
+
def message
|
15
|
+
{ 'OrderNrExternal' => order_id }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class GetOrderLineHistory < Base
|
4
|
+
attr_accessor :order_line_key
|
5
|
+
|
6
|
+
# Pixi* documentation says that the pixi order number
|
7
|
+
# is mandatory for this requests
|
8
|
+
def initialize(order_line_key)
|
9
|
+
self.order_line_key = order_line_key
|
10
|
+
end
|
11
|
+
|
12
|
+
def api_method
|
13
|
+
:pixi_get_orderline_history
|
14
|
+
end
|
15
|
+
|
16
|
+
def message
|
17
|
+
{ 'OrderlineKey' => order_line_key}
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class GetOrderLines < Base
|
4
|
+
attr_accessor :pixi_order_number
|
5
|
+
|
6
|
+
# Pixi* documentation says that the pixi order number
|
7
|
+
# is mandatory for this requests
|
8
|
+
def initialize(pixi_order_number)
|
9
|
+
self.pixi_order_number = pixi_order_number
|
10
|
+
end
|
11
|
+
|
12
|
+
def api_method
|
13
|
+
:pixi_get_orderline
|
14
|
+
end
|
15
|
+
|
16
|
+
def message
|
17
|
+
{ 'OrderNR' => pixi_order_number }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PixiClient
|
2
|
+
module Requests
|
3
|
+
class GetOrderNrExternalByBoxNr < Base
|
4
|
+
attr_accessor :box_nr
|
5
|
+
|
6
|
+
def initialize(opts)
|
7
|
+
self.box_nr = opts[:box_nr]
|
8
|
+
end
|
9
|
+
|
10
|
+
def api_method
|
11
|
+
:pixi_get_order_nr_external_by_box_nr
|
12
|
+
end
|
13
|
+
|
14
|
+
def message
|
15
|
+
{ 'BoxNr' => box_nr }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|