authz_jurnal_client 0.0.4 → 0.0.5
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/.byebug_history +11 -0
- data/.rspec +3 -0
- data/.rspec_status +9 -0
- data/Gemfile.lock +1 -1
- data/README.md +54 -0
- data/authz_jurnal_client-0.0.4.gem +0 -0
- data/lib/authz_jurnal_client/version.rb +1 -1
- data/lib/authz_jurnal_client.rb +6 -4
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d451a03c29d40d2db74d2e4ecb7a3af61869f0851603f588ab17fe7f7ff79c0f
|
4
|
+
data.tar.gz: 196c69edecba8d9151f1040b3d99d5501a29bacae2758e305aea4e0c78881e06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03dc07308fdd976ca844f90790ff12bd1259d26db55b048206d4aa85b75aefa9d3f63fc919afd9e491630fdb2bdc60db56b6230de6fa54540d6f4ef695a6401d
|
7
|
+
data.tar.gz: 034cdd2ba58fe841bf15e21b8a024e79f700e686d7824120e5622ac60b39283a50337a1fa6be8e3dcade4180c09d932275a8d6ec1a77102d66a7bdda498c588c
|
data/.byebug_history
ADDED
data/.rspec
ADDED
data/.rspec_status
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
----------------------------------------- | ------ | --------------- |
|
3
|
+
./spec/authz_jurnal_client_spec.rb[1:1:1] | passed | 0.0031 seconds |
|
4
|
+
./spec/authz_jurnal_client_spec.rb[1:2:1] | passed | 0.01582 seconds |
|
5
|
+
./spec/authz_jurnal_client_spec.rb[1:2:2] | passed | 0.00067 seconds |
|
6
|
+
./spec/authz_jurnal_client_spec.rb[1:3:1] | passed | 0.00443 seconds |
|
7
|
+
./spec/authz_jurnal_client_spec.rb[1:3:2] | passed | 0.00199 seconds |
|
8
|
+
./spec/authz_jurnal_client_spec.rb[1:4:1] | passed | 0.00143 seconds |
|
9
|
+
./spec/authz_jurnal_client_spec.rb[1:4:2] | passed | 0.00153 seconds |
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -0,0 +1,54 @@
|
|
1
|
+
# AuthzJurnalClient
|
2
|
+
|
3
|
+
AuthzJurnalClient allows you to access the user roles API directly. It also provides the advantage of managing the caching
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
Install the gem thusly in the gemfile
|
11
|
+
|
12
|
+
``` markdown
|
13
|
+
gem 'authz_jurnal_client' or gem install authz_jurnal_client
|
14
|
+
```
|
15
|
+
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
TODO: Write usage instructions here
|
20
|
+
|
21
|
+
``` Ruby
|
22
|
+
Default :
|
23
|
+
AuthzJurnalClient::UserRoles.config(authorization: "Basic ApiToken")
|
24
|
+
roles = AuthzJurnalClient::UserRoles.call(uid, cid)
|
25
|
+
puts roles
|
26
|
+
|
27
|
+
Customize :
|
28
|
+
AuthzJurnalClient::UserRoles.config(redis: "redis://localhost:6379", domain: 'http://mydomain.com', expiry: 3600, authorization: "Basic ApiToken")
|
29
|
+
roles = AuthzJurnalClient::UserRoles.call(uid, cid)
|
30
|
+
puts roles
|
31
|
+
```
|
32
|
+
|
33
|
+
The response is a json parsed Openstruct
|
34
|
+
|
35
|
+
See tests for more details.
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
### For hacking on the GEM
|
40
|
+
|
41
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/authz_jurnal_client`. To experiment with that code, run `bin/console` for an interactive prompt.
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
## Development
|
47
|
+
|
48
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
49
|
+
|
50
|
+
To install this gem into your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/authz_jurnal_client.
|
Binary file
|
data/lib/authz_jurnal_client.rb
CHANGED
@@ -2,6 +2,7 @@ require "ostruct"
|
|
2
2
|
require "json"
|
3
3
|
require "faraday"
|
4
4
|
require "redis"
|
5
|
+
require 'byebug'
|
5
6
|
|
6
7
|
require_relative "authz_jurnal_client/version"
|
7
8
|
|
@@ -12,11 +13,12 @@ module AuthzJurnalClient
|
|
12
13
|
class << self
|
13
14
|
attr_accessor :redis, :domain, :authorization, :expiry
|
14
15
|
def config(opts = {})
|
15
|
-
@
|
16
|
+
@authorization = opts[:authorization]
|
17
|
+
@headers = {"Authorization" => @authorization}
|
16
18
|
@domain = opts[:domain] || 'http://localhost:3000'
|
17
19
|
redis_path = opts[:redis] || 'redis://localhost:6379'
|
18
20
|
@redis = Redis.new(url: redis_path)
|
19
|
-
@expiry = opts[:expiry] || 3600
|
21
|
+
@expiry = opts[:expiry] || 3600
|
20
22
|
end
|
21
23
|
|
22
24
|
def call(id, cid)
|
@@ -48,8 +50,8 @@ module AuthzJurnalClient
|
|
48
50
|
end
|
49
51
|
|
50
52
|
def get_roles(j)
|
51
|
-
|
52
|
-
|
53
|
+
data = eval(j)
|
54
|
+
JSON.parse( data.to_json, object_class: OpenStruct).data.roles
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authz_jurnal_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alam Topani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -17,6 +17,9 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".byebug_history"
|
21
|
+
- ".rspec"
|
22
|
+
- ".rspec_status"
|
20
23
|
- Gemfile
|
21
24
|
- Gemfile.lock
|
22
25
|
- README.md
|
@@ -24,6 +27,7 @@ files:
|
|
24
27
|
- authz_jurnal_client-0.0.1.gem
|
25
28
|
- authz_jurnal_client-0.0.2.gem
|
26
29
|
- authz_jurnal_client-0.0.3.gem
|
30
|
+
- authz_jurnal_client-0.0.4.gem
|
27
31
|
- lib/authz_jurnal_client.rb
|
28
32
|
- lib/authz_jurnal_client/version.rb
|
29
33
|
- lib/sig/authz_jurnal_client.rbs
|