snap-api 0.1.3 → 0.1.4

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
  SHA256:
3
- metadata.gz: 4592a8b8ed8dd7a9e013f3cefb4c16a1806a6e996616554f6a79c1974db91a43
4
- data.tar.gz: 7b27b3c4b371b4570117d69153dc606945c2c31772077dfdc4e48dbb1407c820
3
+ metadata.gz: caeae4ddeae317c237567774b5ecb054142b02d24d24bf4b1218f93d9feb44c7
4
+ data.tar.gz: 950b6945052899297045d606dd9911a339576298b404354ee593a59147a162f7
5
5
  SHA512:
6
- metadata.gz: 241c33e0e72c694fdfcc03761bc2ef0d228f46df0ad343e75a8b5ff0d1eb0bfd50c51b7786deef813af74a12fcab30df2ea9c5f439cf2171305ef6a63535a027
7
- data.tar.gz: 366ba28d8e85cbd14d77a592a65907315d9a263645075251425b6d116ca2f55bdfd2b034a939fcbbb8932ec79a21f36cb1e1c6222f0bec44a158bc43760cdb30
6
+ metadata.gz: 73450e8a5dc843617f1289fb98c9f3eebb6cc16b9859fecdd644dc43db13f0c4f58f38df5838efb18cc05eea0ea2b7896c7e250249023aea260932f84664dbd4
7
+ data.tar.gz: b32116608cba5ea60cfa3e393d8cdcfd5b2fc675af24bb1b9346aa7e98a80e8980cd49c437a032fff84741d1f1de4efdece180f38e78f8742deedd4eaf52b950
data/History.md CHANGED
@@ -1,4 +1,10 @@
1
1
 
2
+ 0.1.4 / 2018-09-30
3
+ ==================
4
+
5
+ * Add Outbound api and models
6
+ * Add Shipments#update
7
+
2
8
  0.1.3 / 2018-09-17
3
9
  ==================
4
10
 
@@ -0,0 +1,21 @@
1
+ module Snap
2
+ module Api
3
+ # Interact with the snap outbound endpoint.
4
+ class Outbound
5
+ include HTTParty
6
+ extend Client
7
+
8
+ def self.index(top: 1000)
9
+ client.get('/snapoutbound', query: { '$top': top })
10
+ end
11
+
12
+ def self.acknowledge(id:)
13
+ client.put("/snapoutbound/#{id}")
14
+ end
15
+
16
+ def self.model
17
+ Snap::OutboundList
18
+ end
19
+ end
20
+ end
21
+ end
@@ -18,6 +18,11 @@ module Snap
18
18
  client.post('/shipments', body: shipment)
19
19
  end
20
20
 
21
+ def self.update(options)
22
+ shipment = Snap::Shipment.new(options)
23
+ client.put("/shipments/#{shipment.ShipmentId}", body: shipment)
24
+ end
25
+
21
26
  def self.model
22
27
  Snap::Shipment
23
28
  end
@@ -0,0 +1,17 @@
1
+ module Snap
2
+ module Models
3
+ # A representation of an outbound event.
4
+ class Outbound < Hashie::Trash
5
+ include Hashie::Extensions::IndifferentAccess
6
+
7
+ property :Host
8
+ property :XDoc
9
+ property :Transaction
10
+ property :Key, transform_with: ->(v) { Hash[v.scan(/(\w+)="(.*?)"/)] }
11
+ property :Batch
12
+ property :DateCreated
13
+ property :DateProcessed
14
+ property :Stage
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ require 'delegate'
2
+
3
+ module Snap
4
+ module Models
5
+ # Hydrate an array of stock totals.
6
+ class OutboundList < SimpleDelegator
7
+ def initialize(list)
8
+ super(list.map { |item| Outbound.new(item) })
9
+ end
10
+ end
11
+ end
12
+ end
data/lib/snap/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Snap
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
data/lib/snap.rb CHANGED
@@ -6,10 +6,13 @@ require 'snap/version'
6
6
  require 'snap/client'
7
7
  require 'snap/response'
8
8
 
9
+ require 'snap/api/outbound'
9
10
  require 'snap/api/stock_totals'
10
11
  require 'snap/api/shipment_status'
11
12
  require 'snap/api/shipments'
12
13
 
14
+ require 'snap/models/outbound'
15
+ require 'snap/models/outbound_list'
13
16
  require 'snap/models/stock_total'
14
17
  require 'snap/models/stock_total_list'
15
18
  require 'snap/models/shipment_status'
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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-17 00:00:00.000000000 Z
11
+ date: 2018-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -199,10 +199,13 @@ files:
199
199
  - bin/setup
200
200
  - config/initializers/snap.rb
201
201
  - lib/snap.rb
202
+ - lib/snap/api/outbound.rb
202
203
  - lib/snap/api/shipment_status.rb
203
204
  - lib/snap/api/shipments.rb
204
205
  - lib/snap/api/stock_totals.rb
205
206
  - lib/snap/client.rb
207
+ - lib/snap/models/outbound.rb
208
+ - lib/snap/models/outbound_list.rb
206
209
  - lib/snap/models/shipment.rb
207
210
  - lib/snap/models/shipment_line.rb
208
211
  - lib/snap/models/shipment_status.rb