shippy_pro_api 0.1.1 → 0.2.0
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/Gemfile.lock +25 -8
- data/lib/shippy_pro_api/client.rb +15 -13
- data/lib/shippy_pro_api/resource.rb +0 -8
- data/lib/shippy_pro_api/version.rb +1 -1
- data/lib/shippy_pro_api.rb +10 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffd949fd81f70b5b4e6d28b6ebc51521e7e20da3d5e9870f201e5c488609bd2f
|
4
|
+
data.tar.gz: 3156212b3e3f5bec5657885756894ba12bbdc615fa629a35d9588c0e103ba0db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d296c73163f3ff8e40b87e2a7a58c4eb8638838974742a91d4ae6e2675fbb0e30251d6f2a9f9e2ef7d9436a144015903198fcb2c310a8517453d1209cc81b09
|
7
|
+
data.tar.gz: a779b1d80264cf96269305508c95f16566603d64f2db68523f86fd49fdbe00e2c14cb9a62788a822d173e40ffe9ede54efbf54f314dee5538908220bf2f26a1b
|
data/Gemfile.lock
CHANGED
@@ -1,34 +1,48 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
shippy_pro_api (0.1.
|
4
|
+
shippy_pro_api (0.1.1)
|
5
5
|
activesupport
|
6
6
|
faraday (~> 2.7.10)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (
|
12
|
-
|
11
|
+
activesupport (8.0.1)
|
12
|
+
base64
|
13
|
+
benchmark (>= 0.3)
|
14
|
+
bigdecimal
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
16
|
+
connection_pool (>= 2.2.5)
|
17
|
+
drb
|
13
18
|
i18n (>= 1.6, < 2)
|
19
|
+
logger (>= 1.4.2)
|
14
20
|
minitest (>= 5.1)
|
15
|
-
|
21
|
+
securerandom (>= 0.3)
|
22
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
23
|
+
uri (>= 0.13.1)
|
16
24
|
ast (2.4.2)
|
17
25
|
base64 (0.1.1)
|
26
|
+
benchmark (0.4.0)
|
27
|
+
bigdecimal (3.1.9)
|
18
28
|
coderay (1.1.3)
|
19
|
-
concurrent-ruby (1.
|
29
|
+
concurrent-ruby (1.3.5)
|
30
|
+
connection_pool (2.5.0)
|
20
31
|
diff-lcs (1.5.0)
|
21
32
|
dotenv (2.8.1)
|
22
|
-
|
33
|
+
drb (2.2.1)
|
34
|
+
faraday (2.7.12)
|
35
|
+
base64
|
23
36
|
faraday-net_http (>= 2.0, < 3.1)
|
24
37
|
ruby2_keywords (>= 0.0.4)
|
25
38
|
faraday-net_http (3.0.2)
|
26
|
-
i18n (1.14.
|
39
|
+
i18n (1.14.7)
|
27
40
|
concurrent-ruby (~> 1.0)
|
28
41
|
json (2.6.3)
|
29
42
|
language_server-protocol (3.17.0.3)
|
43
|
+
logger (1.6.6)
|
30
44
|
method_source (1.0.0)
|
31
|
-
minitest (5.
|
45
|
+
minitest (5.25.4)
|
32
46
|
parallel (1.23.0)
|
33
47
|
parser (3.2.2.3)
|
34
48
|
ast (~> 2.4.1)
|
@@ -70,12 +84,15 @@ GEM
|
|
70
84
|
parser (>= 3.2.1.0)
|
71
85
|
ruby-progressbar (1.13.0)
|
72
86
|
ruby2_keywords (0.0.5)
|
87
|
+
securerandom (0.4.1)
|
73
88
|
tzinfo (2.0.6)
|
74
89
|
concurrent-ruby (~> 1.0)
|
75
90
|
unicode-display_width (2.4.2)
|
91
|
+
uri (1.0.3)
|
76
92
|
|
77
93
|
PLATFORMS
|
78
94
|
arm64-darwin-21
|
95
|
+
arm64-darwin-23
|
79
96
|
|
80
97
|
DEPENDENCIES
|
81
98
|
dotenv
|
@@ -1,34 +1,36 @@
|
|
1
|
-
require
|
1
|
+
require "faraday"
|
2
2
|
|
3
3
|
module ShippyProAPI
|
4
4
|
class Client
|
5
|
-
BASE_URL =
|
5
|
+
BASE_URL = "https://www.shippypro.com/api"
|
6
6
|
|
7
|
-
attr_reader :api_key, :adapter
|
7
|
+
attr_reader :api_key, :adapter, :config
|
8
8
|
|
9
|
-
def initialize(api_key:, adapter: Faraday.default_adapter)
|
9
|
+
def initialize(api_key:, adapter: Faraday.default_adapter, config: {})
|
10
10
|
@api_key = api_key
|
11
11
|
@adapter = adapter
|
12
|
+
@config = config
|
12
13
|
end
|
13
14
|
|
14
15
|
def connection
|
15
|
-
@connection ||=
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
@connection ||=
|
17
|
+
Faraday.new(config) do |conn|
|
18
|
+
conn.url_prefix = BASE_URL
|
19
|
+
conn.headers["Authorization"] = "Basic #{encoded_credentials}"
|
20
|
+
conn.request :json
|
21
|
+
conn.response :json, content_type: "application/json"
|
22
|
+
conn.adapter adapter
|
23
|
+
end
|
22
24
|
end
|
23
25
|
|
24
26
|
def shipment
|
25
27
|
ShipmentResource.new(self)
|
26
28
|
end
|
27
|
-
|
29
|
+
|
28
30
|
private
|
29
31
|
|
30
32
|
def encoded_credentials
|
31
33
|
Base64.strict_encode64("#{api_key}:")
|
32
34
|
end
|
33
35
|
end
|
34
|
-
end
|
36
|
+
end
|
@@ -10,18 +10,10 @@ module ShippyProAPI
|
|
10
10
|
@client = client
|
11
11
|
end
|
12
12
|
|
13
|
-
# def get_request(url, params: {}, headers: {})
|
14
|
-
# handle_response client.connection.get(url, params, headers)
|
15
|
-
# end
|
16
|
-
|
17
13
|
def post_request(url, body:, headers: {})
|
18
14
|
handle_response client.connection.post(url, parse_body(body), headers)
|
19
15
|
end
|
20
16
|
|
21
|
-
# def put_request(url, body:, headers: {})
|
22
|
-
# handle_response client.connection.put(url, parse_body(body), headers)
|
23
|
-
# end
|
24
|
-
|
25
17
|
private
|
26
18
|
|
27
19
|
def handle_response(response)
|
data/lib/shippy_pro_api.rb
CHANGED
@@ -3,16 +3,16 @@
|
|
3
3
|
require_relative "shippy_pro_api/version"
|
4
4
|
|
5
5
|
module ShippyProAPI
|
6
|
-
autoload :Client,
|
7
|
-
autoload :Error,
|
8
|
-
autoload :Object,
|
9
|
-
autoload :Resource,
|
6
|
+
autoload :Client, "shippy_pro_api/client"
|
7
|
+
autoload :Error, "shippy_pro_api/error"
|
8
|
+
autoload :Object, "shippy_pro_api/object"
|
9
|
+
autoload :Resource, "shippy_pro_api/resource"
|
10
10
|
|
11
|
-
autoload :Rate,
|
12
|
-
autoload :RateError,
|
13
|
-
autoload :Rates,
|
14
|
-
autoload :Shipment,
|
15
|
-
autoload :TrackingInfo,
|
11
|
+
autoload :Rate, "shippy_pro_api/objects/rate"
|
12
|
+
autoload :RateError, "shippy_pro_api/objects/rate_error"
|
13
|
+
autoload :Rates, "shippy_pro_api/objects/rates"
|
14
|
+
autoload :Shipment, "shippy_pro_api/objects/shipment"
|
15
|
+
autoload :TrackingInfo, "shippy_pro_api/objects/tracking_info"
|
16
16
|
|
17
|
-
autoload :ShipmentResource,
|
17
|
+
autoload :ShipmentResource, "shippy_pro_api/resources/shipment"
|
18
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shippy_pro_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nickfarm27
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
|
-
rubygems_version: 3.
|
134
|
+
rubygems_version: 3.5.23
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: ShippyPro API Wrapper
|