isaca 0.1.9 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c78998eaaf6b8a3f0c8d9ce8ea89d3d4ba7cd24c
4
- data.tar.gz: e45283d4a5cd1b1f26d962c02db0aacceca0c4ec
3
+ metadata.gz: 62f3b9deda4ee74b614e8cd5d91110bb4eb0da73
4
+ data.tar.gz: a400dfad4b30039ac630c7318dce4b49aae298ac
5
5
  SHA512:
6
- metadata.gz: b029846acaad220c0ac2a16ed89b36f24567c79fb00ecf9f836f1f5fd59fa83a0de5dc4d8063fa7bc6f63ec960f7e8d16386440a21da9cb8f47b849537146fd8
7
- data.tar.gz: ac19c188494e14ec2be5de57df1ddd5b1092d9a9df13240edc1ea40b50d3b0a2e7a73369541d01a2d3b0a32ee5ec1e59364f186673aacead9de7c4d0f5698f41
6
+ metadata.gz: f70a43588de692625dd4ffcb898eb52dcc3a3c9d45057903b44ff2467e1e1414e97428b2773403913688e795f8ce1c9cba038f640f77faa84d8c5f275d5e49eb
7
+ data.tar.gz: 97e79e074276c450560219b636168878e063befbec908052f265327572586967b196d471abe33400889ea98328e9312be67bbc3e42ce31cce7b11d26bf9a5ace
data/Gemfile.lock CHANGED
@@ -1,25 +1,71 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- isaca (0.1.8)
4
+ isaca (0.2.0)
5
5
  faraday (~> 0.14.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
+ ansi (1.5.0)
11
+ builder (3.2.3)
12
+ coderay (1.1.2)
10
13
  faraday (0.14.0)
11
14
  multipart-post (>= 1.2, < 3)
15
+ ffi (1.9.25)
16
+ formatador (0.2.5)
17
+ guard (2.14.2)
18
+ formatador (>= 0.2.4)
19
+ listen (>= 2.7, < 4.0)
20
+ lumberjack (>= 1.0.12, < 2.0)
21
+ nenv (~> 0.1)
22
+ notiffany (~> 0.0)
23
+ pry (>= 0.9.12)
24
+ shellany (~> 0.0)
25
+ thor (>= 0.18.1)
26
+ guard-compat (1.2.1)
27
+ guard-minitest (2.4.6)
28
+ guard-compat (~> 1.2)
29
+ minitest (>= 3.0)
30
+ listen (3.1.5)
31
+ rb-fsevent (~> 0.9, >= 0.9.4)
32
+ rb-inotify (~> 0.9, >= 0.9.7)
33
+ ruby_dep (~> 1.2)
34
+ lumberjack (1.0.13)
35
+ method_source (0.9.0)
12
36
  minitest (5.10.3)
37
+ minitest-reporters (1.3.0)
38
+ ansi
39
+ builder
40
+ minitest (>= 5.0)
41
+ ruby-progressbar
13
42
  multipart-post (2.0.0)
43
+ nenv (0.3.0)
44
+ notiffany (0.1.1)
45
+ nenv (~> 0.1)
46
+ shellany (~> 0.0)
47
+ pry (0.11.3)
48
+ coderay (~> 1.1.0)
49
+ method_source (~> 0.9.0)
14
50
  rake (10.4.2)
51
+ rb-fsevent (0.10.3)
52
+ rb-inotify (0.9.10)
53
+ ffi (>= 0.5.0, < 2)
54
+ ruby-progressbar (1.9.0)
55
+ ruby_dep (1.5.0)
56
+ shellany (0.0.1)
57
+ thor (0.20.0)
15
58
 
16
59
  PLATFORMS
17
60
  ruby
18
61
 
19
62
  DEPENDENCIES
20
63
  bundler (~> 1.16)
64
+ guard (~> 2.14)
65
+ guard-minitest (~> 2.4)
21
66
  isaca!
22
67
  minitest (~> 5.0)
68
+ minitest-reporters (~> 1.3)
23
69
  rake (~> 10.0)
24
70
 
25
71
  BUNDLED WITH
data/Guardfile ADDED
@@ -0,0 +1,42 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ guard :minitest do
19
+ # with Minitest::Unit
20
+ watch(%r{^test/(.*)\/?(.*)\_test.rb$})
21
+ watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}#{m[2]}_test.rb"; }
22
+ watch(%r{^test/test_helper\.rb$}) { 'test' }
23
+
24
+ # with Minitest::Spec
25
+ # watch(%r{^spec/(.*)_spec\.rb$})
26
+ # watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
27
+ # watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
28
+
29
+ # Rails 4
30
+ # watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
31
+ # watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' }
32
+ # watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
33
+ # watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
34
+ # watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
35
+ # watch(%r{^test/.+_test\.rb$})
36
+ # watch(%r{^test/test_helper\.rb$}) { 'test' }
37
+
38
+ # Rails < 4
39
+ # watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
40
+ # watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" }
41
+ # watch(%r{^app/models/(.*)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
42
+ end
data/Rakefile CHANGED
@@ -5,6 +5,7 @@ Rake::TestTask.new(:test) do |t|
5
5
  t.libs << "test"
