isaca 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/isaca/configuration_error.rb +4 -0
- data/lib/isaca/helpers.rb +22 -2
- data/lib/isaca/models/authenticate_user.rb +10 -7
- data/lib/isaca/models/countries.rb +19 -0
- data/lib/isaca/models/get_user_by_id.rb +31 -11
- data/lib/isaca/models/get_user_details_by_token.rb +55 -13
- data/lib/isaca/requests/authenticate_user.rb +5 -2
- data/lib/isaca/requests/countries.rb +6 -1
- data/lib/isaca/requests/explicit_countries.rb +8 -2
- data/lib/isaca/requests/get_user_by_id.rb +19 -6
- data/lib/isaca/requests/get_user_details_by_token.rb +6 -2
- data/lib/isaca/version.rb +1 -1
- data/lib/isaca.rb +72 -10
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 268dab3df3c97c1c62f49e26c3e667429acb7017
|
4
|
+
data.tar.gz: 916311a0bc1f19b868bede5ea267f2310c9a412f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4340024fce029cafe8593391db2be6eb65a8190f5d9de7a2e310dc55220dcc3c8c1873239629831ffb164d608640e51732d0f84c2a4bc6151dec4a997a218012
|
7
|
+
data.tar.gz: de6b0cde98d07991a7f8fce17706c04c1eafb48e161eead69f6449d408a8d77beab387ab39386fb493ec58fecee27e1eed3e36342b9dc879e70676a7e38fd0fc
|
data/Gemfile.lock
CHANGED
data/lib/isaca/helpers.rb
CHANGED
@@ -2,17 +2,37 @@ require 'date'
|
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
module ISACA
|
5
|
+
# A series of helper methods for parsing the way ISACA sends some data.
|
5
6
|
module Helpers
|
7
|
+
# ISACA seems to use the default format to pass datetimes. This method exists so you don't have to remember
|
8
|
+
# the parse format.
|
9
|
+
#
|
10
|
+
# @param [String] string_time The time passed by ISACA.
|
11
|
+
# @param [String] format The format of the time.
|
12
|
+
#
|
13
|
+
# @return [DateTime]
|
6
14
|
def self.strptime(string_time, format='%m/%d/%Y %I:%M:%S %p')
|
7
15
|
(string_time.nil? || string_time.empty?) ? nil : DateTime.strptime(string_time, format)
|
8
16
|
end
|
9
17
|
|
18
|
+
# ISACA passes booleans as a string representation, this method helps parse these representations.
|
19
|
+
#
|
20
|
+
# @param [String] string The string representation of a boolean. (e.g. "True", "false", "False"). If nil this method will return false.
|
21
|
+
#
|
22
|
+
# @returns [Boolean]
|
10
23
|
def self.parse_boolean(string)
|
11
|
-
string == '
|
24
|
+
string.downcase == 'true' ? true : false
|
12
25
|
end
|
13
26
|
|
27
|
+
# ISACA has an abbreviated member type and this method will break down those abbreviations into one of the three primary types: member, non_member or student.
|
28
|
+
#
|
29
|
+
# @param [String] type The abbreviated member type.
|
30
|
+
#
|
31
|
+
# @return [Symbol] :member, :non_member or :student.
|
14
32
|
def self.normalize_member_type(type)
|
15
|
-
|
33
|
+
return :non_member if type.nil?
|
34
|
+
|
35
|
+
case type.upcase
|
16
36
|
when 'COMP' then :member
|
17
37
|
when 'LIFE' then :member
|
18
38
|
when 'STUM' then :student
|
@@ -1,18 +1,21 @@
|
|
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
|
+
# Class that is used as an object representation of the response from {ISACA::Request::AuthenticateUser}.
|
4
4
|
class AuthenticateUser
|
5
|
-
# The ISACA error -- ISACA documentation on this is currently limited.
|
6
5
|
attr_reader :error
|
7
|
-
#
|
6
|
+
# @!attribute error
|
7
|
+
# @return [Array] The ISACA error -- ISACA documentation on this is currently limited.
|
8
8
|
attr_reader :error_code
|
9
|
-
#
|
9
|
+
# @!attribute error_code
|
10
|
+
# @return [String] The ISACA error code -- ISACA documentation on this is currently limited.
|
10
11
|
attr_reader :is_valid
|
11
|
-
#
|
12
|
+
# @!attribute is_valid
|
13
|
+
# @return [Boolean] Whether or not the session is valid.
|
12
14
|
attr_reader :value
|
15
|
+
# @!attribute value
|
16
|
+
# @return [String] Session value or error message.
|
13
17
|
|
14
|
-
|
15
|
-
# @param [Hash] params Parameters to create the object with
|
18
|
+
# @param [Hash] params Parameters to create the object with.
|
16
19
|
# @option params [String] :Error Required
|
17
20
|
# @option params [String] :ErrorCode Required
|
18
21
|
# @option params [String] :IsValid Required
|
@@ -1,12 +1,23 @@
|
|
1
1
|
module ISACA
|
2
2
|
module Model
|
3
|
+
# Class that is used as an object representation of the response from {ISACA::Request::Countries} and {ISACA::Request::ExplicitCountries}.
|
3
4
|
class Countries
|
4
5
|
attr_reader :countries
|
6
|
+
# @!attribute countries
|
7
|
+
# @return [Array] A list of countries that ISACA recognizes.
|
5
8
|
|
9
|
+
# @param [Array<Hash>] countries Countries to create the object with.
|
10
|
+
# @option countries [String] :CODE Required
|
11
|
+
# @option countries [String] :DESCRIPTION Required
|
6
12
|
def initialize(countries)
|
7
13
|
@countries = countries.map { |c| Country.new(c[:CODE], c[:DESCRIPTION]) }
|
8
14
|
end
|
9
15
|
|
16
|
+
# Method used to see if the a country exists. Searches across both country code and country description. Case insensitive.
|
17
|
+
#
|
18
|
+
# @param [String] value The value to be searched.
|
19
|
+
#
|
20
|
+
# @return [Boolean] Whether or not the country is included.
|
10
21
|
def includes_country?(value)
|
11
22
|
@countries.each { |country| return true if country_matches?(country, value) }
|
12
23
|
false
|
@@ -14,12 +25,20 @@ module ISACA
|
|
14
25
|
|
15
26
|
private
|
16
27
|
|
28
|
+
# Method used to see if country matches value. Checks across country code and country description. Case insensitive.
|
29
|
+
# Exists for the ease of testing.
|
30
|
+
#
|
31
|
+
# @param [Country] country The country to be searched.
|
32
|
+
# @param [String] value The value to search by.
|
33
|
+
#
|
34
|
+
# @return [Boolean] Whether or not the given country matches the value.
|
17
35
|
def country_matches?(country, value)
|
18
36
|
value.downcase!
|
19
37
|
country.code.downcase == value || country.description.downcase == value
|
20
38
|
end
|
21
39
|
end
|
22
40
|
|
41
|
+
# Struct that represents an ISACA country data object
|
23
42
|
Country = Struct.new(:code, :description)
|
24
43
|
end
|
25
44
|
end
|
@@ -1,23 +1,43 @@
|
|
1
1
|
module ISACA
|
2
2
|
module Model
|
3
|
+
# Class is used as an object representation of the response from {ISACA::Request::GetUserByID}.
|
3
4
|
class GetUserByID
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
attr_accessor :imis_id
|
5
|
+
attr_reader :active_member
|
6
|
+
# @!attribute active_member
|
7
|
+
# @return [Boolean] Whether or not the membership is active.
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
@member_type = ISACA::Helpers.normalize_member_type(hash['MemberType'])
|
9
|
+
attr_reader :expiration_date
|
10
|
+
# @!attribute expiration_date
|
11
|
+
# @return [DateTime|nil] The date the membership expires. Never expires if nil.
|
13
12
|
|
14
|
-
|
15
|
-
|
13
|
+
attr_reader :member_type
|
14
|
+
# @!attribute member_type
|
15
|
+
# @return [Symbol] The membership's classification.
|
16
|
+
|
17
|
+
attr_reader :imis_id
|
18
|
+
# @!attribute imis_id
|
19
|
+
# @return [String] The membership's unique ID
|
20
|
+
|
21
|
+
# @param [Hash] params The parameters used to create the object
|
22
|
+
# @option params [String] :ActiveMember
|
23
|
+
# @option params [String] :ExpirationDate
|
24
|
+
# @option params [String] :MemberType
|
25
|
+
# @option params [String] :iMISID
|
26
|
+
def initialize(params)
|
27
|
+
@active_member = ISACA::Helpers.parse_boolean(params[:ActiveMember])
|
28
|
+
@expiration_date = ISACA::Helpers.strptime(params[:ExpirationDate])
|
29
|
+
@member_type = ISACA::Helpers.normalize_member_type(params[:MemberType])
|
30
|
+
|
31
|
+
if params[:iMISID].to_s.strip.empty?
|
32
|
+
raise ServiceError.new('User with given IMIS ID not found')
|
16
33
|
else
|
17
|
-
@imis_id =
|
34
|
+
@imis_id = params[:iMISID]
|
18
35
|
end
|
19
36
|
end
|
20
37
|
|
38
|
+
# A method that identifies whether or not the membership is active
|
39
|
+
#
|
40
|
+
# @return [Boolean] Whether or not the membership is active.
|
21
41
|
def active_member?
|
22
42
|
active_member
|
23
43
|
end
|
@@ -1,39 +1,81 @@
|
|
1
1
|
# An object representation of the GetUserDetailsByToken endpoint
|
2
2
|
module ISACA
|
3
3
|
module Model
|
4
|
+
# Class is used as an object representation of the response from {ISACA::Request::GetUserDetailsByToken}.
|
4
5
|
class GetUserDetailsByToken
|
5
6
|
attr_reader :imis_id
|
7
|
+
# @!attribute imis_id
|
8
|
+
# @return [String] The IMIS ID of the requested user
|
9
|
+
|
6
10
|
attr_reader :enterprise_id
|
11
|
+
# @!attribute enterprise_id
|
12
|
+
# @return [String] The Enterprise ID of the requested user
|
13
|
+
|
7
14
|
attr_reader :first_name
|
15
|
+
# @!attribute first_name
|
16
|
+
# @return [String] The first name of the requested user
|
17
|
+
|
8
18
|
attr_reader :last_name
|
19
|
+
# @!attribute last_name
|
20
|
+
# @return [String] The last name of the requested user
|
21
|
+
|
9
22
|
attr_reader :email
|
23
|
+
# @!attribute email
|
24
|
+
# @return [String] The email of the requested user
|
25
|
+
|
10
26
|
attr_reader :username
|
27
|
+
# @!attribute username
|
28
|
+
# @return [String] The username of the requested user
|
29
|
+
|
11
30
|
attr_reader :country
|
31
|
+
# @!attribute country
|
32
|
+
# @return [String] The country of the requested user
|
33
|
+
|
12
34
|
attr_reader :privacy
|
35
|
+
# @!attribute privacy
|
36
|
+
# @return [Boolean|nil] The privacy acceptance status of the requested user
|
37
|
+
|
13
38
|
attr_reader :marketing
|
39
|
+
# @!attribute marketing
|
40
|
+
# @return [Boolean|nil] The marketing acceptance status of the requested user
|
14
41
|
|
15
|
-
|
16
|
-
|
42
|
+
# @param [Hash] params The parameters used to create the object
|
43
|
+
# @option params [String] :ID Required
|
44
|
+
# @option params [String] :Ent_ID
|
45
|
+
# @option params [String] :First_Name
|
46
|
+
# @option params [String] :Last_Name
|
47
|
+
# @option params [String] :Email
|
48
|
+
# @option params [String] :UserName
|
49
|
+
# @option params [String] :Country
|
50
|
+
# @option params [String] :PRIVACY
|
51
|
+
# @option params [String] :MARKETING
|
52
|
+
#
|
53
|
+
# @raise [ISACA::ServiceError] Raises error if IMIS ID is not present.
|
54
|
+
def initialize(params)
|
55
|
+
if params[:ID].to_s.strip.empty?
|
56
|
+
raise ServiceError.new('User with given IMIS ID not found')
|
57
|
+
else
|
58
|
+
@imis_id = params[:ID]
|
59
|
+
end
|
17
60
|
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
23
|
-
@
|
24
|
-
@country = hash[:Country]
|
61
|
+
@enterprise_id = params[:Ent_ID]
|
62
|
+
@first_name = params[:First_Name]
|
63
|
+
@last_name = params[:Last_Name]
|
64
|
+
@email = params[:Email]
|
65
|
+
@username = params[:UserName]
|
66
|
+
@country = params[:Country]
|
25
67
|
|
26
|
-
if
|
68
|
+
if params[:PRIVACY] == '1'
|
27
69
|
@privacy = true
|
28
|
-
elsif
|
70
|
+
elsif params[:PRIVACY] == '0'
|
29
71
|
@privacy = false
|
30
72
|
else
|
31
73
|
@privacy = nil
|
32
74
|
end
|
33
75
|
|
34
|
-
if
|
76
|
+
if params[:MARKETING] == '1'
|
35
77
|
@marketing = true
|
36
|
-
elsif
|
78
|
+
elsif params[:MARKETING] == '0'
|
37
79
|
@marketing = false
|
38
80
|
else
|
39
81
|
@marketing = nil
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module ISACA
|
2
2
|
module Request
|
3
|
+
# Class used to create user sessions.
|
3
4
|
class AuthenticateUser
|
4
5
|
# Method used to generate a session token.
|
5
6
|
#
|
6
|
-
# @raise [ISACA::SessionError] Raised if the returned session is invalid
|
7
|
+
# @raise [ISACA::SessionError] Raised if the returned session is invalid.
|
7
8
|
#
|
8
|
-
# @return [ISACA::Model::AuthenticateUser]
|
9
|
+
# @return [ISACA::Model::AuthenticateUser] An object representation of the response.
|
9
10
|
def self.get(username, password)
|
10
11
|
response = self.send_request(username, password)
|
11
12
|
|
@@ -20,6 +21,8 @@ module ISACA
|
|
20
21
|
#
|
21
22
|
# @param username [String]
|
22
23
|
# @param password [String]
|
24
|
+
#
|
25
|
+
# @return [Faraday::Response]
|
23
26
|
def self.send_request(username, password)
|
24
27
|
ISACA::Request.get do |request|
|
25
28
|
request.path = request.path + '/AuthenticateUser'
|
@@ -1,7 +1,10 @@
|
|
1
1
|
module ISACA
|
2
2
|
module Request
|
3
|
+
# Class used to fetch countries recognized by ISACA.
|
3
4
|
module Countries
|
4
|
-
# Method used to fetch all countries
|
5
|
+
# Method used to fetch all countries.
|
6
|
+
#
|
7
|
+
# @return [ISACA::Model::Countries] An object representation of the response.
|
5
8
|
def self.get
|
6
9
|
response = self.send_request
|
7
10
|
ISACA::Model::Countries.new(JSON.parse(response.body, symbolize_names: true))
|
@@ -10,6 +13,8 @@ module ISACA
|
|
10
13
|
private
|
11
14
|
|
12
15
|
# Method used to send the request -- exists for easy testing purposes
|
16
|
+
#
|
17
|
+
# @return [Faraday::Response]
|
13
18
|
def self.send_request
|
14
19
|
ISACA::Request.get do |request|
|
15
20
|
uri = URI(ISACA.configuration.url)
|
@@ -1,7 +1,11 @@
|
|
1
1
|
module ISACA
|
2
2
|
module Request
|
3
|
+
# Class used to fetch the explicit countries recognized by ISACA. Explicit countries are countries that require
|
4
|
+
# consent for marketing.
|
3
5
|
module ExplicitCountries
|
4
|
-
# Method used to fetch all of the ExplicitCountries
|
6
|
+
# Method used to fetch all of the ExplicitCountries.
|
7
|
+
#
|
8
|
+
# @return [ISACA::Model::Countries] An object representation of the response.
|
5
9
|
def self.get
|
6
10
|
response = self.send_request
|
7
11
|
ISACA::Model::Countries.new(JSON.parse(response.body, symbolize_names: true))
|
@@ -9,7 +13,9 @@ module ISACA
|
|
9
13
|
|
10
14
|
private
|
11
15
|
|
12
|
-
# Method used to send the request -- exists for easy testing purposes
|
16
|
+
# Method used to send the request -- exists for easy testing purposes.
|
17
|
+
#
|
18
|
+
# @return [Faraday::Response]
|
13
19
|
def self.send_request
|
14
20
|
ISACA::Request.get do |request|
|
15
21
|
uri = URI(ISACA.configuration.url)
|
@@ -1,16 +1,29 @@
|
|
1
1
|
module ISACA
|
2
2
|
module Request
|
3
|
+
# Class used to fetch an ISACA user by their IMIS ID.
|
3
4
|
module GetUserByID
|
5
|
+
# Method fetches ISACA user by IMIS ID.
|
6
|
+
#
|
7
|
+
# @param [String] id The IMIS ID of the requested user.
|
8
|
+
#
|
9
|
+
# @return [ISACA::Model::GetUserByID] An object representation of the response.
|
4
10
|
def self.get(id)
|
5
|
-
response =
|
11
|
+
response = self.send_request(id)
|
12
|
+
ISACA::Model::GetUserByID.new(JSON.parse(response.body, symbolize_names: true))
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
# Method used to send the request -- exists to ease testing.
|
18
|
+
#
|
19
|
+
# @param [String] id The IMIS ID of the requested user.
|
20
|
+
#
|
21
|
+
# @return [Faraday::Response]
|
22
|
+
def self.send_request(id)
|
23
|
+
ISACA::Request.get do |request|
|
6
24
|
request.path = request.path + '/GetUserByID'
|
7
25
|
request.params['ID'] = id
|
8
26
|
end
|
9
|
-
|
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
|
14
27
|
end
|
15
28
|
end
|
16
29
|
end
|
@@ -3,9 +3,11 @@ module ISACA
|
|
3
3
|
class GetUserDetailsByToken
|
4
4
|
# Method used to get user information by token
|
5
5
|
#
|
6
|
+
# @param token [String] The user's session token
|
7
|
+
#
|
6
8
|
# @raise [ISACA::AttributeError] Raised if the returned IMIS ID is nil or the ID key is missing
|
7
9
|
#
|
8
|
-
# @return [ISACA::Model::GetUserDetailsByToken]
|
10
|
+
# @return [ISACA::Model::GetUserDetailsByToken] An object representation of the response
|
9
11
|
def self.get(token)
|
10
12
|
response = self.send_request(token)
|
11
13
|
|
@@ -16,7 +18,9 @@ module ISACA
|
|
16
18
|
private
|
17
19
|
# Method used to send the request -- exists for easy stubbing during tests
|
18
20
|
#
|
19
|
-
# @param token [String]
|
21
|
+
# @param token [String] The user's session token
|
22
|
+
#
|
23
|
+
# @return [Faraday::Response]
|
20
24
|
def self.send_request(token)
|
21
25
|
ISACA::Request.get do |request|
|
22
26
|
request.path = request.path + '/GetUserDetailsByToken'
|
data/lib/isaca/version.rb
CHANGED
data/lib/isaca.rb
CHANGED
@@ -22,6 +22,7 @@ require 'isaca/connection_error'
|
|
22
22
|
require 'isaca/partner_key_error'
|
23
23
|
require 'isaca/session_error'
|
24
24
|
require 'isaca/attribute_error'
|
25
|
+
require 'isaca/configuration_error'
|
25
26
|
|
26
27
|
# Everything else where order load order does not matter
|
27
28
|
require 'isaca/version'
|
@@ -29,15 +30,34 @@ require 'fileutils'
|
|
29
30
|
require 'openssl'
|
30
31
|
require 'logger'
|
31
32
|
|
33
|
+
# Library intended to help ease the implementation of ISACA web services.
|
32
34
|
module ISACA
|
33
35
|
class << self
|
34
36
|
attr_accessor :configuration
|
37
|
+
# @!attribute configuration
|
38
|
+
# @return [ISACA::Configuration] Object used to configure the library.
|
39
|
+
|
35
40
|
attr_accessor :logger
|
41
|
+
# @!attribute logger
|
42
|
+
# @return [Logger]
|
36
43
|
|
44
|
+
# Method used to fetch the configuration object.
|
45
|
+
#
|
46
|
+
# @return [ISACA::Configuration]
|
37
47
|
def configuration
|
38
48
|
@configuration ||= Configuration.new
|
39
49
|
end
|
40
50
|
|
51
|
+
# Method used to reset the ISACA configuration. Primarily used for testing.
|
52
|
+
#
|
53
|
+
# @return [ISACA::Configuration]
|
54
|
+
def reset
|
55
|
+
@configuration = Configuration.new
|
56
|
+
end
|
57
|
+
|
58
|
+
# Method used to get the logger.
|
59
|
+
#
|
60
|
+
# @return [Logger]
|
41
61
|
def logger
|
42
62
|
path = 'log/isaca.log'
|
43
63
|
dir = File.dirname(path)
|
@@ -47,25 +67,59 @@ module ISACA
|
|
47
67
|
end
|
48
68
|
end
|
49
69
|
|
70
|
+
# Configuration block used to configure the library.
|
71
|
+
#
|
72
|
+
# @yield [ISACA::Configuration]
|
73
|
+
#
|
74
|
+
# @example An example configuration
|
75
|
+
# ISACA.configure do |config|
|
76
|
+
# config.url = 'https://partnerapi.isaca.org:8443/ISACAServices/Service1.svc'
|
77
|
+
# config.secret_pass = '1234567890ABCDEFGHI'
|
78
|
+
# config.user_agent = 'my_application'
|
79
|
+
# config.verify_ssl = false
|
80
|
+
# end
|
50
81
|
def self.configure
|
51
82
|
self.configuration ||= Configuration.new
|
52
83
|
yield(configuration)
|
53
84
|
self.configuration
|
54
85
|
end
|
55
86
|
|
87
|
+
# Class used to store library configurations.
|
56
88
|
class Configuration
|
57
89
|
attr_accessor :url
|
90
|
+
# @!attribute url
|
91
|
+
# @return [String] The root url for the ISACA web service.
|
92
|
+
|
58
93
|
attr_accessor :secret_pass
|
94
|
+
# @!attribute secret_pass
|
95
|
+
# @return [String] Your api key.
|
96
|
+
|
59
97
|
attr_accessor :user_agent
|
98
|
+
# @!attribute user_agent
|
99
|
+
# @return [String] The user agent that will be passed in the request headers.
|
100
|
+
|
60
101
|
attr_accessor :verify_ssl
|
102
|
+
# @!attribute verify_ssl
|
103
|
+
# @return [Boolean] Whether or not SSL certificates should be verified. Recommend true for production.
|
104
|
+
|
61
105
|
attr_accessor :logger
|
106
|
+
# @!attribute logger
|
107
|
+
# @return [Logger] The logger used for logging.
|
108
|
+
|
62
109
|
attr_accessor :debug
|
110
|
+
# @!attribute debug
|
111
|
+
# @return [Boolean] Whether or not logging should be used. Recommend false for production to ease GDPR concerns.
|
63
112
|
|
64
113
|
def initialize
|
65
114
|
@verify_ssl = true
|
66
115
|
@debug = false
|
67
116
|
end
|
68
117
|
|
118
|
+
# Returns the secret_pass attribute value
|
119
|
+
#
|
120
|
+
# @raise [ISACA::ConfigurationError] Raises if secret pass was not configured.
|
121
|
+
#
|
122
|
+
# @return [String]
|
69
123
|
def secret_pass
|
70
124
|
if @secret_pass
|
71
125
|
@secret_pass
|
@@ -77,6 +131,11 @@ module ISACA
|
|
77
131
|
end
|
78
132
|
end
|
79
133
|
|
134
|
+
# Returns the url attribute value
|
135
|
+
#
|
136
|
+
# @raise [ISACA::ConfigurationError] Raises if url was not configured.
|
137
|
+
#
|
138
|
+
# @return [String]
|
80
139
|
def url
|
81
140
|
if @url
|
82
141
|
@url
|
@@ -87,18 +146,21 @@ module ISACA
|
|
87
146
|
raise ConfigurationError.new(msg)
|
88
147
|
end
|
89
148
|
end
|
90
|
-
end
|
91
149
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
150
|
+
# Returns the user_agent attribute value
|
151
|
+
#
|
152
|
+
# @raise [ISACA::ConfigurationError] Raises if user agent was not configured.
|
153
|
+
#
|
154
|
+
# @return [String]
|
155
|
+
def user_agent
|
156
|
+
if @user_agent
|
157
|
+
@user_agent
|
158
|
+
else
|
159
|
+
msg = 'Missing User-Agent configuration. The ISACA Partners API requires a predefined User-Agent.'
|
160
|
+
msg << ' Example: ISACA.configure {|config| config.user_agent = "MyApplication"}'
|
98
161
|
|
99
|
-
|
162
|
+
raise ConfigurationError.new(msg)
|
163
|
+
end
|
100
164
|
end
|
101
165
|
end
|
102
|
-
|
103
|
-
class ConfigurationError < StandardError; end
|
104
166
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isaca
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Orahood
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- isaca.gemspec
|
127
127
|
- lib/isaca.rb
|
128
128
|
- lib/isaca/attribute_error.rb
|
129
|
+
- lib/isaca/configuration_error.rb
|
129
130
|
- lib/isaca/connection_error.rb
|
130
131
|
- lib/isaca/helpers.rb
|
131
132
|
- lib/isaca/models/authenticate_user.rb
|