infosimples-data 1.9.9 → 2.0.0
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/Gemfile.lock +14 -14
- data/lib/infosimples/data.rb +0 -1
- data/lib/infosimples/data/client.rb +0 -18
- data/lib/infosimples/data/version.rb +1 -1
- metadata +3 -5
- data/lib/infosimples/data/symmetric_encryption.rb +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c546c0f64bf90e83df7c8afdcf313af1e9157234d95a210290f9d3fd99ddcfc
|
|
4
|
+
data.tar.gz: b11c2bb83b91f455bf8f5082ab66028e2d329e5b6cd2d082691f4884938627ba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 68aa0de7ca989f7ddcf518c4ee4c540fe7e5d0dc14649617ee526b0a11142394674bdc1ae491e829df3bbcd8d45684359ed4d947ba6fc2bd395007253ea29a65
|
|
7
|
+
data.tar.gz: 3abec8904e1f47959cf04e322ec0dcbc0696c673fa81655572bef8e18e5ea6bee8898092cd5e8853235c90f5e2eca6163c2a0fc0f4aa64f8b58d02043f315ac5
|
data/Gemfile.lock
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
infosimples-data (
|
|
4
|
+
infosimples-data (2.0.0)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
diff-lcs (1.
|
|
9
|
+
diff-lcs (1.4.4)
|
|
10
10
|
rake (10.5.0)
|
|
11
|
-
rspec (3.
|
|
12
|
-
rspec-core (~> 3.
|
|
13
|
-
rspec-expectations (~> 3.
|
|
14
|
-
rspec-mocks (~> 3.
|
|
15
|
-
rspec-core (3.
|
|
16
|
-
rspec-support (~> 3.
|
|
17
|
-
rspec-expectations (3.
|
|
11
|
+
rspec (3.9.0)
|
|
12
|
+
rspec-core (~> 3.9.0)
|
|
13
|
+
rspec-expectations (~> 3.9.0)
|
|
14
|
+
rspec-mocks (~> 3.9.0)
|
|
15
|
+
rspec-core (3.9.2)
|
|
16
|
+
rspec-support (~> 3.9.3)
|
|
17
|
+
rspec-expectations (3.9.2)
|
|
18
18
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
19
|
-
rspec-support (~> 3.
|
|
20
|
-
rspec-mocks (3.
|
|
19
|
+
rspec-support (~> 3.9.0)
|
|
20
|
+
rspec-mocks (3.9.1)
|
|
21
21
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
22
|
-
rspec-support (~> 3.
|
|
23
|
-
rspec-support (3.
|
|
22
|
+
rspec-support (~> 3.9.0)
|
|
23
|
+
rspec-support (3.9.3)
|
|
24
24
|
|
|
25
25
|
PLATFORMS
|
|
26
26
|
ruby
|
|
@@ -32,4 +32,4 @@ DEPENDENCIES
|
|
|
32
32
|
rspec (~> 3.0)
|
|
33
33
|
|
|
34
34
|
BUNDLED WITH
|
|
35
|
-
1.
|
|
35
|
+
1.17.3
|
data/lib/infosimples/data.rb
CHANGED
|
@@ -2,9 +2,6 @@ module Infosimples::Data
|
|
|
2
2
|
# Infosimples::Data::Client is a client for the Infosimples Data API.
|
|
3
3
|
class Client
|
|
4
4
|
BASE_URL = 'https://data.infosimples.com/api/v1/:service.json'
|
|
5
|
-
ENCRYPTABLE_ARGS = ['pkcs12_cert', 'pkcs12_pass', 'pass'].map {
|
|
6
|
-
|arg| [arg, true]
|
|
7
|
-
}.to_h
|
|
8
5
|
|
|
9
6
|
attr_accessor :token, :timeout, :max_age
|
|
10
7
|
|
|
@@ -32,11 +29,6 @@ module Infosimples::Data
|
|
|
32
29
|
#
|
|
33
30
|
# @return [Hash] Response according to https://data.infosimples.com/docs.
|
|
34
31
|
def automate(service, args = {})
|
|
35
|
-
args.keys.each do |key|
|
|
36
|
-
if ENCRYPTABLE_ARGS[key.to_s]
|
|
37
|
-
args[key] = encrypt(args[key])
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
32
|
request(service, :multipart, args)
|
|
41
33
|
end
|
|
42
34
|
|
|
@@ -69,16 +61,6 @@ module Infosimples::Data
|
|
|
69
61
|
|
|
70
62
|
private
|
|
71
63
|
|
|
72
|
-
# Apply symmetric encryption to data.
|
|
73
|
-
#
|
|
74
|
-
# @param [String] data The original data that will be encrypted.
|
|
75
|
-
#
|
|
76
|
-
# @return [String] encrypted data.
|
|
77
|
-
def encrypt(data)
|
|
78
|
-
@crypt ||= Infosimples::Data::SymmetricEncryption.new(token)
|
|
79
|
-
@crypt.encrypt(data)
|
|
80
|
-
end
|
|
81
|
-
|
|
82
64
|
# Perform an HTTP request to the Infosimples Data API.
|
|
83
65
|
#
|
|
84
66
|
# @param [String] service API method name.
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: infosimples-data
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Infosimples
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-07-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -76,7 +76,6 @@ files:
|
|
|
76
76
|
- lib/infosimples/data/code.rb
|
|
77
77
|
- lib/infosimples/data/errors.rb
|
|
78
78
|
- lib/infosimples/data/http.rb
|
|
79
|
-
- lib/infosimples/data/symmetric_encryption.rb
|
|
80
79
|
- lib/infosimples/data/version.rb
|
|
81
80
|
homepage: https://github.com/infosimples/infosimples-data
|
|
82
81
|
licenses:
|
|
@@ -97,8 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
97
96
|
- !ruby/object:Gem::Version
|
|
98
97
|
version: '0'
|
|
99
98
|
requirements: []
|
|
100
|
-
|
|
101
|
-
rubygems_version: 2.7.7
|
|
99
|
+
rubygems_version: 3.0.6
|
|
102
100
|
signing_key:
|
|
103
101
|
specification_version: 4
|
|
104
102
|
summary: Ruby API for Infosimples::Data (https://infosimples.com/)
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
module Infosimples::Data
|
|
2
|
-
class SymmetricEncryption
|
|
3
|
-
attr_accessor :key
|
|
4
|
-
def initialize(key)
|
|
5
|
-
fail("INVALID KEY SIZE: #{key}") if key.size < 32
|
|
6
|
-
self.key = key[0, 32]
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def encrypt(data, to_base64=true)
|
|
10
|
-
aes = OpenSSL::Cipher.new('AES-256-CBC')
|
|
11
|
-
aes.encrypt
|
|
12
|
-
aes.key = Digest::SHA256.digest(key)
|
|
13
|
-
encrypted_data = aes.update(data) + aes.final
|
|
14
|
-
to_base64 ? Base64.encode64(encrypted_data) : encrypted_data
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def decrypt(data, from_base64=true)
|
|
18
|
-
data = Base64.decode64(data) if from_base64
|
|
19
|
-
aes = OpenSSL::Cipher.new('AES-256-CBC')
|
|
20
|
-
aes.decrypt
|
|
21
|
-
aes.key = Digest::SHA256.digest(key)
|
|
22
|
-
aes.update(data) + aes.final
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|