6
6
  t.libs << "lib"
7
7
  t.test_files = FileList["test/**/*_test.rb"]
8
+ t.warning = false
8
9
  end
9
10
 
10
11
  task :default => :test
data/isaca.gemspec CHANGED
@@ -24,4 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "bundler", "~> 1.16"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "minitest", "~> 5.0"
27
+ spec.add_development_dependency 'minitest-reporters', '~> 1.3'
28
+ spec.add_development_dependency 'guard', '~> 2.14'
29
+ spec.add_development_dependency 'guard-minitest', '~> 2.4'
27
30
  end
@@ -0,0 +1,7 @@
1
+ module ISACA
2
+ class AttributeError < ServiceError
3
+ def initialize(attribute, klass, hash)
4
+ super("Missing required attribute #{attribute.to_s} for #{klass}. Hash keys: #{hash.keys}")
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ module ISACA
2
+ class ConnectionError < ServiceError
3
+ end
4
+ end
@@ -1,18 +1,37 @@
1
1
  module ISACA
2
2
  module Model
3
+ # Class that is used as an object representation of the response from {ISACA::Request::AuthenticateUser}
3
4
  class AuthenticateUser
4
- attr_accessor :error
5
- attr_accessor :error_code
6
- attr_accessor :is_valid
7
- attr_accessor :value
5
+ # The ISACA error -- ISACA documentation on this is currently limited.
6
+ attr_reader :error
7
+ # The ISACA error code -- ISACA documentation on this is currently limited.
8
+ attr_reader :error_code
9
+ # Whether or not the session is valid
10
+ attr_reader :is_valid
11
+ # Session value or error message
12
+ attr_reader :value
8
13
 
9
- def initialize(hash)
10
- @error = hash['Error']
11
- @error_code = hash['ErrorCode']
12
- @is_valid = hash['IsValid']
13
- @value = hash['Value']
14
+
15
+ # @param [Hash] params Parameters to create the object with
16
+ # @option params [String] :Error Required
17
+ # @option params [String] :ErrorCode Required
18
+ # @option params [String] :IsValid Required
19
+ # @option params [String] :Value Required
20
+ def initialize(params)
21
+ raise AttributeError.new(:Error, self.class.name, params) unless params.has_key?(:Error)
22
+ raise AttributeError.new(:ErrorCode, self.class.name, params) unless params.has_key?(:ErrorCode)
23
+ raise AttributeError.new(:IsValid, self.class.name, params) unless params.has_key?(:IsValid)
24
+ raise AttributeError.new(:Value, self.class.name, params) unless params.has_key?(:Value)
25
+
26
+ @error = params[:Error]
27
+ @error_code = params[:ErrorCode]
28
+ @is_valid = params[:IsValid]
29
+ @value = params[:Value]
14
30
  end
