isaca 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/Gemfile.lock +1 -1
- data/lib/isaca/helpers.rb +0 -4
- data/lib/isaca/models/get_user_details_by_token.rb +18 -0
- data/lib/isaca/requests/authenticate_user.rb +4 -1
- data/lib/isaca/requests/get_user_by_id.rb +4 -1
- data/lib/isaca/requests/get_user_details_by_token.rb +4 -2
- data/lib/isaca/requests/submit_cpe.rb +13 -0
- data/lib/isaca/version.rb +1 -1
- data/lib/isaca.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 673f78f81502f22ce8a21209d12a7962c60949e9
|
4
|
+
data.tar.gz: 696908574a010e26180f4f85530ed99820ccfb5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26288e7fa7ea9811390a27e19d2f2e932cebc1d809b6d04613838d9b6d0a224e17fc97e58f5e49a865b59add6b58d52f36640f3cbefac0c6b961343b4108ecf3
|
7
|
+
data.tar.gz: 206e1394350fd730dacc42e493510d2bf76412e5d94017062f3261ffe05e3086cc3539be655bc75ff88252b713f0800b7437f9cae84c95768848fe32b3c5c1ec
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/lib/isaca/helpers.rb
CHANGED
@@ -8,6 +8,8 @@ module ISACA
|
|
8
8
|
attr_accessor :email
|
9
9
|
attr_accessor :username
|
10
10
|
attr_accessor :country
|
11
|
+
attr_accessor :privacy
|
12
|
+
attr_accessor :marketing
|
11
13
|
|
12
14
|
def initialize(hash)
|
13
15
|
@imis_id = hash['ID']
|
@@ -17,6 +19,22 @@ module ISACA
|
|
17
19
|
@email = hash['Email']
|
18
20
|
@username = hash['UserName']
|
19
21
|
@country = hash['Country']
|
22
|
+
|
23
|
+
if hash['PRIVACY'] == '1'
|
24
|
+
@privacy = true
|
25
|
+
elsif hash['PRIVACY'] == '0'
|
26
|
+
@privacy = false
|
27
|
+
else
|
28
|
+
@privacy = nil
|
29
|
+
end
|
30
|
+
|
31
|
+
if hash['MARKETING'] == '1'
|
32
|
+
@marketing = true
|
33
|
+
elsif hash['MARKETING'] == '0'
|
34
|
+
@marketing = false
|
35
|
+
else
|
36
|
+
@marketing = nil
|
37
|
+
end
|
20
38
|
end
|
21
39
|
end
|
22
40
|
end
|
@@ -8,7 +8,10 @@ module ISACA
|
|
8
8
|
request.params['password'] = password
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
data = JSON.parse(response.body)
|
12
|
+
ISACA.logger.debug(data) if ISACA.configuration.debug
|
13
|
+
|
14
|
+
response.status == 200 ? ISACA::Model::AuthenticateUser.new(data) : nil
|
12
15
|
end
|
13
16
|
end
|
14
17
|
end
|
@@ -7,7 +7,10 @@ module ISACA
|
|
7
7
|
request.params['ID'] = id
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
data = JSON.parse(response.body)
|
11
|
+
ISACA.logger.debug(data) if ISACA.configuration.debug
|
12
|
+
|
13
|
+
response.status == 200 ? ISACA::Model::GetUserByID.new(data) : nil
|
11
14
|
end
|
12
15
|
end
|
13
16
|
end
|
@@ -7,8 +7,10 @@ module ISACA
|
|
7
7
|
request.params['token'] = token
|
8
8
|
end
|
9
9
|
|
10
|
-
data = JSON.parse(response.body, quirks_mode: true)
|
11
|
-
|
10
|
+
data = JSON.parse(JSON.parse(response.body, quirks_mode: true))
|
11
|
+
ISACA.logger.debug(data) if ISACA.configuration.debug
|
12
|
+
|
13
|
+
response.status == 200 ? ISACA::Model::GetUserDetailsByToken.new(data) : nil
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -1,6 +1,19 @@
|
|
1
1
|
module ISACA
|
2
2
|
module Request
|
3
3
|
module SubmitCPE
|
4
|
+
def self.get(imis_id, result, cpe)
|
5
|
+
response = ISACA::Request.get do |request|
|
6
|
+
request.path = request.path + '/SubmitCPE'
|
7
|
+
request.params['id'] = imis_id
|
8
|
+
request.params['result'] = result
|
9
|
+
request.params['cpe'] = cpe
|
10
|
+
end
|
11
|
+
|
12
|
+
data = JSON.parse(response.body)
|
13
|
+
ISACA.logger.debug(data) if ISACA.configuration.debug
|
14
|
+
|
15
|
+
response.status == 200 ? ISACA::Model::SubmitCPE.new(data) : nil
|
16
|
+
end
|
4
17
|
end
|
5
18
|
end
|
6
19
|
end
|
data/lib/isaca/version.rb
CHANGED
data/lib/isaca.rb
CHANGED
@@ -13,15 +13,26 @@ require 'isaca/models/get_user_details_by_token'
|
|
13
13
|
require 'isaca/models/submit_cpe'
|
14
14
|
|
15
15
|
require 'isaca/version'
|
16
|
+
require 'fileutils'
|
16
17
|
require 'openssl'
|
18
|
+
require 'logger'
|
17
19
|
|
18
20
|
module ISACA
|
19
21
|
class << self
|
20
22
|
attr_accessor :configuration
|
23
|
+
attr_accessor :logger
|
21
24
|
|
22
25
|
def configuration
|
23
26
|
@configuration ||= Configuration.new
|
24
27
|
end
|
28
|
+
|
29
|
+
def logger
|
30
|
+
path = 'log/isaca.log'
|
31
|
+
dir = File.dirname(path)
|
32
|
+
FileUtils.mkdir_p(dir) unless File.directory?(dir)
|
33
|
+
|
34
|
+
@logger ||= Logger.new(path)
|
35
|
+
end
|
25
36
|
end
|
26
37
|
|
27
38
|
def self.configure
|
@@ -35,9 +46,12 @@ module ISACA
|
|
35
46
|
attr_accessor :secret_pass
|
36
47
|
attr_accessor :user_agent
|
37
48
|
attr_accessor :verify_ssl
|
49
|
+
attr_writer :logger
|
50
|
+
attr_accessor :debug
|
38
51
|
|
39
52
|
def initialize
|
40
53
|
@verify_ssl = true
|
54
|
+
@debug = false
|
41
55
|
end
|
42
56
|
|
43
57
|
def secret_pass
|
@@ -72,6 +86,10 @@ module ISACA
|
|
72
86
|
|
73
87
|
raise ConfigurationError.new(msg)
|
74
88
|
end
|
89
|
+
|
90
|
+
def logger=(logger)
|
91
|
+
ISACA.logger = logger
|
92
|
+
end
|
75
93
|
end
|
76
94
|
|
77
95
|
class ConfigurationError < StandardError; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isaca
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Orahood
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|