AvrijAnalyticsUtility 0.5.2 → 0.5.3
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 +59 -44
- data/lib/AvrijAnalyticsUtility/version.rb +1 -1
- 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: aab9192789eb38e11eb704e50bf351463f4d6c16
|
4
|
+
data.tar.gz: fcda45fe80bb58f15338f5ebf536cd894e43ad7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c928c42649bf558c00c9913a27c73cc3e53a5b174c689d4132b0e18af3f0c579ab57516a00693b2ea65a440d233be922f9b4c7b35464218e2973fc66df578b8
|
7
|
+
data.tar.gz: 36a6a49d06a40b8f24dad01999ead3b58405b657dfe1371793fe3809258a59d1e40c17c1cff10cbb54cce548b1f8e58089b0deb2c383d8bdaa9e717c29825232
|
@@ -33,22 +33,22 @@ class AvrijAnalyticsUtility::APIConnector
|
|
33
33
|
# * +queryHash+ - Hash definition of query options
|
34
34
|
# ==== Examples
|
35
35
|
#
|
36
|
-
# [apiEndpoint]
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
# [headerHash]
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
# [headerQuery]
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
36
|
+
# #[apiEndpoint]
|
37
|
+
# #- Given the complete browser's uri : https://www.company.com:8080/api/endpoint1/endpoint1_1
|
38
|
+
# #- given the base uri : https://www.company.com:8080
|
39
|
+
# #- then endpoint is : api/endpoint1/endpoint1_1
|
40
|
+
#
|
41
|
+
# #[headerHash]
|
42
|
+
# #- my_header: {
|
43
|
+
# # "Key1" => "value1",
|
44
|
+
# # "key2" => "value2"
|
45
|
+
# # }
|
46
|
+
#
|
47
|
+
# #[headerQuery]
|
48
|
+
# #- my_query {
|
49
|
+
# # "key1" => "value1",
|
50
|
+
# # "key2" => "value2"
|
51
|
+
# #}
|
52
52
|
def getRequest(apiEndpoint,headerHash,queryHash)
|
53
53
|
@header_hash = headerHash
|
54
54
|
@query_hash = queryHash
|
@@ -64,11 +64,11 @@ class AvrijAnalyticsUtility::APIConnector
|
|
64
64
|
# * +headerHash+ - Hash definition of header options
|
65
65
|
# ==== Examples
|
66
66
|
#
|
67
|
-
# [headerHash]
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
67
|
+
# #[headerHash]
|
68
|
+
# #- my_header: {
|
69
|
+
# # "Key1" => "value1",
|
70
|
+
# # "key2" => "value2"
|
71
|
+
# # }
|
72
72
|
def setHeader(headerHash)
|
73
73
|
@header_hash = headerHash
|
74
74
|
end
|
@@ -79,11 +79,11 @@ class AvrijAnalyticsUtility::APIConnector
|
|
79
79
|
# * +queryHash+ - Hash definition of query options
|
80
80
|
# ==== Examples
|
81
81
|
#
|
82
|
-
# [queryHash]
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
82
|
+
# #[queryHash]
|
83
|
+
# #- my_query: {
|
84
|
+
# # "Key1" => "value1",
|
85
|
+
# # "key2" => "value2"
|
86
|
+
# # }
|
87
87
|
def setQuery(queryHash)
|
88
88
|
@query_hash = queryHash
|
89
89
|
end
|
@@ -94,11 +94,11 @@ class AvrijAnalyticsUtility::APIConnector
|
|
94
94
|
# * +bodyHash+ - Hash definition of body options
|
95
95
|
# ==== Examples
|
96
96
|
#
|
97
|
-
# [bodyHash]
|
98
|
-
#
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
97
|
+
# #[bodyHash]
|
98
|
+
# #- my_body: {
|
99
|
+
# # "Key1" => "value1",
|
100
|
+
# # "key2" => "value2"
|
101
|
+
# # }
|
102
102
|
def setBody(bodyHash)
|
103
103
|
@body_hash = bodyHash
|
104
104
|
end
|
@@ -115,22 +115,22 @@ class AvrijAnalyticsUtility::APIConnector
|
|
115
115
|
#
|
116
116
|
# ==== Steps for Authentication
|
117
117
|
#
|
118
|
-
# myConnector = APIConnector.new(base_uri)
|
118
|
+
# #myConnector = APIConnector.new(base_uri)
|
119
119
|
#
|
120
|
-
# auth_Header =
|
121
|
-
#
|
122
|
-
#
|
120
|
+
# #auth_Header = {
|
121
|
+
# # "Authorization" => "Bearer undefined"
|
122
|
+
# #}
|
123
123
|
#
|
124
|
-
# auth_body =
|
125
|
-
#
|
126
|
-
#
|
127
|
-
#
|
124
|
+
# #auth_body = {
|
125
|
+
# # "username" => "myusername",
|
126
|
+
# # "password" => "mypassword"
|
127
|
+
# #}
|
128
128
|
#
|
129
|
-
# myConnector.setHeader(auth_Header)
|
130
|
-
# myConnector.setBody(auth_body)
|
131
|
-
# if myConnector.authenticate(auth_endpoint)
|
132
|
-
#
|
133
|
-
# end
|
129
|
+
# #myConnector.setHeader(auth_Header)
|
130
|
+
# #myConnector.setBody(auth_body)
|
131
|
+
# #if myConnector.authenticate(auth_endpoint)
|
132
|
+
# # <todo>
|
133
|
+
# #end
|
134
134
|
|
135
135
|
def authenticate(authentication_endpoint)
|
136
136
|
authentication_uri = @base_uri + "/" + authentication_endpoint
|
@@ -148,4 +148,19 @@ class AvrijAnalyticsUtility::APIConnector
|
|
148
148
|
end
|
149
149
|
return result
|
150
150
|
end
|
151
|
+
|
152
|
+
# Send JSON string to JSON file
|
153
|
+
#
|
154
|
+
# ==== Attributes
|
155
|
+
#
|
156
|
+
# * +jsonString+ - JSON string
|
157
|
+
# * +jsonOutputFile+ - JSON output file
|
158
|
+
#
|
159
|
+
def jsonString_to_jsonFile(jsonString,jsonOutputFile)
|
160
|
+
File.open(jsonOutputFile,"w") do |f|
|
161
|
+
f.write(jsonString.to_json)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
|
151
166
|
end # end- APIConnector
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: AvrijAnalyticsUtility
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Dalisay
|
@@ -128,7 +128,7 @@ licenses:
|
|
128
128
|
- MIT
|
129
129
|
metadata:
|
130
130
|
allowed_push_host: https://rubygems.org
|
131
|
-
post_install_message: 'AvrijAnalyticsUtility VERSION : 0.5.
|
131
|
+
post_install_message: 'AvrijAnalyticsUtility VERSION : 0.5.3'
|
132
132
|
rdoc_options: []
|
133
133
|
require_paths:
|
134
134
|
- lib
|