15
31
 
32
+ # Helper method for checking the validity of a session
33
+ #
34
+ # @return [Boolean]
16
35
  def is_valid?
17
36
  is_valid
18
37
  end
@@ -1,11 +1,25 @@
1
1
  module ISACA
2
2
  module Model
3
3
  class Countries
4
- include ISACA::Model::Geographical
4
+ attr_reader :countries
5
5
 
6
6
  def initialize(countries)
7
- @countries = countries
7
+ @countries = countries.map { |c| Country.new(c[:CODE], c[:DESCRIPTION]) }
8
+ end
9
+
10
+ def includes_country?(value)
11
+ @countries.each { |country| return true if country_matches?(country, value) }
12
+ false
13
+ end
14
+
15
+ private
16
+
17
+ def country_matches?(country, value)
18
+ value.downcase!
19
+ country.code.downcase == value || country.description.downcase == value
8
20
  end
9
21
  end
22
+
23
+ Country = Struct.new(:code, :description)
10
24
  end
11
25
  end
@@ -1,36 +1,39 @@
1
+ # An object representation of the GetUserDetailsByToken endpoint
1
2
  module ISACA
2
3
  module Model
3
4
  class GetUserDetailsByToken
4
- attr_accessor :imis_id
5
- attr_accessor :enterprise_id
6
- attr_accessor :first_name
7
- attr_accessor :last_name
8
- attr_accessor :email
9
- attr_accessor :username
10
- attr_accessor :country
11
- attr_accessor :privacy
12
- attr_accessor :marketing
5
+ attr_reader :imis_id
6
+ attr_reader :enterprise_id
7
+ attr_reader :first_name
8
+ attr_reader :last_name
9
+ attr_reader :email
10
+ attr_reader :username
11
+ attr_reader :country
12
+ attr_reader :privacy
13
+ attr_reader :marketing
13
14
 
14
15
  def initialize(hash)
15
- @imis_id = hash['ID']
16
- @enterprise_id = hash['Ent_ID']
17
- @first_name = hash['First_Name']
18
- @last_name = hash['Last_Name']
19
- @email = hash['Email']
20
- @username = hash['UserName']
21
- @country = hash['Country']
16
+ raise AttributeError.new(:ID, self.class.name, hash) unless hash.has_key?(:ID) && hash[:ID]
22
17
 
23
- if hash['PRIVACY'] == '1'
18
+ @imis_id = hash[:ID]
19
+ @enterprise_id = hash[:Ent_ID]
20
+ @first_name = hash[:First_Name]
21
+ @last_name = hash[:Last_Name]
22
+ @email = hash[:Email]
23
+ @username = hash[:UserName]
24
+ @country = hash[:Country]
25
+
26
+ if hash[:PRIVACY] == '1'
24
27
  @privacy = true
25
- elsif hash['PRIVACY'] == '0'
28
+ elsif hash[:PRIVACY] == '0'
26
29
  @privacy = false
27
30
  else
28
31
  @privacy = nil
29
32
  end
30
33
 
31
- if hash['MARKETING'] == '1'
34
+ if hash[:MARKETING] == '1'
32
35
  @marketing = true
33
- elsif hash['MARKETING'] == '0'
36
+ elsif hash[:MARKETING] == '0'
34
37
  @marketing = false
35
38
  else
36
39
  @marketing = nil
@@ -0,0 +1,4 @@
1
+ module ISACA
2
+ class PartnerKeyError < ServiceError
3
+ end
4
+ end
@@ -1,17 +1,31 @@
1
1
  module ISACA
2
2
  module Request
