api_sabeq_ps_v1 0.1.0 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7191f152ec344c33f442a89fc983153421c00b18612e9419db467e9bf63f6d6
4
- data.tar.gz: 2bdd22fc843e4c188741ac59cbc6ac93e200462c4d73f02d86cbee4811c70301
3
+ metadata.gz: 517ba90edde8e076637800657dee5593a36d19d744c86edf5f6b3ee50b32cf70
4
+ data.tar.gz: '0395a78fecf07e9fa1fe79a803e5fddd053a54116f63c12a41e4e9572914569c'
5
5
  SHA512:
6
- metadata.gz: 3644688a82814c90f678de2e3e99bdbff697b7e358fd54d7cc406a207f04293e569a0bd611a3d946386eff6d661477f0ef1dcd10d7a1f90a6d48c75f5d4c028d
7
- data.tar.gz: 7b2a41e48a29583f4c1f28912a2c07ca55a8a5eb08b06d74e2788cb4301d5b6657ee40ed17847373316bb88bfb0d38a3736151e67fe9ef05c0516e1fe6cd7f48
6
+ metadata.gz: ee6608d2bee695b5d84d2fd63eae3be53c3f41910a9a1e26a1fb0ad2e2e970e09b1266c422a8490a8e6161aa6bcbc87f849f0019c51ffd0bd9fbc9f74afa6776
7
+ data.tar.gz: 60687b41520a659077af9129d2081c62ecceefaa701fd8a3c60993855e8dddbd1b152c7d93dfb002b099472ec3a4f74caadfb8479cee7270d26671a56bc235b6
@@ -4,14 +4,13 @@ require "net/https"
4
4
  module ApiSabeqPsV1
5
5
  module SabeqHelpers
6
6
  REQUEST_HEADER = {'Content-Type' => 'application/json'}
7
- #SABEQ_URL = "https://sabeq.ps"
8
- SABEQ_URL = "https://localhost:3001/"
7
+ SABEQ_URL = "https://sabeq.ps"
9
8
 
10
9
  # Authorize the request
11
10
  # parameters: login_token
12
11
  # return: true, auth_token in case of success
13
12
  # false, errors in case of failure, errors contain code and message
14
- def authorize(login_token)
13
+ def sabeq_api_v1_authorize(login_token)
15
14
  auth_link = SABEQ_URL + "/api/v1/auth"
16
15
  auth_json = { login_token: login_token }
17
16
  json_response = make_post_request(auth_link, auth_json)
@@ -25,7 +24,7 @@ module ApiSabeqPsV1
25
24
  end
26
25
 
27
26
  # Verify the business profile
28
- def verify_profile(auth_token, profile_id, api_key)
27
+ def sabeq_api_v1_verify_profile(auth_token, profile_id, api_key)
29
28
  auth_link = SABEQ_URL + "/api/v1/verify_business"
30
29
  auth_json = { auth_token: auth_token, profile_id: profile_id, api_key: api_key }
31
30
  json_response = make_post_request(auth_link, auth_json)
@@ -38,28 +37,29 @@ module ApiSabeqPsV1
38
37
  end
39
38
  end
40
39
 
41
- def query_parcel(verification_token, parcel_number)
40
+ def sabeq_api_v1_query_parcel(verification_token, parcel_number)
42
41
  auth_link = SABEQ_URL + "/api/v1/parcels/#{parcel_number}"
43
42
  auth_json = { verification_token: verification_token }
44
43
  json_response = make_get_request(auth_link, auth_json)
45
44
  return json_response
46
45
  end
47
46
 
48
- def get_areas(verification_token)
47
+ def sabeq_api_v1_get_areas(verification_token)
49
48
  auth_link = SABEQ_URL + "/api/v1/parcels/get_areas"
50
49
  auth_json = { verification_token: verification_token }
51
50
  json_response = make_get_request(auth_link, auth_json)
52
51
  return json_response
53
52
  end
54
53
 
55
- def create_parcel(verification_token, name, phone1, phone2, content,
56
- payment_amount, area_id, address, delivery_notes)
54
+ def sabeq_api_v1_create_parcel(verification_token, name, phone1, phone2, content,
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
60
  area_id: area_id, address: address,
62
- delivery_notes: delivery_notes }
61
+ delivery_notes: delivery_notes,
62
+ special_notes: special_notes }
63
63
  json_response = make_post_request(auth_link, auth_json)
64
64
 
65
65
  return json_response
@@ -69,8 +69,7 @@ module ApiSabeqPsV1
69
69
  def make_post_request(url_link, json_content)
70
70
  uri = URI.parse(url_link)
71
71
  http = Net::HTTP.new(uri.host, uri.port)
72
- #http.use_ssl = true
73
- http.use_ssl = false
72
+ http.use_ssl = true
74
73
  a_request = Net::HTTP::Post.new(uri.request_uri, REQUEST_HEADER)
75
74
  a_request.body = json_content.to_json
76
75
  a_response = http.request(a_request)
@@ -80,8 +79,7 @@ module ApiSabeqPsV1
80
79
  def make_get_request(url_link, json_content)
81
80
  uri = URI.parse(url_link)
82
81
  http = Net::HTTP.new(uri.host, uri.port)
83
- #http.use_ssl = true
84
- http.use_ssl = false
82
+ http.use_ssl = true
85
83
  the_params = json_content
86
84
  uri.query = URI.encode_www_form(the_params)
87
85
  a_request = Net::HTTP::Get.new(uri.request_uri)
@@ -1,3 +1,3 @@
1
1
  module ApiSabeqPsV1
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.5"
3
3
  end
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.1.0
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ShaimaKaraki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-31 00:00:00.000000000 Z
11
+ date: 2022-01-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Its a gem for sabeq.ps API helper functionalities
14
14
  email: