api_demo_v1 0.1.3 → 0.1.4
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 +12 -9
- 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: 4fa9ab7f121ce4fea30e1cf209caffec5cdd66b33d361cd2f5283fdea4ced8f2
|
4
|
+
data.tar.gz: 247a5e2380b1d0b0adf39ad074fb577f0cbb67162c7a16e51dfd24b4769381d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 172352e913ad391adc72520541d503fd813c8f59f03fea9111f60dd820c51d6797234dc81238fbd141c8756cdd2c13c2f5359344ac0b2cf15c500f041d36fd76
|
7
|
+
data.tar.gz: 7c006100c0facd123efd0b51c5ff9b8fe5a656775d827fce7920ec209e6fb9c27cfcda8b5f9025d5c99ef89a2400f7c23c081c80a9baa1894668267a68089f72
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require "net/http"
|
2
2
|
require "net/https"
|
3
3
|
|
4
|
-
module
|
4
|
+
module ApiSabeqPsV1
|
5
5
|
module SabeqHelpers
|
6
6
|
REQUEST_HEADER = {'Content-Type' => 'application/json'}
|
7
|
-
SABEQ_URL = "https://
|
7
|
+
SABEQ_URL = "https://sabeq.ps"
|
8
8
|
|
9
9
|
# Authorize the request
|
10
10
|
# parameters: login_token
|
@@ -52,12 +52,14 @@ module ApiDemoV1
|
|
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,
|
55
|
+
payment_amount, area_id, address, location_url,
|
56
|
+
delivery_notes, special_notes)
|
56
57
|
auth_link = SABEQ_URL + "/api/v1/parcels"
|
57
58
|
auth_json = { verification_token: verification_token,
|
58
59
|
name: name, phone1: phone1, phone2: phone2,
|
59
60
|
content: content, payment_amount: payment_amount,
|
60
|
-
area_id: area_id,
|
61
|
+
area_id: area_id,
|
62
|
+
address: address, location_url: location_url,
|
61
63
|
delivery_notes: delivery_notes,
|
62
64
|
special_notes: special_notes }
|
63
65
|
json_response = make_post_request(auth_link, auth_json)
|
@@ -66,13 +68,14 @@ module ApiDemoV1
|
|
66
68
|
end
|
67
69
|
|
68
70
|
def sabeq_api_v1_1_create_parcel(verification_token, name, phone1, phone2, content,
|
69
|
-
payment_amount, area_id, street_id, address,
|
70
|
-
delivery_notes, special_notes)
|
71
|
+
payment_amount, area_id, street_id, address, location_url,
|
72
|
+
service_type, delivery_notes, special_notes)
|
71
73
|
auth_link = SABEQ_URL + "/api/v1/parcels"
|
72
74
|
auth_json = { verification_token: verification_token,
|
73
75
|
name: name, phone1: phone1, phone2: phone2,
|
74
76
|
content: content, payment_amount: payment_amount,
|
75
|
-
area_id: area_id, street_id: street_id,
|
77
|
+
area_id: area_id, street_id: street_id,
|
78
|
+
address: address, location_url: location_url,
|
76
79
|
service_type: service_type,
|
77
80
|
delivery_notes: delivery_notes,
|
78
81
|
special_notes: special_notes }
|
@@ -92,7 +95,7 @@ module ApiDemoV1
|
|
92
95
|
def make_post_request(url_link, json_content)
|
93
96
|
uri = URI.parse(url_link)
|
94
97
|
http = Net::HTTP.new(uri.host, uri.port)
|
95
|
-
http.use_ssl =
|
98
|
+
http.use_ssl = true
|
96
99
|
a_request = Net::HTTP::Post.new(uri.request_uri, REQUEST_HEADER)
|
97
100
|
a_request.body = json_content.to_json
|
98
101
|
a_response = http.request(a_request)
|
@@ -102,7 +105,7 @@ module ApiDemoV1
|
|
102
105
|
def make_get_request(url_link, json_content)
|
103
106
|
uri = URI.parse(url_link)
|
104
107
|
http = Net::HTTP.new(uri.host, uri.port)
|
105
|
-
http.use_ssl =
|
108
|
+
http.use_ssl = true
|
106
109
|
the_params = json_content
|
107
110
|
uri.query = URI.encode_www_form(the_params)
|
108
111
|
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.4
|
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: 2024-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Its a gem for sabeq.ps API helper functionalities
|
14
14
|
email:
|