3
- module AuthenticateUser
3
+ class AuthenticateUser
4
+ # Method used to generate a session token.
5
+ #
6
+ # @raise [ISACA::SessionError] Raised if the returned session is invalid
7
+ #
8
+ # @return [ISACA::Model::AuthenticateUser] Returns an object representation of the response
4
9
  def self.get(username, password)
5
- response = ISACA::Request.get do |request|
10
+ response = self.send_request(username, password)
11
+
12
+ model = ISACA::Model::AuthenticateUser.new(JSON.parse(response.body, {symbolize_names: true}))
13
+ raise SessionError.new(model.value) unless model.is_valid?
14
+
15
+ model
16
+ end
17
+
18
+ private
19
+ # Method used to send the request -- exists for easy stubbing during tests
20
+ #
21
+ # @param username [String]
22
+ # @param password [String]
23
+ def self.send_request(username, password)
24
+ ISACA::Request.get do |request|
6
25
  request.path = request.path + '/AuthenticateUser'
7
26
  request.params['username'] = username
8
27
  request.params['password'] = password
9
28
  end
10
-
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
15
29
  end
16
30
  end
17
31
  end
@@ -1,16 +1,20 @@
1
1
  module ISACA
2
2
  module Request
3
3
  module Countries
4
+ # Method used to fetch all countries
4
5
  def self.get
5
- response = ISACA::Request.get do |request|
6
+ response = self.send_request
7
+ ISACA::Model::Countries.new(JSON.parse(response.body, symbolize_names: true))
8
+ end
9
+
10
+ private
11
+
12
+ # Method used to send the request -- exists for easy testing purposes
13
+ def self.send_request
14
+ ISACA::Request.get do |request|
6
15
  uri = URI(ISACA.configuration.url)
7
16
  request.path = "#{uri.scheme}://#{uri.hostname}:#{uri.port}/isacaservices/countries.json"
8
17
  end
9
-
10
- data = JSON.parse(response.body)
11
- ISACA.logger.debug(data) if ISACA.configuration.debug
12
-
13
- response.status == 200 ? ISACA::Model::Countries.new(data) : nil
14
18
  end
15
19
  end
16
20
  end
@@ -1,16 +1,20 @@
1
1
  module ISACA
2
2
  module Request
3
3
  module ExplicitCountries
4
+ # Method used to fetch all of the ExplicitCountries
4
5
  def self.get
5
- response = ISACA::Request.get do |request|
6
+ response = self.send_request
7
+ ISACA::Model::Countries.new(JSON.parse(response.body, symbolize_names: true))
8
+ end
9
+
10
+ private
11
+
12
+ # Method used to send the request -- exists for easy testing purposes
13
+ def self.send_request
14
+ ISACA::Request.get do |request|
6
15
  uri = URI(ISACA.configuration.url)
7
16
  request.path = "#{uri.scheme}://#{uri.hostname}:#{uri.port}/isacaservices/explicitcountries.json"
8
17
  end
9
-
10
- data = JSON.parse(response.body)
11
- ISACA.logger.debug(data) if ISACA.configuration.debug
12
-
13
- response.status == 200 ? ISACA::Model::ExplicitCountries.new(data) : nil
14
18
  end
15
19
  end
16
20
  end
@@ -1,16 +1,27 @@
1
1
  module ISACA
2
2
  module Request
3
- module GetUserDetailsByToken
3
+ class GetUserDetailsByToken
4
+ # Method used to get user information by token
5
+ #
6
+ # @raise [ISACA::AttributeError] Raised if the returned IMIS ID is nil or the ID key is missing
7
+ #
8
+ # @return [ISACA::Model::GetUserDetailsByToken] Returns an object representation of the response
4
9
  def self.get(token)
5
- response = ISACA::Request.get do |request|
10
+ response = self.send_request(token)
11
+
12
+ data = JSON.parse(JSON.parse(response.body, quirks_mode: true), {symbolize_names: true})
13
+ ISACA::Model::GetUserDetailsByToken.new(data)
14
+ end
15
+
16
+ private
17
+ # Method used to send the request -- exists for easy stubbing during tests
18
+ #
19
+ # @param token [String]
20
+ def self.send_request(token)
21
+ ISACA::Request.get do |request|
6
22
  request.path = request.path + '/GetUserDetailsByToken'
