api_demo_v1 0.1.4 → 0.1.6
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_demo_v1/sabeq_helpers.rb +22 -8
- data/lib/api_demo_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: 0e4f389def95022e4edddd9579ec1330d6835344093621042a7c169ae0858751
|
4
|
+
data.tar.gz: 00a1fb4734d2a0764cee4b1ddcf65c4e6a0552176b13827cf834504871e0ea49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bcf299256aaf9b879eb718cc2c6fab09843f2f39128aa12bd392a11641b3cb08eca5f556963d020ccd62c51ea9f38badd1eab33259315a07f50cbb298bf2236
|
7
|
+
data.tar.gz: 1825d522e993aa9ebf4783073c7671cc6237448d4df6d7f9e2903a0c99b41c92598690a04ad8659a34d2bdd7b1fded03d8250d875f86a360d974365319b18624
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require "net/http"
|
2
2
|
require "net/https"
|
3
3
|
|
4
|
-
module
|
4
|
+
module ApiDemoV1
|
5
5
|
module SabeqHelpers
|
6
6
|
REQUEST_HEADER = {'Content-Type' => 'application/json'}
|
7
|
-
SABEQ_URL = "https://
|
7
|
+
SABEQ_URL = "https://localhost:3001/"
|
8
8
|
|
9
9
|
# Authorize the request
|
10
10
|
# parameters: login_token
|
@@ -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"
|
@@ -95,7 +109,7 @@ module ApiSabeqPsV1
|
|
95
109
|
def make_post_request(url_link, json_content)
|
96
110
|
uri = URI.parse(url_link)
|
97
111
|
http = Net::HTTP.new(uri.host, uri.port)
|
98
|
-
http.use_ssl =
|
112
|
+
http.use_ssl = false
|
99
113
|
a_request = Net::HTTP::Post.new(uri.request_uri, REQUEST_HEADER)
|
100
114
|
a_request.body = json_content.to_json
|
101
115
|
a_response = http.request(a_request)
|
@@ -105,7 +119,7 @@ module ApiSabeqPsV1
|
|
105
119
|
def make_get_request(url_link, json_content)
|
106
120
|
uri = URI.parse(url_link)
|
107
121
|
http = Net::HTTP.new(uri.host, uri.port)
|
108
|
-
http.use_ssl =
|
122
|
+
http.use_ssl = false
|
109
123
|
the_params = json_content
|
110
124
|
uri.query = URI.encode_www_form(the_params)
|
111
125
|
a_request = Net::HTTP::Get.new(uri.request_uri)
|
data/lib/api_demo_v1/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_demo_v1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ShaimaKaraki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Its a gem for sabeq.ps API helper functionalities
|
14
14
|
email:
|