snap-api 0.1.7 → 0.1.8

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: 100c5077dbbf7a9d82d3489bd1006ff0b6e4b64d
4
- data.tar.gz: d34662d913aa19c701d931b695363f05f2b80f37
3
+ metadata.gz: 4f8df34486ecc3cd4d9b271eb9b31b2a3dfbfee8
4
+ data.tar.gz: b9127077fe56d3c08a5532a9caae8aeeb260d628
5
5
  SHA512:
6
- metadata.gz: 84cd1aa291846e4959750eeab55a543b3031e15c140411f5287a4559e1623290c683aec68a605481263d9061db4933095b353e14e28f7208d37d4f6b4c83e91d
7
- data.tar.gz: 7e95c295efaeb5dd11d2f9471e51caf5e717fc90e07957406c74cca27af8d1b63f9dd010dff678a0c2f6306d3b82a2c1f34bbdbe329b8a006bea8a4da6455658
6
+ metadata.gz: d23ee7038ae7446eab7110135c4adf15d792c20e634afa405f71bfd6f514195879b23b0689559ef4ef85bfc7046b740904b49f44c7c478202ea82243d90a258b
7
+ data.tar.gz: e8a1564ff8d17ce72c3f303996ee113b73a49341272d722e2fc4e2f53c0b1c12b2e41f4465bb816a04ff295cf5779e056ca562bf7a2c1571228d717357f2879e
data/History.md CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ 0.1.8 / 2019-01-08
3
+ ==================
4
+
5
+ * Add find! method that returns an exception when no stock totals found
6
+
2
7
  0.1.7 / 2019-01-08
3
8
  ==================
4
9
 
data/lib/snap.rb CHANGED
@@ -7,6 +7,7 @@ require 'snap/client'
7
7
  require 'snap/response'
8
8
 
9
9
  require 'snap/api/errors/order_stage_error'
10
+ require 'snap/api/errors/stock_total_not_found_error'
10
11
 
11
12
  require 'snap/api/outbound'
12
13
  require 'snap/api/stock_totals'
@@ -0,0 +1,7 @@
1
+ module Snap
2
+ module Api
3
+ # An stock total not found occurs when the sku doesn't exits in snap
4
+ class StockTotalNotFoundError < StandardError
5
+ end
6
+ end
7
+ end
@@ -13,6 +13,13 @@ module Snap
13
13
  client.get("/stocktotals?$filter=SKUId eq '#{sku}'")
14
14
  end
15
15
 
16
+ def self.find!(sku:)
17
+ response = find(sku: sku)
18
+ raise Api::StockTotalNotFoundError, "No stock totals found for #{sku}" if response.empty?
19
+
20
+ response
21
+ end
22
+
16
23
  def self.model
17
24
  Snap::StockTotalList
18
25
  end
data/lib/snap/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Snap
2
- VERSION = '0.1.7'.freeze
2
+ VERSION = '0.1.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snap-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-08 00:00:00.000000000 Z
11
+ date: 2019-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -200,6 +200,7 @@ files:
200
200
  - config/initializers/snap.rb
201
201
  - lib/snap.rb
202
202
  - lib/snap/api/errors/order_stage_error.rb
203
+ - lib/snap/api/errors/stock_total_not_found_error.rb
203
204
  - lib/snap/api/outbound.rb
204
205
  - lib/snap/api/shipment_status.rb
205
206
  - lib/snap/api/shipments.rb