api_sabeq_ps_v1 0.2.1 → 0.2.3
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/lib/api_sabeq_ps_v1/sabeq_helpers.rb +26 -4
- data/lib/api_sabeq_ps_v1/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7734a05768c72d08760740612cc45ae3ffaeee5e54e5b5a3ae20264e14296b4b
|
|
4
|
+
data.tar.gz: 91513fff85511fed84f70cc0554d5d51c67f75b4dd59816c2da8d64be009e557
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5bd8addc28bf6d7b2e9a34d8d872188c69cb9b2dc7f9c2b858b0416527cfd3a5b858da2dfb03626c61c2f0f8b8781c9d6a161a9e7e53a7667d29f784d2ce43b7
|
|
7
|
+
data.tar.gz: 45303cb9b53bf2ffd54230587bb07844a7c23e104fe0a68076a80e7d31d75929b51814506dd39eadb19f380f7c9d82eadb1be0fcfecf6816dcc913770b17fbe8
|
|
@@ -37,9 +37,31 @@ module ApiSabeqPsV1
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
def
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
def sabeq_api_v2_print_parcel(verification_token, parcel_number, the_size = "default")
|
|
41
|
+
url = SABEQ_URL + "/api/v1/parcels/#{parcel_number}/print"
|
|
42
|
+
|
|
43
|
+
params = {
|
|
44
|
+
verification_token: verification_token,
|
|
45
|
+
size: the_size
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
uri = URI.parse(url)
|
|
49
|
+
uri.query = URI.encode_www_form(params)
|
|
50
|
+
|
|
51
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
52
|
+
http.use_ssl = true
|
|
53
|
+
|
|
54
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
|
55
|
+
response = http.request(request)
|
|
56
|
+
|
|
57
|
+
# IMPORTANT: return raw HTML, not JSON parsing
|
|
58
|
+
response.body
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def sabeq_api_v1_print_parcel(verification_token, parcel_number, the_size)
|
|
62
|
+
auth_link = SABEQ_URL + "/api/v1/parcels/#{parcel_number}/print"
|
|
63
|
+
auth_json = { verification_token: verification_token,
|
|
64
|
+
size: the_size }
|
|
43
65
|
json_response = make_get_request(auth_link, auth_json)
|
|
44
66
|
return json_response
|
|
45
67
|
end
|
|
@@ -146,7 +168,7 @@ module ApiSabeqPsV1
|
|
|
146
168
|
def make_patch_request(url_link, json_content)
|
|
147
169
|
uri = URI.parse(url_link)
|
|
148
170
|
http = Net::HTTP.new(uri.host, uri.port)
|
|
149
|
-
|
|
171
|
+
http.use_ssl = true
|
|
150
172
|
a_request = Net::HTTP::Patch.new(uri.request_uri, REQUEST_HEADER)
|
|
151
173
|
a_request.body = json_content.to_json
|
|
152
174
|
a_response = http.request(a_request)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: api_sabeq_ps_v1
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ShaimaKaraki
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-04-
|
|
11
|
+
date: 2026-04-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Its a gem for sabeq.ps API helper functionalities
|
|
14
14
|
email:
|