pingpp 2.0.11 → 2.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pingpp/version.rb +1 -1
- data/lib/pingpp.rb +11 -9
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26b7444660ab3e97df833ae4fc0766ed14324d5d
|
4
|
+
data.tar.gz: b3b63f1b2ee7da4fa8b9a7d651f7b7dcfdbd814f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06a3cd154b77c56de7bdd802458b2de575b3709f73f2d798b61ca6fdc5aaf1498b05ee7dfc13c13ea56b3af4aca460c2663f575c206e3fea86c3fb3da60d583d
|
7
|
+
data.tar.gz: 48e2fab5eddb99e0e29560cd2d664cb3dae836e4b79fa45e6c6fa84eb4edc46110ac4d0ab34317771f4592e2b4173bab334c791991defc40e50a21fc3f47780a
|
data/lib/pingpp/version.rb
CHANGED
data/lib/pingpp.rb
CHANGED
@@ -51,7 +51,7 @@ module Pingpp
|
|
51
51
|
HEADERS_TO_PARSE = [:pingpp_one_version, :pingpp_sdk_version]
|
52
52
|
|
53
53
|
class << self
|
54
|
-
attr_accessor :api_key, :api_base, :verify_ssl_certs, :api_version, :parsed_headers, :
|
54
|
+
attr_accessor :api_key, :api_base, :verify_ssl_certs, :api_version, :parsed_headers, :private_key
|
55
55
|
end
|
56
56
|
|
57
57
|
def self.api_url(url='')
|
@@ -80,15 +80,13 @@ module Pingpp
|
|
80
80
|
raise AuthenticationError.new('No API key provided. ' +
|
81
81
|
'Set your API key using "Pingpp.api_key = <API-KEY>". ' +
|
82
82
|
'You can generate API keys from the Pingpp web interface. ' +
|
83
|
-
'See https://pingxx.com/document/api for details
|
84
|
-
'if you have any questions.')
|
83
|
+
'See https://pingxx.com/document/api for details.')
|
85
84
|
end
|
86
85
|
|
87
86
|
if api_key =~ /\s/
|
88
87
|
raise AuthenticationError.new('Your API key is invalid, as it contains ' +
|
89
88
|
'whitespace. (HINT: You can double-check your API key from the ' +
|
90
|
-
'Pingpp web interface. See https://pingxx.com/document/api for details
|
91
|
-
'email support@pingxx.com if you have any questions.)')
|
89
|
+
'Pingpp web interface. See https://pingxx.com/document/api for details.)')
|
92
90
|
end
|
93
91
|
|
94
92
|
if verify_ssl_certs
|
@@ -192,8 +190,8 @@ module Pingpp
|
|
192
190
|
:error => "#{e} (#{e.class})")
|
193
191
|
end
|
194
192
|
|
195
|
-
if is_post &&
|
196
|
-
signature = sign_request(data,
|
193
|
+
if is_post && private_key && data
|
194
|
+
signature = sign_request(data, private_key)
|
197
195
|
headers.update(:pingplusplus_signature => signature)
|
198
196
|
end
|
199
197
|
|
@@ -216,8 +214,12 @@ module Pingpp
|
|
216
214
|
Util.symbolize_names(response)
|
217
215
|
end
|
218
216
|
|
219
|
-
def self.
|
220
|
-
|
217
|
+
def self.private_key_path=(private_key_path)
|
218
|
+
@private_key = File.read(private_key_path)
|
219
|
+
end
|
220
|
+
|
221
|
+
def self.sign_request(data, pri_key)
|
222
|
+
pkey = OpenSSL::PKey.read(pri_key)
|
221
223
|
return Base64.strict_encode64(pkey.sign(OpenSSL::Digest::SHA256.new, data))
|
222
224
|
end
|
223
225
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pingpp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xufeng Weng
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -178,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
178
|
version: '0'
|
179
179
|
requirements: []
|
180
180
|
rubyforge_project:
|
181
|
-
rubygems_version: 2.
|
181
|
+
rubygems_version: 2.6.3
|
182
182
|
signing_key:
|
183
183
|
specification_version: 4
|
184
184
|
summary: Ruby bindings for the PingPlusPlus API
|