7
23
  request.params['token'] = token
8
24
  end
9
-
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
14
25
  end
15
26
  end
16
27
  end
@@ -1,13 +1,29 @@
1
1
  module ISACA
2
2
  module Request
3
3
  module LogOut
4
+ # Method used to destroy a user session
5
+ #
6
+ # @param token [String] Session token to be destroyed
7
+ #
8
+ # @raise [ISACA::ServiceError] An error is raised if this ever fails. See [ISACA::Request]
9
+ #
10
+ # @return [Faraday::Response] Returns a response object
4
11
  def self.get(token)
5
- response = ISACA::Request.get do |request|
12
+ send_request(token)
13
+ end
14
+
15
+ private
16
+
17
+ # Method used to send request -- exists to ease testing
18
+ #
19
+ # @param token [String] Session token to be destroyed
20
+ #
21
+ # @return [Faraday::Response] Returns a response object
22
+ def self.send_request(token)
23
+ ISACA::Request.get do |request|
6
24
  request.path = request.path + '/LogOut'
7
25
  request.params['token'] = token
8
26
  end
9
-
10
- response.status == 200
11
27
  end
12
28
  end
13
29
  end
@@ -1,20 +1,38 @@
1
1
  module ISACA
2
2
  module Request
3
3
  module ReportConsent
4
+ # Method used to report marketing consent and acceptance of the privacy policy. ISACA assumes that when you
5
+ # send this request that the user has accepted the privacy statement. Plan your user interface with this in mind
6
+ # and only submit this request when you have validated the acceptance of the privacy policy.
7
+ #
8
+ # @param imis_id [String] The ISACA ID of the user reporting consent
9
+ # @param options [Hash] Optional. If not provided, marketing consent will default to NO [0].
10
+ #
11
+ # == Options
12
+ # [marketing] Consent for marketing. Acceptable values are 0 [for NO] and 1 [for YES].
13
+ #
14
+ # @return [Faraday::Response] Returns a response object
4
15
  def self.get(imis_id, options={})
5
- opts = {
6
- marketing: 0
7
- }.merge(options)
16
+ self.send_request(imis_id, {marketing: 0}.merge(options))
17
+ end
18
+
19
+ private
8
20
 
9
- response = ISACA::Request.get do |request|
21
+ # Method used to send request -- exists to ease testing
22
+ #
23
+ # @param imis_id [String] The ISACA ID of the user reporting consent
24
+ # @param options [Hash] Optional. If not provided, marketing consent will default to NO [0].
25
+ #
26
+ # == Options
27
+ # [marketing] Consent for marketing. Acceptable values are 0 [for NO] and 1 [for YES].
28
+ #
29
+ # @return [Faraday::Response] Returns a response object
30
+ def self.send_request(imis_id, options={})
31
+ ISACA::Request.get do |request|
10
32
  request.path = request.path + '/ReportConsent'
11
- request.params['MarketingConsent'] = opts[:marketing]
33
+ request.params['MarketingConsent'] = options[:marketing]
12
34
  request.params['iMISID'] = imis_id
13
35
  end
14
-
15
- ISACA.logger.debug(response) if ISACA.configuration.debug
16
-
17
- response.status == 200
18
36
  end
19
37
  end
20
38
  end
@@ -2,28 +2,51 @@ require 'faraday'
2
2
 
3
3
  module ISACA
4
4
  module Request
