shipstation 0.18 → 0.24

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: fe71077558f3724730188ad4a60e856634889a7b8ee3800609c967f0bf7873a1
4
- data.tar.gz: f42db728139bc16c78f045ac6bad23f44501bc1938517b8a9421dd2804b0e7ed
3
+ metadata.gz: d0aba62664ac94a7b877dc17b23ec945a9362842c63aa86c3fb53462a39a470a
4
+ data.tar.gz: 36a4ad1f1111b69400291380763ca72f475aabaea626bff121a78e83ed63745b
5
5
  SHA512:
6
- metadata.gz: f131c227fa6a7993ca355e5da0624609170fc0d06881a47697292deeeafb8864f6b0103a7a37e72ef460e2bf862f84f035a548d714bececa58913933f15d00c1
7
- data.tar.gz: 2313f8c0078b3fc4dcdf275914573e6b8bfee237fa9ea993bc37515f0ec9b5b46812a2d9d4c86e05fe2e2720fa68613b53391c056f54575824b5dd65cf22ff51
6
+ metadata.gz: 2d58fd3bcdc6ee377a97a9778c3d8fb17cbefad561c706d3433ed6c1857bde33ca4829adcb838d90041efb032a90910fe9301406b725edb2d35fc51cc909417d
7
+ data.tar.gz: 4d838bd1521f561cdf77d8e6c4d3423b39761228780052b3d3238ded4aca1a6f3a636d3eba81a1c41d576b3e002750d62153f1a35b1b09a715b030a18700fbf5
data/lib/shipstation.rb CHANGED
@@ -17,6 +17,7 @@ require 'shipstation/store'
17
17
  require 'shipstation/warehouse'
18
18
  require 'shipstation/product'
19
19
  require 'shipstation/tag'
20
+ require 'shipstation/webhook'
20
21
 
21
22
  module Shipstation
22
23
 
@@ -83,13 +84,6 @@ module Shipstation
83
84
  payload: payload ? payload.to_json : nil,
84
85
  headers: headers
85
86
  }).execute do |response, request, result|
86
- if response.code != 200
87
- raise ApiRequestError.new(
88
- response_code: response.code,
89
- response_headers: response.headers,
90
- response_body: response.to_str
91
- )
92
- end
93
87
  str_response = response.to_str
94
88
  str_response.blank? ? '' : JSON.parse(str_response)
95
89
  end
@@ -2,7 +2,7 @@ module Shipstation
2
2
  module APIOperations
3
3
  module Create
4
4
 
5
- def create params = {}
5
+ def create(params = {})
6
6
  response = Shipstation.request(:post, "#{class_name.downcase.pluralize}/create#{class_name.downcase}", params)
7
7
  return response
8
8
  end
@@ -2,7 +2,7 @@ module Shipstation
2
2
  module APIOperations
3
3
  module Delete
4
4
 
5
- def delete object_id, params = {}
5
+ def delete(object_id, params = {})
6
6
  Shipstation.request(:delete, "#{class_name.downcase.pluralize}/#{object_id}", params)
7
7
  end
8
8
 
@@ -2,7 +2,7 @@ module Shipstation
2
2
  module APIOperations
3
3
  module List
4
4
 
5
- def list params = {}
5
+ def list(params = {})
6
6
  response = Shipstation.request(:get, class_name.downcase.pluralize, params)
7
7
 
8
8
  return response
@@ -2,7 +2,7 @@ module Shipstation
2
2
  module APIOperations
3
3
  module Retrieve
4
4
 
5
- def retrieve object_id, params = {}
5
+ def retrieve(object_id, params = {})
6
6
  response = Shipstation.request(:get, "#{class_name.downcase.pluralize}/#{object_id}", params)
7
7
  return response
8
8
  end
@@ -0,0 +1,10 @@
1
+ module Shipstation
2
+ module APIOperations
3
+ module Shipment
4
+
5
+ def mark_as_shipped(params = {})
6
+ Shipstation.request(:post, 'orders/markasshipped', params)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -2,7 +2,7 @@ module Shipstation
2
2
  module APIOperations
