seko 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -4
- data/lib/seko/client.rb +5 -1
- data/lib/seko/receipt.rb +5 -3
- data/lib/seko/version.rb +1 -1
- data/spec/fixtures/receipt_submit.json +3 -1
- data/spec/lib/client_spec.rb +2 -2
- data/spec/lib/receipt_spec.rb +1 -1
- data/spec/spec_helper.rb +7 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b603e2b49029a30eac30262835d8285ce94dd78
|
4
|
+
data.tar.gz: e403a57825c6840f14eb93ef428af310960d743c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58acd945444a32b1dd26cdde88d7870c69eb7f76b810433c8a0f17ed700e8f87d8ef693d7875b5d308bc6c114b749d96b1244392101abf1de015ea7e79470874
|
7
|
+
data.tar.gz: aaae368484a0e747089fb10196b97fffc1e8b6c03bbe5a9428707ef9940569f69e3a628072bd28c47e83bcda88f5c50ff8756501adf926e7f5ac5c22098ccabb
|
data/README.md
CHANGED
@@ -43,8 +43,8 @@ config/initializers/seko.rb
|
|
43
43
|
```ruby
|
44
44
|
Seko.configure(
|
45
45
|
token: 'SekoAPIToKeN'
|
46
|
-
supplier_code: '
|
47
|
-
supplier_description: 'Default Supplier
|
46
|
+
supplier_code: 'DEFSUPTCLTD001',
|
47
|
+
supplier_description: 'Default Supplier TEST COMPANY LTD',
|
48
48
|
supplier_uom: 1,
|
49
49
|
warehouses: {
|
50
50
|
us: 'US123',
|
@@ -53,6 +53,23 @@ Seko.configure(
|
|
53
53
|
)
|
54
54
|
```
|
55
55
|
|
56
|
+
#### Basics
|
57
|
+
|
58
|
+
In order to communicate with Seko(SupplyStream) you need to instantiate an instance of the `Seko::Client` class using the token configured in the configuration step above.
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
client = Seko::Client.new(Seko.config[:token])
|
62
|
+
```
|
63
|
+
|
64
|
+
#### Testing vs. Live Mode
|
65
|
+
|
66
|
+
In order to use the live endpoint and corresponding live account with Seko you should pass it in as an argument to the client since the default is test mode.
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
client = Seko::Client.new(Seko.config[:token], { test_mode: false })
|
70
|
+
```
|
71
|
+
|
72
|
+
|
56
73
|
#### Submit Product
|
57
74
|
|
58
75
|
```ruby
|
@@ -60,15 +77,19 @@ client = Seko::Client.new(Seko.config[:token])
|
|
60
77
|
response = client.submit_product(upc: "123456", description: 'A test product')
|
61
78
|
```
|
62
79
|
|
63
|
-
|
80
|
+
This will post product information to Supply Stream. However, your account representative will need to apply stock levels.
|
81
|
+
|
82
|
+
#### Send Return Request
|
64
83
|
|
65
84
|
```ruby
|
66
85
|
line_items = [ { upc: "123456", quantity: 10 } ]
|
67
86
|
warehouse = Seko.config[:warehouses][:us]
|
68
87
|
client = Seko::Client.new(Seko.config[:token])
|
69
|
-
response = client.
|
88
|
+
response = client.send_return_request(line_item_array, warehouse)
|
70
89
|
```
|
71
90
|
|
91
|
+
Once a return return request is submited, also know as an Advanced Shipment Notice(ASN), the warehouse will either send a push notification with a Goods Received Notice(GRN) or you can check the GRN status below by using the GUID generated by this request.
|
92
|
+
|
72
93
|
#### Submit Company
|
73
94
|
|
74
95
|
```ruby
|
@@ -80,6 +101,8 @@ client = Seko::Client.new(Seko.config[:token])
|
|
80
101
|
response = client.submit_company(company_hash)
|
81
102
|
```
|
82
103
|
|
104
|
+
Useful for submitting companies to place wholesale orders.
|
105
|
+
|
83
106
|
#### Get Stock
|
84
107
|
|
85
108
|
```ruby
|
@@ -87,6 +110,8 @@ client = Seko::Client.new(Seko.config[:token])
|
|
87
110
|
response = client.get_inventory
|
88
111
|
```
|
89
112
|
|
113
|
+
Getting inventory will return inventory for all Warehouses configured. Pass in the warehouse identifier to filter the results by warehouse.
|
114
|
+
|
90
115
|
#### Check GRN
|
91
116
|
|
92
117
|
```ruby
|
@@ -94,6 +119,8 @@ client = Seko::Client.new(Seko.config[:token])
|
|
94
119
|
response = client.check_grn('5b2dcd8e-52c3-4e27-a712-eaacda2dd8fe')
|
95
120
|
```
|
96
121
|
|
122
|
+
Check the status of a Return Request(ASN) submitted.
|
123
|
+
|
97
124
|
#### Order Status
|
98
125
|
|
99
126
|
```ruby
|
@@ -101,6 +128,8 @@ client = Seko::Client.new(Seko.config[:token])
|
|
101
128
|
response = client.order_status('5b2dcd8e-52c3-4e27-a712-eaacda2dd8fe')
|
102
129
|
```
|
103
130
|
|
131
|
+
Check the status of an order.
|
132
|
+
|
104
133
|
#### Order Tracking
|
105
134
|
|
106
135
|
```ruby
|
@@ -108,6 +137,8 @@ client = Seko::Client.new(Seko.config[:token])
|
|
108
137
|
response = client.order_tracking('5b2dcd8e-52c3-4e27-a712-eaacda2dd8fe')
|
109
138
|
```
|
110
139
|
|
140
|
+
Get the tracking information for a given order.
|
141
|
+
|
111
142
|
#### Cancel Order
|
112
143
|
|
113
144
|
```ruby
|
@@ -125,6 +156,8 @@ client = Seko::Client.new(Seko.config[:token])
|
|
125
156
|
response = client.cancel_order('5b2dcd8e-52c3-4e27-a712-eaacda2dd8fe', '001')
|
126
157
|
```
|
127
158
|
|
159
|
+
Cancels a placed order, only works if the order isn't already shipped.
|
160
|
+
|
128
161
|
#### Stock Movements
|
129
162
|
|
130
163
|
```ruby
|
data/lib/seko/client.rb
CHANGED
@@ -102,7 +102,7 @@ module Seko
|
|
102
102
|
post(Product.format(product_hash))
|
103
103
|
end
|
104
104
|
|
105
|
-
def
|
105
|
+
def send_return_request(line_item_array, warehouse)
|
106
106
|
@service = 'receipts'
|
107
107
|
@endpoint = 'submit'
|
108
108
|
post(Receipt.format(line_item_array, warehouse))
|
@@ -166,6 +166,10 @@ module Seko
|
|
166
166
|
"#{API_PATH}#{service}/#{API_VERSION}/#{endpoint}.json"
|
167
167
|
end
|
168
168
|
|
169
|
+
def requires_warehouse?
|
170
|
+
true
|
171
|
+
end
|
172
|
+
|
169
173
|
private
|
170
174
|
def default_options
|
171
175
|
{
|
data/lib/seko/receipt.rb
CHANGED
@@ -12,14 +12,16 @@ module Seko
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.format(
|
15
|
+
def self.format(return_auth, warehouse)
|
16
16
|
{
|
17
17
|
"Request" => {
|
18
18
|
"List" => {
|
19
|
-
"ReceiptLineItem" => line_items(
|
19
|
+
"ReceiptLineItem" => line_items(return_auth[:line_items])
|
20
20
|
},
|
21
21
|
"Receipt" => {
|
22
|
-
"ASNNumber"
|
22
|
+
"ASNNumber" => random_asn,
|
23
|
+
"HBReference" => return_auth[:number],
|
24
|
+
"IsReturn" => true
|
23
25
|
},
|
24
26
|
"ReceiptHeader" => {
|
25
27
|
"DCCode" => warehouse
|
data/lib/seko/version.rb
CHANGED
data/spec/lib/client_spec.rb
CHANGED
@@ -108,13 +108,13 @@ describe Seko::Client do
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
describe '#
|
111
|
+
describe '#send_return_request' do
|
112
112
|
before do
|
113
113
|
stub_post("receipts/v1/submit.json").with(query: {token: token}).
|
114
114
|
to_return(body: success_response.to_json, headers: json_headers)
|
115
115
|
end
|
116
116
|
|
117
|
-
let(:response) { client.
|
117
|
+
let(:response) { client.send_return_request(return_auth_hash, order_hash[:warehouse]) }
|
118
118
|
|
119
119
|
it 'sends an POST request with a receipt object' do
|
120
120
|
expect(response.success?).to eq(true)
|
data/spec/lib/receipt_spec.rb
CHANGED
@@ -23,7 +23,7 @@ describe Seko::Receipt do
|
|
23
23
|
it 'formats a fully formed JSON ready hash for receipt' do
|
24
24
|
expected_result = fixture(:receipt_submit)
|
25
25
|
expect(Seko::Receipt).to receive(:random_asn).and_return(123456)
|
26
|
-
expect(Seko::Receipt.format(
|
26
|
+
expect(Seko::Receipt.format(return_auth_hash, 'DC123')).to eq(expected_result)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seko
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Grubbs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
169
|
rubyforge_project:
|
170
|
-
rubygems_version: 2.
|
170
|
+
rubygems_version: 2.2.2
|
171
171
|
signing_key:
|
172
172
|
specification_version: 4
|
173
173
|
summary: A ruby wrapper for interfacing with Seko Logistics' SupplySteam iHub API
|