5
- def self.get
5
+ # Generic GET request used to build REST calls
6
+ #
7
+ # @raise [ISACA::ServiceError] Raised because server returned a 400 response code. Bad request.
8
+ # @raise [ISACA::PartnerKey] The partner has provided an invalid API Key.
9
+ # @raise [ISACA::ServiceError] Raised because the server returned a 500 response code. Server error.
10
+ #
11
+ # @return [Faraday::Response] Returns a Faraday Response object
12
+ def self.get # :yields: [Faraday::Request] Yields a request object.
6
13
  conn = Faraday.new(url: ISACA.configuration.url)
7
14
  conn.ssl.verify_mode = OpenSSL::SSL::VERIFY_NONE unless ISACA.configuration.verify_ssl
8
15
 
9
- conn.get do |request|
16
+ response = conn.get do |request|
10
17
  set_default_request_options(request)
11
- yield(request)
18
+ yield(request) if block_given?
12
19
  end
20
+
21
+ ISACA.logger.debug("\n" + response.inspect + "\n") if ISACA.configuration.debug
22
+ response.success? ? response : raise_response_error(response)
13
23
  end
14
24
 
15
- def self.post
16
- conn = Faraday.new(url: ISACA.configuration.url)
17
- conn.ssl.verify_mode = OpenSSL::SSL::VERIFY_NONE unless ISACA.configuration.verify_ssl
25
+ private
18
26
 
19
- conn.post do |request|
20
- set_default_request_options(request)
21
- yield(request)
27
+ # Testing Request#get is difficult so this method was created for easier testing and stubbing
28
+ #
29
+ # @raise [ISACA::ServiceError] Raises a type of service error depending on status code
30
+ #
31
+ # @param response [Faraday::Response] Accepts a response object
32
+ def self.raise_response_error(response)
33
+ case response.status
34
+ when 400
35
+ raise ServiceError.new('A bad request was sent to the ISACA server.')
36
+ when 403
37
+ raise PartnerKeyError.new('Access denied as the provided partner key is not valid.')
38
+ when 404
39
+ raise ServiceError.new('Endpoint not found.')
40
+ when 500
41
+ raise ServiceError.new('An error occurred on the ISACA server.')
42
+ else
43
+ raise ServiceError.new("Response returned an unhandled status code: #{response.status}")
22
44
  end
23
45
  end
24
46
 
25
- private
26
-
47
+ # Helper method used to set common request headers used throughout the API
48
+ #
49
+ # @param request [Faraday::Request] The request to which the headers are applied
27
50
  def self.set_default_request_options(request)
28
51
  uri = URI(ISACA.configuration.url)
29
52
  request.path = uri.path
@@ -32,6 +55,4 @@ module ISACA
32
55
  request.params['secPass'] = ISACA.configuration.secret_pass
33
56
  end
34
57
  end
35
- end
36
-
37
- Faraday::Response
58
+ end
@@ -0,0 +1,4 @@
1
+ module ISACA
2
+ class ServiceError < StandardError
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ISACA
2
+ class SessionError < ServiceError
3
+ end
4
+ end
data/lib/isaca/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ISACA
2
- VERSION = "0.1.9"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/isaca.rb CHANGED
@@ -8,19 +8,20 @@ require 'isaca/requests/explicit_countries'
8
8
  require 'isaca/requests/get_user_by_id'
9
9
  require 'isaca/requests/get_user_details_by_token'
10
10
  require 'isaca/requests/report_consent'
11
- require 'isaca/requests/submit_cpe'
12
11
  require 'isaca/requests/log_out'
13
12
 
14
- # Concerns
15
- require 'isaca/models/geographical'
16
-
17
13
  # Models
18
14
  require 'isaca/models/authenticate_user'
19
15
  require 'isaca/models/countries'
20
- require 'isaca/models/explicit_countries'
21
16
  require 'isaca/models/get_user_by_id'
22
17
  require 'isaca/models/get_user_details_by_token'
23
- require 'isaca/models/submit_cpe'
18
+
19
+ # Errors
20
+ require 'isaca/service_error'
21
+ require 'isaca/connection_error'
22
+ require 'isaca/partner_key_error'
23
+ require 'isaca/session_error'
24
+ require 'isaca/attribute_error'
24
25
 
