shipstation 0.16.5 → 0.16.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shipstation.rb +19 -0
- data/lib/shipstation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a171fba8d97be21008ec2af692a5081c51e88761
|
4
|
+
data.tar.gz: 32deea3da2ddc28b4733d35877b15054aeaea1ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76c794fceaab3966d0af00c080740d589e3e42fdfd646d551aef47c55da7be0bd2a6db905509addb7fb3c0ea300519326f40eb2cff3ce4769eac7b4201261609
|
7
|
+
data.tar.gz: ff74fc578bd9b07a1a3589d23f6be8351d61dccc0a5165d1123ff90c18afc80cf0003f001b42ca52dd3bab4c639a464107aee972276e31bf990beb7bb9876580
|
data/lib/shipstation.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rest-client'
|
2
4
|
|
3
5
|
require 'shipstation/api_operations/list'
|
@@ -17,6 +19,7 @@ require 'shipstation/product'
|
|
17
19
|
require 'shipstation/tag'
|
18
20
|
|
19
21
|
module Shipstation
|
22
|
+
|
20
23
|
API_BASE = "https://ssapi.shipstation.com/"
|
21
24
|
|
22
25
|
class ShipstationError < StandardError
|
@@ -26,6 +29,15 @@ module Shipstation
|
|
26
29
|
end
|
27
30
|
class ConfigurationError < ShipstationError;
|
28
31
|
end
|
32
|
+
class ApiRequestError < ShipstationError
|
33
|
+
attr_reader :response_code, :response_headers, :response_body
|
34
|
+
|
35
|
+
def initialize(response_code:, response_headers:, response_body:)
|
36
|
+
@response_code = response_code
|
37
|
+
@response_headers = response_headers
|
38
|
+
@response_body = response_body
|
39
|
+
end
|
40
|
+
end
|
29
41
|
|
30
42
|
class << self
|
31
43
|
def username
|
@@ -71,6 +83,13 @@ module Shipstation
|
|
71
83
|
payload: payload ? payload.to_json : nil,
|
72
84
|
headers: headers
|
73
85
|
}).execute do |response, request, result|
|
86
|
+
if response.code != 200
|
87
|
+
raise ApiRequestError(
|
88
|
+
response_code: response.code,
|
89
|
+
response_headers: response.headers,
|
90
|
+
response_body: response.to_str
|
91
|
+
)
|
92
|
+
end
|
74
93
|
str_response = response.to_str
|
75
94
|
str_response.blank? ? '' : JSON.parse(str_response)
|
76
95
|
end
|
data/lib/shipstation/version.rb
CHANGED
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.16.
|
4
|
+
version: 0.16.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Dallimore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|