pingpp 2.0.11 → 2.0.12

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pingpp/version.rb +1 -1
  3. data/lib/pingpp.rb +11 -9
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e61c88e48c6fb52cdc2874e450b6b22dc8b135bb
4
- data.tar.gz: 680847ac21a5684a74de052e77d5fe1a50a9f485
3
+ metadata.gz: 26b7444660ab3e97df833ae4fc0766ed14324d5d
4
+ data.tar.gz: b3b63f1b2ee7da4fa8b9a7d651f7b7dcfdbd814f
5
5
  SHA512:
6
- metadata.gz: fdf853c7857f564e15fb9e556c6c6384b16a3c5df6d8f3d13d53a5c6fbfd3f207ca607b134b0ca7c1c5f838d295e820877e2aca760edd4de48e9075785df1857
7
- data.tar.gz: 38138170c4d141b3a6b8525f092168a0ee1d1ccb7f9a6681fc2151277a15d412ab8f1d015a16aad59821f5c91c6a6cbb813b118d37f659279dcfb32a512fa474
6
+ metadata.gz: 06a3cd154b77c56de7bdd802458b2de575b3709f73f2d798b61ca6fdc5aaf1498b05ee7dfc13c13ea56b3af4aca460c2663f575c206e3fea86c3fb3da60d583d
7
+ data.tar.gz: 48e2fab5eddb99e0e29560cd2d664cb3dae836e4b79fa45e6c6fa84eb4edc46110ac4d0ab34317771f4592e2b4173bab334c791991defc40e50a21fc3f47780a
@@ -1,3 +1,3 @@
1
1
  module Pingpp
2
- VERSION = '2.0.11'
2
+ VERSION = '2.0.12'
3
3
  end
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, :private_key_path
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, or email support@pingxx.com ' +
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, or ' +
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 && private_key_path && data
196
- signature = sign_request(data, private_key_path)
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.sign_request(data, key_path)
220
- pkey = OpenSSL::PKey.read(File.read(key_path))
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.11
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-03-30 00:00:00.000000000 Z
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.4.5
181
+ rubygems_version: 2.6.3
182
182
  signing_key:
183
183
  specification_version: 4
184
184
  summary: Ruby bindings for the PingPlusPlus API