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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5976b3e8bc956648f84a39411a4b6fe0f88edc21
4
- data.tar.gz: 29b21e380b0f27c505ef4347d86a280147ee9daa
3
+ metadata.gz: 8b603e2b49029a30eac30262835d8285ce94dd78
4
+ data.tar.gz: e403a57825c6840f14eb93ef428af310960d743c
5
5
  SHA512:
6
- metadata.gz: 70331ad66b6ce7350bd28356bb677f329ac960c0bbfbbf62cc243a871a04dab88d37d76236ce7d273b12ea7a676939e18556b65fc0e6728caa7f8aa3196c6f1f
7
- data.tar.gz: 58623c90f93c5019baba0161e9ea257f25b4e534e323338141dc0132f136ca503de8518ce93d24800b1df3b3e1233b4377b50a16648c9a93214488141ec9bf78
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: 'DEFSUPLJLTD001',
47
- supplier_description: 'Default Supplier LARSSON & JENNINGS LTD',
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
- #### Submit Receipt
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.submit_receipt(line_item_array, warehouse)
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 submit_receipt(line_item_array, warehouse)
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(items, warehouse)
15
+ def self.format(return_auth, warehouse)
16
16
  {
17
17
  "Request" => {
18
18
  "List" => {
19
- "ReceiptLineItem" => line_items(items)
19
+ "ReceiptLineItem" => line_items(return_auth[:line_items])
20
20
  },
21
21
  "Receipt" => {
22
- "ASNNumber" => random_asn
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
@@ -1,3 +1,3 @@
1
1
  module Seko
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -17,7 +17,9 @@
17
17
  ]
18
18
  },
19
19
  "Receipt": {
20
- "ASNNumber": 123456
20
+ "ASNNumber": 123456,
21
+ "HBReference": "RMA123456789",
22
+ "IsReturn": true
21
23
  },
22
24
  "ReceiptHeader": {
23
25
  "DCCode": "DC123"
@@ -108,13 +108,13 @@ describe Seko::Client do
108
108
  end
109
109
  end
110
110
 
111
- describe '#submit_receipt' do
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.submit_receipt(line_items_array, order_hash[:warehouse]) }
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)
@@ -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(line_items_array, 'DC123')).to eq(expected_result)
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
@@ -94,6 +94,13 @@ def address_hash
94
94
  }
95
95
  end
96
96
 
97
+ def return_auth_hash
98
+ {
99
+ number: 'RMA123456789',
100
+ line_items: line_items_array
101
+ }
102
+ end
103
+
97
104
  def line_items_array
98
105
  [
99
106
  {
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.5
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: 2014-11-26 00:00:00.000000000 Z
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.0.6
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