25
26
  # Everything else where order load order does not matter
26
27
  require 'isaca/version'
@@ -57,7 +58,7 @@ module ISACA
57
58
  attr_accessor :secret_pass
58
59
  attr_accessor :user_agent
59
60
  attr_accessor :verify_ssl
60
- attr_writer :logger
61
+ attr_accessor :logger
61
62
  attr_accessor :debug
62
63
 
63
64
  def initialize
@@ -97,10 +98,6 @@ module ISACA
97
98
 
98
99
  raise ConfigurationError.new(msg)
99
100
  end
100
-
101
- def logger=(logger)
102
- ISACA.logger = logger
103
- end
104
101
  end
105
102
 
106
103
  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.9
4
+ version: 1.0.0
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-05-14 00:00:00.000000000 Z
11
+ date: 2018-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -66,6 +66,48 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '5.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest-reporters
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.14'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.14'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-minitest
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.4'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.4'
69
111
  description: A wrapper for the ISACA Partners API
70
112
  email:
71
113
  - morahood@gmail.com
@@ -74,23 +116,23 @@ extensions: []
74
116
  extra_rdoc_files: []
75
117
  files:
76
118
  - ".gitignore"
77
- - ".travis.yml"
78
119
  - Gemfile
79
120
  - Gemfile.lock
121
+ - Guardfile
80
122
  - README.md
81
123
  - Rakefile
82
124
  - bin/console
83
125
  - bin/setup
84
126
  - isaca.gemspec
85
127
  - lib/isaca.rb
128
+ - lib/isaca/attribute_error.rb
129
+ - lib/isaca/connection_error.rb
86
130
  - lib/isaca/helpers.rb
87
131
  - lib/isaca/models/authenticate_user.rb
88
132
  - lib/isaca/models/countries.rb
89
- - lib/isaca/models/explicit_countries.rb
90
- - lib/isaca/models/geographical.rb
91
133
  - lib/isaca/models/get_user_by_id.rb
92
134
  - lib/isaca/models/get_user_details_by_token.rb
93
- - lib/isaca/models/submit_cpe.rb
135
+ - lib/isaca/partner_key_error.rb
94
136
  - lib/isaca/requests/authenticate_user.rb
95
137
  - lib/isaca/requests/countries.rb
96
138
  - lib/isaca/requests/explicit_countries.rb
@@ -99,7 +141,8 @@ files:
99
141
  - lib/isaca/requests/log_out.rb
100
142
  - lib/isaca/requests/report_consent.rb
101
143
  - lib/isaca/requests/request.rb
102
- - lib/isaca/requests/submit_cpe.rb
144
+ - lib/isaca/service_error.rb
145
+ - lib/isaca/session_error.rb
103
146
  - lib/isaca/version.rb
104
147
  homepage: ''
105
148
  licenses: []
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3.3
5
- before_install: gem install bundler -v 1.16.0
@@ -1,11 +0,0 @@
1
- module ISACA
2
- module Model
3
- class ExplicitCountries
4
- include ISACA::Model::Geographical
5
-
6
- def initialize(countries)
7
- @countries = countries
8
- end
9
- end
10
- end
11
- end
@@ -1,17 +0,0 @@
1
- module ISACA
2
- module Model
3
- module Geographical
4
- attr_accessor :countries
5
-
6
- def includes_country?(value)
7
- value.downcase!
8
-
9
- countries.each do |country|
10
- return true if country['CODE'].downcase == value || country['DESCRIPTION'].downcase == value
11
- end
12
-
13
- false
14
- end
15
- end
16
- end
17
- end
@@ -1,6 +0,0 @@
1
- module ISACA
2
- module Model
3
- class SubmitCPE
4
- end
5
- end
6
- end
@@ -1,19 +0,0 @@
1
- module ISACA
2
- module Request
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
17
- end
18
- end
19
- end