centry 0.0.1 → 0.0.2
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/centry.rb +2 -4
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b210e36f909934f33b6780ec38fe9616efb2d2ff34d3a8a2d9766aa5876d537
|
|
4
|
+
data.tar.gz: 2b2393022900cecdc3b0f7fdb9f76e4cb6af43af4e1394366d7b0209696e11f9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 944f98ca6dbae1122cd3925678fcb6b49ccb053cac03c228ba7631b00e39bf1c7ca565563afa08542daa52f2535fdb8a1a06e8400ef8155b3d8907e6a241efcb
|
|
7
|
+
data.tar.gz: 1230759a259883cce5db5fe69810a6b8464338b6595931b120ad7beb0114e8aede9de070d2b0d864926d519e1fd99b33b0d692aa209b5b62ebbc2f5a1545ec24
|
data/lib/centry.rb
CHANGED
|
@@ -67,22 +67,20 @@ class Centry
|
|
|
67
67
|
def request(endpoint, method, params = {}, payload = {})
|
|
68
68
|
query = params ? URI.encode_www_form(params) : ""
|
|
69
69
|
uri = URI("https://www.centry.cl/#{endpoint}?#{query}")
|
|
70
|
-
# uri = URI("https://www.centry.cl/#{endpoint}?#{query}")
|
|
71
70
|
header = {
|
|
72
71
|
"Content-Type" => "application/json",
|
|
73
72
|
"Accept" => "application/json"
|
|
74
73
|
}
|
|
75
|
-
# header["Authorization"] = "Bearer #{@access_token}" #if !PUBLIC_ENDPOINTS.include?(endpoint)
|
|
76
74
|
req = case method
|
|
77
75
|
when :get then Net::HTTP::Get.new(uri, header)
|
|
78
76
|
when :post then Net::HTTP::Post.new(uri, header)
|
|
79
77
|
when :put then Net::HTTP::Put.new(uri, header)
|
|
80
78
|
when :delete then Net::HTTP::Delete.new(uri, header)
|
|
81
79
|
end
|
|
82
|
-
req.add_field("Authorization", "Bearer #{@access_token}")
|
|
80
|
+
req.add_field("Authorization", "Bearer #{@access_token}") if !PUBLIC_ENDPOINTS.include?(endpoint)
|
|
83
81
|
|
|
84
82
|
req.body = JSON.generate(payload) if payload && payload != {}
|
|
85
|
-
return Net::HTTP.start(uri.hostname, uri.port, use_ssl:
|
|
83
|
+
return Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
|
|
86
84
|
http.request(req)
|
|
87
85
|
end
|
|
88
86
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: centry
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Elías Lama L.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-02-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Centry's Ruby SDK
|
|
14
14
|
email: elias.lama@centry.cl
|
|
@@ -40,5 +40,5 @@ rubyforge_project:
|
|
|
40
40
|
rubygems_version: 2.7.8
|
|
41
41
|
signing_key:
|
|
42
42
|
specification_version: 4
|
|
43
|
-
summary: Centry SDK
|
|
43
|
+
summary: Centry SDK
|
|
44
44
|
test_files: []
|