api_sabeq_ps_v1 0.1.8 → 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/lib/api_sabeq_ps_v1/sabeq_helpers.rb +43 -4
- data/lib/api_sabeq_ps_v1/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bd108392dedcf47eb243d3f7afb36ef399dcfb7f07bcdccc843404fe3e8b1db5
|
|
4
|
+
data.tar.gz: e027bf7f59c0d615d2fb6f5e03c53ee5f965bde9b21257f1a4df59e5d95c2640
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 349c2f8e1abc4e6216806724e43dd067b686883b062319b9fceb19dafc11de74a729b8d9173b2f12ddd751ae905fb762953907d74df7b08b1d27c6a9b7a2ab04
|
|
7
|
+
data.tar.gz: 72eacab17f87b64a6fc2b8c68b792a6fcb8dcdd4cb2bebb42cc1735dbf0f268e203ceb02ace8ea1214142de0728507ac63585a67befcc0fb33126bbfa1a515f3
|
|
@@ -52,14 +52,12 @@ module ApiSabeqPsV1
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def sabeq_api_v1_create_parcel(verification_token, name, phone1, phone2, content,
|
|
55
|
-
payment_amount, area_id, address,
|
|
56
|
-
delivery_notes, special_notes)
|
|
55
|
+
payment_amount, area_id, address, delivery_notes, special_notes)
|
|
57
56
|
auth_link = SABEQ_URL + "/api/v1/parcels"
|
|
58
57
|
auth_json = { verification_token: verification_token,
|
|
59
58
|
name: name, phone1: phone1, phone2: phone2,
|
|
60
59
|
content: content, payment_amount: payment_amount,
|
|
61
|
-
area_id: area_id,
|
|
62
|
-
address: address, location_url: location_url,
|
|
60
|
+
area_id: area_id, address: address,
|
|
63
61
|
delivery_notes: delivery_notes,
|
|
64
62
|
special_notes: special_notes }
|
|
65
63
|
json_response = make_post_request(auth_link, auth_json)
|
|
@@ -68,6 +66,22 @@ module ApiSabeqPsV1
|
|
|
68
66
|
end
|
|
69
67
|
|
|
70
68
|
def sabeq_api_v1_1_create_parcel(verification_token, name, phone1, phone2, content,
|
|
69
|
+
payment_amount, area_id, street_id, address, service_type,
|
|
70
|
+
delivery_notes, special_notes)
|
|
71
|
+
auth_link = SABEQ_URL + "/api/v1/parcels"
|
|
72
|
+
auth_json = { verification_token: verification_token,
|
|
73
|
+
name: name, phone1: phone1, phone2: phone2,
|
|
74
|
+
content: content, payment_amount: payment_amount,
|
|
75
|
+
area_id: area_id, street_id: street_id, address: address,
|
|
76
|
+
service_type: service_type,
|
|
77
|
+
delivery_notes: delivery_notes,
|
|
78
|
+
special_notes: special_notes }
|
|
79
|
+
json_response = make_post_request(auth_link, auth_json)
|
|
80
|
+
|
|
81
|
+
return json_response
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def sabeq_api_v1_2_create_parcel(verification_token, name, phone1, phone2, content,
|
|
71
85
|
payment_amount, area_id, street_id, address, location_url,
|
|
72
86
|
service_type, delivery_notes, special_notes)
|
|
73
87
|
auth_link = SABEQ_URL + "/api/v1/parcels"
|
|
@@ -84,6 +98,21 @@ module ApiSabeqPsV1
|
|
|
84
98
|
return json_response
|
|
85
99
|
end
|
|
86
100
|
|
|
101
|
+
def sabeq_api_v1_update_parcel(verification_token, collect_money, name, phone1, phone2, content, address, area_id)
|
|
102
|
+
auth_link = SABEQ_URL + "/api/v1/parcels/#{parcel_number}"
|
|
103
|
+
auth_json = { verification_token: verification_token,
|
|
104
|
+
payment_amount: collect_money,
|
|
105
|
+
customer_name: name,
|
|
106
|
+
phone1: phone1,
|
|
107
|
+
phone2: phone2,
|
|
108
|
+
content: content,
|
|
109
|
+
address: address,
|
|
110
|
+
area_id: area_id }
|
|
111
|
+
json_response = make_patch_request(auth_link, auth_json)
|
|
112
|
+
|
|
113
|
+
return json_response
|
|
114
|
+
end
|
|
115
|
+
|
|
87
116
|
def sabeq_api_v1_cancel_parcel(verification_token, parcel_number)
|
|
88
117
|
auth_link = SABEQ_URL + "/api/v1/parcels/#{parcel_number}/cancel_parcel"
|
|
89
118
|
auth_json = { verification_token: verification_token }
|
|
@@ -113,6 +142,16 @@ module ApiSabeqPsV1
|
|
|
113
142
|
return a_response.body
|
|
114
143
|
end
|
|
115
144
|
|
|
145
|
+
def make_patch_request(url_link, json_content)
|
|
146
|
+
uri = URI.parse(url_link)
|
|
147
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
148
|
+
#http.use_ssl = true
|
|
149
|
+
a_request = Net::HTTP::Patch.new(uri.request_uri, REQUEST_HEADER)
|
|
150
|
+
a_request.body = json_content.to_json
|
|
151
|
+
a_response = http.request(a_request)
|
|
152
|
+
return a_response.body
|
|
153
|
+
end
|
|
154
|
+
|
|
116
155
|
def get_error_or_returned_value(json_response)
|
|
117
156
|
# check if the response has errors
|
|
118
157
|
hashed_response = JSON.parse(json_response)
|
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.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ShaimaKaraki
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Its a gem for sabeq.ps API helper functionalities
|
|
14
14
|
email:
|
|
@@ -21,7 +21,7 @@ files:
|
|
|
21
21
|
- lib/api_sabeq_ps_v1/railtie.rb
|
|
22
22
|
- lib/api_sabeq_ps_v1/sabeq_helpers.rb
|
|
23
23
|
- lib/api_sabeq_ps_v1/version.rb
|
|
24
|
-
homepage: https://github.com/ShaimaKaraki/
|
|
24
|
+
homepage: https://github.com/ShaimaKaraki/api_sabeq_ps_v1.git
|
|
25
25
|
licenses:
|
|
26
26
|
- MIT
|
|
27
27
|
metadata: {}
|
|
@@ -40,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
41
|
version: '0'
|
|
42
42
|
requirements: []
|
|
43
|
-
rubygems_version: 3.
|
|
43
|
+
rubygems_version: 3.5.16
|
|
44
44
|
signing_key:
|
|
45
45
|
specification_version: 4
|
|
46
46
|
summary: gem for sabeq.ps API helper functionalities
|