3
3
  module Update
4
4
 
5
- def update object_id, params = {}
5
+ def update(object_id, params = {})
6
6
  Shipstation.request(:put, "#{class_name.downcase.pluralize}/#{object_id}", params)
7
7
  end
8
8
 
@@ -6,6 +6,7 @@ module Shipstation
6
6
  extend Shipstation::APIOperations::Create
7
7
  extend Shipstation::APIOperations::Retrieve
8
8
  extend Shipstation::APIOperations::Delete
9
+ extend Shipstation::APIOperations::Shipment
9
10
 
10
11
  class << self
11
12
  def create_label(params = {})
@@ -1,11 +1,12 @@
1
1
  module Shipstation
2
2
  class Store < ApiResource
3
+ extend Shipstation::APIOperations::List
3
4
  extend Shipstation::APIOperations::Retrieve
4
5
  extend Shipstation::APIOperations::Update
5
6
 
6
7
  class << self
7
- def list
8
- response = Shipstation.request(:get, 'stores')
8
+ def list(params = {})
9
+ response = Shipstation.request(:get, 'stores', params)
9
10
 
10
11
  return response
11
12
  end
@@ -2,8 +2,8 @@ module Shipstation
2
2
  class Tag < ApiResource
3
3
 
4
4
  class << self
5
- def list
6
- response = Shipstation.request(:get, 'accounts/listtags')
5
+ def list(params = {})
6
+ response = Shipstation.request(:get, 'accounts/listtags', params)
7
7
 
8
8
  return response
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module Shipstation
2
- VERSION = "0.18"
2
+ VERSION = "0.24"
3
3
  end
@@ -5,8 +5,8 @@ module Shipstation
5
5
  extend Shipstation::APIOperations::Update
6
6
 
7
7
  class << self
8
- def list
9
- response = Shipstation.request(:get, 'warehouses')
8
+ def list(params = {})
9
+ response = Shipstation.request(:get, 'warehouses', params)
10
10
 
11
11
  return response
12
12
  end
@@ -0,0 +1,19 @@
1
+ module Shipstation
2
+ class Webhook < ApiResource
3
+ extend Shipstation::APIOperations::List
4
+
5
+ class << self
6
+ def subscribe(params={})
7
+ response = Shipstation.request(:post, 'webhooks/subscribe', params)
8
+
9
+ return response
10
+ end
11
+
12
+ def unsubscribe(object_id, params={})
13
+ response = Shipstation.request(:delete, "webhooks/#{object_id}", params)
14
+
15
+ return response
16
+ end
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shipstation
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.18'
4
+ version: '0.24'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Dallimore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-24 00:00:00.000000000 Z
11
+ date: 2021-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -38,6 +38,7 @@ files:
38
38
  - lib/shipstation/api_operations/delete.rb
39
39
  - lib/shipstation/api_operations/list.rb
40
40
  - lib/shipstation/api_operations/retrieve.rb
41
+ - lib/shipstation/api_operations/shipment.rb
41
42
  - lib/shipstation/api_operations/update.rb
42
43
  - lib/shipstation/api_resource.rb
43
44
  - lib/shipstation/carrier.rb
@@ -49,6 +50,7 @@ files:
49
50
  - lib/shipstation/tag.rb
50
51
  - lib/shipstation/version.rb
51
52
  - lib/shipstation/warehouse.rb
53
+ - lib/shipstation/webhook.rb
52
54
  - lib/tasks/shipstation_tasks.rake
53
55
  - test/dummy/Gemfile
54
56
  - test/dummy/Gemfile.lock
@@ -112,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
114
  - !ruby/object:Gem::Version
113
115
  version: '0'
114
116
  requirements: []
115
- rubygems_version: 3.1.2
117
+ rubygems_version: 3.2.15
116
118
  signing_key:
117
119
  specification_version: 4
118
120
  summary: A Ruby wrapper for the Shipstation API