demo_api 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/demo_api.rb +18 -3
- data/lib/demo_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8d020c180eee5b2934657cace1ac5915589ec0f49b8d651555b5d4b25d5716b
|
4
|
+
data.tar.gz: 6cbef2ebc1ca75003f692cd74652bbd7214375d6ec700aa83106d22d2be1219e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b34ad7e69d6665d126057276db88467d1bf302db865efe62cc4156b7ab97eff9e7b82999821683141241ea63ac148b613427817a33c5138288a901170f609ca5
|
7
|
+
data.tar.gz: f3e418969dab3991b1a23e6be13388e64974952d63f8d87431728225a4d3a3fb2bb031c091b49992952060ec3020e231ea9f343665aa563f475ad229f93072bc
|
data/lib/demo_api.rb
CHANGED
@@ -31,7 +31,6 @@ module DemoApi
|
|
31
31
|
|
32
32
|
# Verify the business profile
|
33
33
|
def verify_profile(auth_token, profile_id, api_key)
|
34
|
-
puts '33333333333333'
|
35
34
|
auth_link = SABEQ_URL + "/api/v1/verify_business"
|
36
35
|
auth_json = { auth_token: auth_token, profile_id: profile_id, api_key: api_key }
|
37
36
|
json_response = make_post_request(auth_link, auth_json)
|
@@ -44,6 +43,13 @@ module DemoApi
|
|
44
43
|
end
|
45
44
|
end
|
46
45
|
|
46
|
+
def query_parcel(verification_token, parcel_number)
|
47
|
+
auth_link = SABEQ_URL + "/api/v1/parcels/#{parcel_number}"
|
48
|
+
auth_json = { verification_token: verification_token }
|
49
|
+
json_response = make_get_request(auth_link, auth_json)
|
50
|
+
return json_response
|
51
|
+
end
|
52
|
+
|
47
53
|
private
|
48
54
|
def make_post_request(url_link, json_content)
|
49
55
|
uri = URI.parse(url_link)
|
@@ -52,8 +58,17 @@ module DemoApi
|
|
52
58
|
a_request = Net::HTTP::Post.new(uri.request_uri, REQUEST_HEADER)
|
53
59
|
a_request.body = json_content.to_json
|
54
60
|
a_response = http.request(a_request)
|
55
|
-
|
56
|
-
|
61
|
+
return a_response.body
|
62
|
+
end
|
63
|
+
|
64
|
+
def make_get_request(url_link, json_content)
|
65
|
+
uri = URI.parse(url_link)
|
66
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
67
|
+
http.use_ssl = false
|
68
|
+
the_params = json_content
|
69
|
+
uri.query = URI.encode_www_form(the_params)
|
70
|
+
a_request = Net::HTTP::Get.new(uri.request_uri)
|
71
|
+
a_response = http.request(a_request)
|
57
72
|
return a_response.body
|
58
73
|
end
|
59
74
|
|
data/lib/demo_api/version.rb
CHANGED