fulfil_api 0.5.0 → 0.5.1
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 +4 -4
- data/README.md +4 -4
- data/lib/fulfil_api/tpl_client.rb +9 -9
- data/lib/fulfil_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b2f385c53e1a0cb8df12a9869060c93d5e0cf24dbdf9277f104a68ac36d5d62
|
|
4
|
+
data.tar.gz: 82981d13dcb644beb81712d8c6784990007f926c44137890ce1cb6d28a3e59df
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fafc5b8317be062615e13d6a390f5f7e49557d9039957faad958225f7a264be29da6e556803bd914654a77b2c30365d19f431592748459c7dcba5f810546bb22
|
|
7
|
+
data.tar.gz: 5ff7b0cef942956dc814d7761fc97c939111e299abe54e228af8e3dde10bd257de4772b83389126be001236f0a9b8f0f80fe17b493ff981b4821be0fe766c9e1
|
data/README.md
CHANGED
|
@@ -153,16 +153,16 @@ The 3PL client is accessible via `FulfilApi.tpl_client` and supports the standar
|
|
|
153
153
|
|
|
154
154
|
```ruby
|
|
155
155
|
# GET request with optional URL parameters
|
|
156
|
-
FulfilApi.tpl_client.get("inbound-transfers",
|
|
156
|
+
FulfilApi.tpl_client.get("inbound-transfers", page: 1, per_page: 25)
|
|
157
157
|
|
|
158
158
|
# POST request with a request body
|
|
159
|
-
FulfilApi.tpl_client.post("inbound-transfers/receive.json",
|
|
159
|
+
FulfilApi.tpl_client.post("inbound-transfers/receive.json", { tracking_number: "ABC123" })
|
|
160
160
|
|
|
161
161
|
# PUT request with a request body
|
|
162
|
-
FulfilApi.tpl_client.put("inbound-transfers/receive.json",
|
|
162
|
+
FulfilApi.tpl_client.put("inbound-transfers/receive.json", { status: "received" })
|
|
163
163
|
|
|
164
164
|
# PATCH request with a request body
|
|
165
|
-
FulfilApi.tpl_client.patch("inbound-transfers/receive.json",
|
|
165
|
+
FulfilApi.tpl_client.patch("inbound-transfers/receive.json", { status: "received" })
|
|
166
166
|
|
|
167
167
|
```
|
|
168
168
|
|
|
@@ -9,8 +9,8 @@ module FulfilApi
|
|
|
9
9
|
# the 3PL supplier API using standard HTTP methods.
|
|
10
10
|
#
|
|
11
11
|
# @example Using the TPL client
|
|
12
|
-
# FulfilApi.tpl_client.get("inbound-transfers",
|
|
13
|
-
# FulfilApi.tpl_client.post("inbound-transfers/receive.json",
|
|
12
|
+
# FulfilApi.tpl_client.get("inbound-transfers", page: 1)
|
|
13
|
+
# FulfilApi.tpl_client.post("inbound-transfers/receive.json", { tracking_number: "123" })
|
|
14
14
|
class TplClient
|
|
15
15
|
class ConfigurationError < FulfilApi::Error; end
|
|
16
16
|
|
|
@@ -33,10 +33,10 @@ module FulfilApi
|
|
|
33
33
|
# Performs an HTTP GET request to a 3PL API endpoint.
|
|
34
34
|
#
|
|
35
35
|
# @param relative_path [String] The relative path to the endpoint.
|
|
36
|
-
# @param url_parameters [Hash
|
|
36
|
+
# @param url_parameters [Hash] The optional URL parameters for the API endpoint.
|
|
37
37
|
# @return [Array, Hash, String] The parsed response body.
|
|
38
|
-
def get(relative_path, url_parameters
|
|
39
|
-
request(:get, relative_path, url_parameters)
|
|
38
|
+
def get(relative_path, **url_parameters)
|
|
39
|
+
request(:get, relative_path, url_parameters.presence)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
# Performs an HTTP PATCH request to a 3PL API endpoint.
|
|
@@ -44,7 +44,7 @@ module FulfilApi
|
|
|
44
44
|
# @param relative_path [String] The relative path to the endpoint.
|
|
45
45
|
# @param body [Array, Hash, nil] The request body for the PATCH HTTP request.
|
|
46
46
|
# @return [Array, Hash, String] The parsed response body.
|
|
47
|
-
def patch(relative_path, body
|
|
47
|
+
def patch(relative_path, body = {})
|
|
48
48
|
request(:patch, relative_path, body)
|
|
49
49
|
end
|
|
50
50
|
|
|
@@ -53,7 +53,7 @@ module FulfilApi
|
|
|
53
53
|
# @param relative_path [String] The relative path to the endpoint.
|
|
54
54
|
# @param body [Array, Hash, nil] The request body for the POST HTTP request.
|
|
55
55
|
# @return [Array, Hash, String] The parsed response body.
|
|
56
|
-
def post(relative_path, body
|
|
56
|
+
def post(relative_path, body = {})
|
|
57
57
|
request(:post, relative_path, body)
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -62,7 +62,7 @@ module FulfilApi
|
|
|
62
62
|
# @param relative_path [String] The relative path to the endpoint.
|
|
63
63
|
# @param body [Array, Hash, nil] The optional request body for the PUT HTTP request.
|
|
64
64
|
# @return [Array, Hash, String] The parsed response body.
|
|
65
|
-
def put(relative_path, body
|
|
65
|
+
def put(relative_path, body = nil)
|
|
66
66
|
return request(:put, relative_path) if body.nil?
|
|
67
67
|
|
|
68
68
|
request(:put, relative_path, body)
|
|
@@ -137,7 +137,7 @@ module FulfilApi
|
|
|
137
137
|
#
|
|
138
138
|
# @example
|
|
139
139
|
# FulfilApi.tpl_client.get("inbound-transfers")
|
|
140
|
-
# FulfilApi.tpl_client.post("inbound-transfers/receive.json",
|
|
140
|
+
# FulfilApi.tpl_client.post("inbound-transfers/receive.json", { tracking_number: "123" })
|
|
141
141
|
#
|
|
142
142
|
# @return [FulfilApi::TplClient]
|
|
143
143
|
def self.tpl_client
|
data/lib/fulfil_api/version.rb
CHANGED