AvrijAnalyticsUtility 0.3.1 → 0.3.2
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/lib/AvrijAnalyticsUtility/APIConnector.rb +23 -6
- data/lib/AvrijAnalyticsUtility/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10fb4e052483911211df56fee1d5bc5ebac63f25
|
4
|
+
data.tar.gz: 7c9abd29d5399c233b4a64ead8e96ed091c8af3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd7bee0f8795748b0c4ef5184d347341c9733bca8e78e27f558d9afe8b17df0e9f6384b2c272517f4c79e88c49bfb1ca4f4cb90122a19d0ceafd54de1aa70d4c
|
7
|
+
data.tar.gz: 99480ea5c5bc92929ca82ce9e68ed612eda3fbb01967bcb282fb55905e2a52e751983f09757ec128305c177181eba8934fb84e78e029e605ac14871b117849a6
|
@@ -6,10 +6,10 @@ module AvrijAnalyticsUtility
|
|
6
6
|
class APIConnector
|
7
7
|
|
8
8
|
#Constructor
|
9
|
-
def initialize(base_uri
|
9
|
+
def initialize(base_uri)
|
10
10
|
@base_uri = base_uri
|
11
|
-
@username =
|
12
|
-
@password =
|
11
|
+
@username = nil
|
12
|
+
@password = nil
|
13
13
|
@auth_token = nil
|
14
14
|
@auth_value = nil
|
15
15
|
@header_hash = nil
|
@@ -100,14 +100,31 @@ module AvrijAnalyticsUtility
|
|
100
100
|
#
|
101
101
|
# ==== Attributes
|
102
102
|
# * +authentication_endpoint+ - API authentication end point
|
103
|
-
# * +username+ - username
|
104
|
-
# * +password+ - password
|
105
103
|
# ==== Examples
|
106
104
|
# * [authentication_endpoint]
|
107
105
|
# - given the complete uri : https://www.company.com/auth
|
108
106
|
# - the base uri is : https://www.company.com
|
109
107
|
# - the authentication endpoint is : auth
|
110
|
-
|
108
|
+
#
|
109
|
+
# ==== Steps for Authentication
|
110
|
+
#
|
111
|
+
# myConnector = APIConnector.new(base_uri)
|
112
|
+
# auth_Header = {
|
113
|
+
# "Authorization" => "Bearer undefined"
|
114
|
+
# }
|
115
|
+
#
|
116
|
+
# auth_body = {
|
117
|
+
# "username" => "myusername",
|
118
|
+
# "password" => "mypassword"
|
119
|
+
# }
|
120
|
+
#
|
121
|
+
# myConnector.setHeader(auth_Header)
|
122
|
+
# myConnector.setBody(auth_body)
|
123
|
+
# if myConnector.authenticate(auth_endpoint)
|
124
|
+
# <todo>
|
125
|
+
# end
|
126
|
+
|
127
|
+
def authenticate(authentication_endpoint)
|
111
128
|
authentication_uri = @base_uri + "/" + authentication_endpoint
|
112
129
|
authentication_options = {headers: @header_hash, body: @body_hash}
|
113
130
|
authentication_result = HTTParty.post(authentication_uri, authentication_options)
|