innox 2.7.6

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.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/.drone.yml +29 -0
  3. data/.gitattributes +2 -0
  4. data/.gitignore +16 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +148 -0
  7. data/.simplecov +17 -0
  8. data/.travis.yml +18 -0
  9. data/Gemfile +8 -0
  10. data/Gemfile.lock +190 -0
  11. data/README.md +25 -0
  12. data/Rakefile +6 -0
  13. data/bin/console +14 -0
  14. data/bin/innox +12 -0
  15. data/bin/setup +8 -0
  16. data/checksums.yaml +7 -0
  17. data/innox.gemspec +52 -0
  18. data/lib/innox/adapter_registry.rb +25 -0
  19. data/lib/innox/auth/error.rb +18 -0
  20. data/lib/innox/auth/jwt_authenticator.rb +127 -0
  21. data/lib/innox/block.rb +27 -0
  22. data/lib/innox/blockchain/abstract.rb +159 -0
  23. data/lib/innox/blockchain/error.rb +37 -0
  24. data/lib/innox/blockchain/registry.rb +16 -0
  25. data/lib/innox/command/base.rb +11 -0
  26. data/lib/innox/command/db.rb +20 -0
  27. data/lib/innox/command/inject.rb +13 -0
  28. data/lib/innox/command/root.rb +14 -0
  29. data/lib/innox/command/security.rb +29 -0
  30. data/lib/innox/command/service.rb +40 -0
  31. data/lib/innox/error.rb +18 -0
  32. data/lib/innox/executor.rb +64 -0
  33. data/lib/innox/injectors/innox_events.rb +240 -0
  34. data/lib/innox/logger.rb +39 -0
  35. data/lib/innox/metrics/server.rb +15 -0
  36. data/lib/innox/mq/client.rb +51 -0
  37. data/lib/innox/ranger/connection.rb +117 -0
  38. data/lib/innox/ranger/events.rb +11 -0
  39. data/lib/innox/ranger/router.rb +234 -0
  40. data/lib/innox/ranger/web_socket.rb +68 -0
  41. data/lib/innox/security/key_generator.rb +26 -0
  42. data/lib/innox/sql/client.rb +19 -0
  43. data/lib/innox/sql/schema.rb +72 -0
  44. data/lib/innox/transaction.rb +136 -0
  45. data/lib/innox/upstream/base.rb +116 -0
  46. data/lib/innox/upstream/registry.rb +14 -0
  47. data/lib/innox/version.rb +3 -0
  48. data/lib/innox/wallet/abstract.rb +188 -0
  49. data/lib/innox/wallet/error.rb +37 -0
  50. data/lib/innox/wallet/registry.rb +16 -0
  51. data/lib/innox.rb +47 -0
  52. data/metadata +463 -0
  53. metadata +465 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 62ced6fcbe1392ff255590b92a7c7b6800c34ef50d9eb58bacb4544bb53ad06a
4
+ data.tar.gz: c2b21382fab6a3051607f6e33fa02a698d061919cb5b4996476ad520bdd4c9f5
5
+ SHA512:
6
+ metadata.gz: 387425a585f415bb0b11c33c32be0cf3a8c24e4c377e55446d49a50e5c262d52e886bf09257ce626552ab28402752ef2de066025e69a34e006f179512666b924
7
+ data.tar.gz: ed3ecb2532d0268c25734294c611a531fad1c737522720590930bca8601c17a7fe48a0271e24f1e28ba303f3d4f3d0f5afe18bf3468443bfb1b4cbb81835cddb
data/.drone.yml ADDED
@@ -0,0 +1,29 @@
1
+ ---
2
+ kind: pipeline
3
+ name: default
4
+
5
+ steps:
6
+ - name: Run rspec for each library
7
+ image: ruby:2.6
8
+ commands:
9
+ - bundle install
10
+ - bundle exec rspec
11
+
12
+ - name: Release gems
13
+ image: ruby:2.6
14
+ environment:
15
+ GEM_CREDENTIALS:
16
+ from_secret: gem_credentials
17
+ commands:
18
+ - mkdir -p ~/.gem
19
+ - echo $GEM_CREDENTIALS | base64 -d > ~/.gem/credentials
20
+ - chmod 0600 ~/.gem/credentials
21
+ - gem build innox.gemspec
22
+ - gem push innox-*.gem
23
+ when:
24
+ branch:
25
+ - master
26
+
27
+ trigger:
28
+ event:
29
+ - push
data/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /*.gem
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+
14
+ # Ignore RubyMine files
15
+ .idea
16
+ /secrets
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,148 @@
1
+ # Commonly used screens these days easily fit more than 80 characters.
2
+ Metrics/LineLength:
3
+ Max: 120
4
+
5
+ # Too short methods lead to extraction of single-use methods, which can make
6
+ # the code easier to read (by naming things), but can also clutter the class
7
+ Metrics/MethodLength:
8
+ Max: 20
9
+
10
+ # The guiding principle of classes is SRP, SRP can't be accurately measured by LoC
11
+ Metrics/ClassLength:
12
+ Max: 1500
13
+
14
+ # No space makes the method definition shorter and differentiates
15
+ # from a regular assignment.
16
+ Layout/SpaceAroundEqualsInParameterDefault:
17
+ EnforcedStyle: no_space
18
+
19
+ # Single quotes being faster is hardly measurable and only affects parse time.
20
+ # Enforcing double quotes reduces the times where you need to change them
21
+ # when introducing an interpolation. Use single quotes only if their semantics
22
+ # are needed.
23
+ Style/StringLiterals:
24
+ EnforcedStyle: double_quotes
25
+
26
+ # We do not need to support Ruby 1.9, so this is good to use.
27
+ Style/SymbolArray:
28
+ Enabled: true
29
+
30
+ # Most readable form.
31
+ Layout/AlignHash:
32
+ EnforcedHashRocketStyle: table
33
+ EnforcedColonStyle: table
34
+
35
+ # Mixing the styles looks just silly.
36
+ Style/HashSyntax:
37
+ EnforcedStyle: ruby19_no_mixed_keys
38
+
39
+ # has_key? and has_value? are far more readable than key? and value?
40
+ Style/PreferredHashMethods:
41
+ Enabled: false
42
+
43
+ # String#% is by far the least verbose and only object oriented variant.
44
+ Style/FormatString:
45
+ EnforcedStyle: percent
46
+
47
+ Style/CollectionMethods:
48
+ Enabled: true
49
+ PreferredMethods:
50
+ # inject seems more common in the community.
51
+ reduce: "inject"
52
+
53
+
54
+ # Either allow this style or don't. Marking it as safe with parenthesis
55
+ # is silly. Let's try to live without them for now.
56
+ Style/ParenthesesAroundCondition:
57
+ AllowSafeAssignment: false
58
+ Lint/AssignmentInCondition:
59
+ AllowSafeAssignment: false
60
+
61
+ # A specialized exception class will take one or more arguments and construct the message from it.
62
+ # So both variants make sense.
63
+ Style/RaiseArgs:
64
+ Enabled: false
65
+
66
+ # Indenting the chained dots beneath each other is not supported by this cop,
67
+ # see https://github.com/bbatsov/rubocop/issues/1633
68
+ Layout/MultilineOperationIndentation:
69
+ Enabled: false
70
+
71
+ # Fail is an alias of raise. Avoid aliases, it's more cognitive load for no gain.
72
+ # The argument that fail should be used to abort the program is wrong too,
73
+ # there's Kernel#abort for that.
74
+ Style/SignalException:
75
+ EnforcedStyle: only_raise
76
+
77
+ # Suppressing exceptions can be perfectly fine, and be it to avoid to
78
+ # explicitly type nil into the rescue since that's what you want to return,
79
+ # or suppressing LoadError for optional dependencies
80
+ Lint/HandleExceptions:
81
+ Enabled: false
82
+
83
+ Layout/SpaceInsideBlockBraces:
84
+ # The space here provides no real gain in readability while consuming
85
+ # horizontal space that could be used for a better parameter name.
86
+ # Also {| differentiates better from a hash than { | does.
87
+ SpaceBeforeBlockParameters: false
88
+
89
+ # No trailing space differentiates better from the block:
90
+ # foo} means hash, foo } means block.
91
+ Layout/SpaceInsideHashLiteralBraces:
92
+ EnforcedStyle: no_space
93
+
94
+ # { ... } for multi-line blocks is okay, follow Weirichs rule instead:
95
+ # https://web.archive.org/web/20140221124509/http://onestepback.org/index.cgi/Tech/Ruby/BraceVsDoEnd.rdoc
96
+ Style/BlockDelimiters:
97
+ Enabled: false
98
+
99
+ # do / end blocks should be used for side effects,
100
+ # methods that run a block for side effects and have
101
+ # a useful return value are rare, assign the return
102
+ # value to a local variable for those cases.
103
+ Style/MethodCalledOnDoEndBlock:
104
+ Enabled: true
105
+
106
+ # Enforcing the names of variables? To single letter ones? Just no.
107
+ Style/SingleLineBlockParams:
108
+ Enabled: false
109
+
110
+ # Shadowing outer local variables with block parameters is often useful
111
+ # to not reinvent a new name for the same thing, it highlights the relation
112
+ # between the outer variable and the parameter. The cases where it's actually
113
+ # confusing are rare, and usually bad for other reasons already, for example
114
+ # because the method is too long.
115
+ Lint/ShadowingOuterLocalVariable:
116
+ Enabled: false
117
+
118
+ # Check with yard instead.
119
+ Style/Documentation:
120
+ Enabled: false
121
+
122
+ # This is just silly. Calling the argument `other` in all cases makes no sense.
123
+ Naming/BinaryOperatorParameterName:
124
+ Enabled: false
125
+
126
+ # There are valid cases, for example debugging Cucumber steps,
127
+ # also they'll fail CI anyway
128
+ Lint/Debugger:
129
+ Enabled: false
130
+
131
+ # Style preference
132
+ Style/MethodDefParentheses:
133
+ Enabled: false
134
+
135
+ Style/TrailingCommaInArrayLiteral:
136
+ Enabled: false
137
+
138
+ Style/TrailingCommaInHashLiteral:
139
+ Enabled: false
140
+
141
+ Style/ClassAndModuleChildren:
142
+ EnforcedStyle: compact
143
+
144
+ Layout/IndentHeredoc:
145
+ Enabled: false
146
+
147
+ Style/MethodCallWithoutArgsParentheses:
148
+ Enabled: false
data/.simplecov ADDED
@@ -0,0 +1,17 @@
1
+ # -*- ruby -*-
2
+ require 'simplecov-json'
3
+
4
+ SimpleCov.start do
5
+ add_filter '/spec/'
6
+ end
7
+
8
+ SimpleCov.formatters = [
9
+ SimpleCov::Formatter::HTMLFormatter,
10
+ SimpleCov::Formatter::JSONFormatter,
11
+ ]
12
+
13
+ # save to CircleCI's artifacts directory if we're on CircleCI
14
+ if ENV['CIRCLE_ARTIFACTS']
15
+ dir = File.join(ENV['CIRCLE_ARTIFACTS'], "coverage")
16
+ SimpleCov.coverage_dir(dir)
17
+ end
data/.travis.yml ADDED
@@ -0,0 +1,18 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.5.1
6
+ - 2.5.3
7
+ before_install: gem install bundler -v 1.17.3
8
+ env:
9
+ - WEBSOCKET_HOST: localhost
10
+ WEBSOCKET_PORT: 8081
11
+ deploy:
12
+ provider: rubygems
13
+ api_key:
14
+ secure: mIDOQajdA7s3SfY8j4I6Lr2YuZQ0fSX0GsU27hpsGTv7ccWnG0FcBTKt7olabaRogmLHmtLN4Ud7oLKdcMwlwpOd6QC7v5z0rK/LDzrjYcRtnLUqKnthguvxrt9F0EG+AlfrFcexcPh4JqCWtHkEV/kJoUMErJUSdNqtEjy/lBdK2rnFzU/vr264zGnQF+rvjzp9+ispkzF81l0K/EVtjmCAFsLrBZePqEUikOJmlwwZozkVCybMgCFxJZ0rx84Yq3WcPXkGcE/CMQ0/SmckTI0dk8faYqyzwQcC239cVsSUXRYYSXifyQQUYJE4pXEnQ/P1RhydeRDLXyqe8cnCzmg6yId5TLY3dOo9esC8wptkshNnlob/228F2wmsKyc6qFf2qRRgFG2zIXlPckZdVsQbviyMeD/CaZCRXwbouIGBcFTLJXxlDep5m6Z77ibxr+0Lih6jh/szICAi3QGw0okM4XWGZyVVX254L/Mr+qzXi/v7HyMi76OFRw8fRTfGVXX8oPjgpT2ayW+S3ynm1vMtQjA2yt1As70piIRyPQ1wfEhJ+1G/x1m76jv+gcjmK/XKfvIrEkQKuaKTNTFp0NCgvliXV3P55nELZ54yu1kBtRp1VeSipegAdDE/4Y0I2W0ANdAGcA2BR9tuNYzHtdvQfCVGlkvjB3JD2muSbQI=
15
+ gem: innox
16
+ true:
17
+ tags: true
18
+ repo: vitalspec/innox-core
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in innox.gemspec
8
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,190 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ innox (2.7.6)
5
+ activemodel (> 5.2, <= 6.0.0)
6
+ amqp
7
+ bunny
8
+ clamp
9
+ em-synchrony (~> 1.0)
10
+ em-websocket
11
+ eventmachine
12
+ faraday_middleware (~> 0.13.1)
13
+ faye (~> 1.2)
14
+ jwt
15
+ mysql2
16
+ prometheus-client
17
+ thin
18
+
19
+ GEM
20
+ remote: https://rubygems.org/
21
+ specs:
22
+ activemodel (6.0.0)
23
+ activesupport (= 6.0.0)
24
+ activesupport (6.0.0)
25
+ concurrent-ruby (~> 1.0, >= 1.0.2)
26
+ i18n (>= 0.7, < 2)
27
+ minitest (~> 5.1)
28
+ tzinfo (~> 1.1)
29
+ zeitwerk (~> 2.1, >= 2.1.8)
30
+ addressable (2.8.0)
31
+ public_suffix (>= 2.0.2, < 5.0)
32
+ amq-protocol (2.3.1)
33
+ amqp (1.8.0)
34
+ amq-protocol (>= 2.2.0)
35
+ eventmachine
36
+ ast (2.4.0)
37
+ bump (0.9.0)
38
+ bunny (2.15.0)
39
+ amq-protocol (~> 2.3, >= 2.3.1)
40
+ bunny-mock (1.7.0)
41
+ bunny (>= 1.7)
42
+ byebug (11.1.3)
43
+ clamp (1.3.2)
44
+ coderay (1.1.3)
45
+ concurrent-ruby (1.1.6)
46
+ cookiejar (0.3.3)
47
+ daemons (1.4.0)
48
+ diff-lcs (1.3)
49
+ docile (1.3.2)
50
+ em-http-request (1.1.7)
51
+ addressable (>= 2.3.4)
52
+ cookiejar (!= 0.3.1)
53
+ em-socksify (>= 0.3)
54
+ eventmachine (>= 1.0.3)
55
+ http_parser.rb (>= 0.6.0)
56
+ em-socksify (0.3.2)
57
+ eventmachine (>= 1.0.0.beta.4)
58
+ em-spec (0.2.7)
59
+ eventmachine
60
+ em-synchrony (1.0.6)
61
+ eventmachine (>= 1.0.0.beta.1)
62
+ em-websocket (0.5.2)
63
+ eventmachine (>= 0.12.9)
64
+ http_parser.rb (~> 0.6.0)
65
+ em-websocket-client (0.1.2)
66
+ eventmachine
67
+ websocket
68
+ eventmachine (1.2.7)
69
+ faraday (0.17.4)
70
+ multipart-post (>= 1.2, < 3)
71
+ faraday_middleware (0.13.1)
72
+ faraday (>= 0.7.4, < 1.0)
73
+ faye (1.4.0)
74
+ cookiejar (>= 0.3.0)
75
+ em-http-request (>= 1.1.6)
76
+ eventmachine (>= 0.12.0)
77
+ faye-websocket (>= 0.11.0)
78
+ multi_json (>= 1.0.0)
79
+ rack (>= 1.0.0)
80
+ websocket-driver (>= 0.5.1)
81
+ faye-websocket (0.11.1)
82
+ eventmachine (>= 0.12.0)
83
+ websocket-driver (>= 0.5.1)
84
+ http_parser.rb (0.6.0)
85
+ i18n (1.8.3)
86
+ concurrent-ruby (~> 1.0)
87
+ io-console (0.5.6)
88
+ irb (1.2.4)
89
+ reline (>= 0.0.1)
90
+ jaro_winkler (1.5.4)
91
+ json (2.3.0)
92
+ jwt (2.2.3)
93
+ method_source (1.0.0)
94
+ minitest (5.14.1)
95
+ multi_json (1.15.0)
96
+ multipart-post (2.1.1)
97
+ mysql2 (0.5.3)
98
+ parallel (1.19.1)
99
+ parser (2.7.1.3)
100
+ ast (~> 2.4.0)
101
+ prometheus-client (2.1.0)
102
+ pry (0.13.1)
103
+ coderay (~> 1.1)
104
+ method_source (~> 1.0)
105
+ pry-byebug (3.9.0)
106
+ byebug (~> 11.0)
107
+ pry (~> 0.13.0)
108
+ public_suffix (4.0.6)
109
+ rack (2.2.2)
110
+ rainbow (3.0.0)
111
+ rake (13.0.1)
112
+ reline (0.1.4)
113
+ io-console (~> 0.5)
114
+ rexml (3.2.4)
115
+ rspec (3.9.0)
116
+ rspec-core (~> 3.9.0)
117
+ rspec-expectations (~> 3.9.0)
118
+ rspec-mocks (~> 3.9.0)
119
+ rspec-core (3.9.2)
120
+ rspec-support (~> 3.9.3)
121
+ rspec-expectations (3.9.2)
122
+ diff-lcs (>= 1.2.0, < 2.0)
123
+ rspec-support (~> 3.9.0)
124
+ rspec-mocks (3.9.1)
125
+ diff-lcs (>= 1.2.0, < 2.0)
126
+ rspec-support (~> 3.9.0)
127
+ rspec-support (3.9.3)
128
+ rspec_junit_formatter (0.4.1)
129
+ rspec-core (>= 2, < 4, != 2.12.0)
130
+ rubocop (0.82.0)
131
+ jaro_winkler (~> 1.5.1)
132
+ parallel (~> 1.10)
133
+ parser (>= 2.7.0.1)
134
+ rainbow (>= 2.2.2, < 4.0)
135
+ rexml
136
+ ruby-progressbar (~> 1.7)
137
+ unicode-display_width (>= 1.4.0, < 2.0)
138
+ rubocop-github (0.16.0)
139
+ rubocop (<= 0.82.0)
140
+ rubocop-performance (~> 1.0)
141
+ rubocop-rails (~> 2.0)
142
+ rubocop-performance (1.6.1)
143
+ rubocop (>= 0.71.0)
144
+ rubocop-rails (2.6.0)
145
+ activesupport (>= 4.2.0)
146
+ rack (>= 1.1)
147
+ rubocop (>= 0.82.0)
148
+ ruby-progressbar (1.10.1)
149
+ simplecov (0.18.5)
150
+ docile (~> 1.1)
151
+ simplecov-html (~> 0.11)
152
+ simplecov-html (0.12.2)
153
+ simplecov-json (0.2.1)
154
+ json
155
+ simplecov
156
+ thin (1.8.1)
157
+ daemons (~> 1.0, >= 1.0.9)
158
+ eventmachine (~> 1.0, >= 1.0.4)
159
+ rack (>= 1, < 3)
160
+ thread_safe (0.3.6)
161
+ tzinfo (1.2.7)
162
+ thread_safe (~> 0.1)
163
+ unicode-display_width (1.7.0)
164
+ websocket (1.2.8)
165
+ websocket-driver (0.7.5)
166
+ websocket-extensions (>= 0.1.0)
167
+ websocket-extensions (0.1.5)
168
+ zeitwerk (2.3.0)
169
+
170
+ PLATFORMS
171
+ ruby
172
+
173
+ DEPENDENCIES
174
+ bump
175
+ bundler (~> 1.16)
176
+ bunny-mock
177
+ em-spec
178
+ em-websocket-client
179
+ irb
180
+ innox!
181
+ pry-byebug
182
+ rake (~> 13.0)
183
+ rspec (~> 3.0)
184
+ rspec_junit_formatter
185
+ rubocop-github
186
+ simplecov
187
+ simplecov-json
188
+
189
+ BUNDLED WITH
190
+ 1.17.3
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ Put your Ruby code in the file `lib/innox`. To experiment with that code, run `bin/console` for an interactive prompt.
2
+
3
+ TODO: Delete this and the text above, and describe your gem
4
+
5
+ ## Installation
6
+
7
+ Add this to Gemfile:
8
+
9
+ ```ruby
10
+ gem 'innox'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install innox
20
+
21
+ ## Development
22
+
23
+ To install dependencies run `bin/setup`. Then to run the tests `rake spec`. Or run `bin/console` for an interactive prompt.
24
+
25
+ To install this gem onto your local run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then `bundle exec rake release`, to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "innox"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/innox ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- RUBY -*-
3
+
4
+ INNOX_CORE = ENV["INNOX_CORE"] || File.expand_path(File.join(File.dirname(__FILE__), ".."))
5
+ $: << File.join(INNOX_CORE, "lib")
6
+
7
+ require "clamp"
8
+
9
+ require "innox"
10
+ require "innox/command/root"
11
+
12
+ Innox::Root.run
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9a111772b6f98f8e2e27dc4d3c26d815fffcc38d2d637e8e3021934d5fe77ade
4
+ data.tar.gz: 651ddb388b8ceff0efe3249e70f5edeca468255dcc06fb8f879be0543b784d1e
5
+ SHA512:
6
+ metadata.gz: a77b65e4848c9c900c7a99e412d700c7acb9b629d8ab1c5064720dc9fbecdf4e78f226350e3c529097059277417eb0b1897b55e3dc8dbfc1cad49f55f178cb49
7
+ data.tar.gz: 6cfaa859901df9e423bcf9a363d1bcfe9f548b5a1d0094da3e697ed21a77d5a1af2d54d3aa247444a7fa82866384298c2ce0c3e64ae079c63bf0df522ba4a967
data/innox.gemspec ADDED
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "innox/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "innox"
9
+ spec.version = Innox::VERSION
10
+ spec.authors = ["Vitalspec."]
11
+
12
+ spec.summary = "This is for running critical core services"
13
+ spec.description = "Gem for microservices and command line tools"
14
+ spec.homepage = "https://vitalspec.io"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
+ `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = "bin"
22
+ spec.executables = spec.files.grep(%r{^bin/}) {|f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_dependency "activemodel", "> 5.2", "<= 6.0.0"
26
+ spec.add_dependency "amqp"
27
+ spec.add_dependency "bunny"
28
+ spec.add_dependency "clamp"
29
+ spec.add_dependency "em-synchrony", "~> 1.0"
30
+ spec.add_dependency "em-websocket"
31
+ spec.add_dependency "eventmachine"
32
+ spec.add_dependency "faraday_middleware", "~> 0.13.1"
33
+ spec.add_dependency "faye", "~> 1.2"
34
+ spec.add_dependency "jwt"
35
+ spec.add_dependency "mysql2"
36
+ spec.add_dependency "prometheus-client"
37
+ spec.add_dependency "thin"
38
+
39
+ spec.add_development_dependency "bump"
40
+ spec.add_development_dependency "bundler", "~> 1.16"
41
+ spec.add_development_dependency "bunny-mock"
42
+ spec.add_development_dependency "em-spec"
43
+ spec.add_development_dependency "em-websocket-client"
44
+ spec.add_development_dependency "irb"
45
+ spec.add_development_dependency "pry-byebug"
46
+ spec.add_development_dependency "rake", "~> 13.0"
47
+ spec.add_development_dependency "rspec", "~> 3.0"
48
+ spec.add_development_dependency "rspec_junit_formatter"
49
+ spec.add_development_dependency "rubocop-github"
50
+ spec.add_development_dependency "simplecov"
51
+ spec.add_development_dependency "simplecov-json"
52
+ end
@@ -0,0 +1,25 @@
1
+ module Innox
2
+ class AdapterRegistry
3
+ Error = Class.new(StandardError)
4
+ DuplicatedAdapterError = Class.new(Error)
5
+ NotRegisteredAdapterError = Class.new(Error)
6
+
7
+ def []=(name, instance)
8
+ name = name.to_sym
9
+ raise DuplicatedAdapterError, name if adapters.key?(name)
10
+ adapters[name] = instance
11
+ end
12
+
13
+ def [](name)
14
+ adapters.fetch(name.to_sym) { raise NotRegisteredAdapterError, name }
15
+ end
16
+
17
+ def adapters
18
+ @adapters ||= {}
19
+ end
20
+
21
+ def adapters=(h)
22
+ @adapters = h
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,18 @@
1
+ module Innox::Auth
2
+ # Error repesent all errors that can be returned from Auth module.
3
+ class Error < Innox::Error
4
+ # @return [String, JWT::*] Reason store underlying reason for given error.
5
+ #
6
+ # @see https://github.com/jwt/ruby-jwt/blob/master/lib/jwt/error.rb List of JWT::* errors.
7
+ attr_reader :reason
8
+
9
+ def initialize(reason = nil)
10
+ @reason = reason
11
+
12
+ super(
13
+ code: 2001,
14
+ text: "Authorization failed".tap { |t| t << ": #{reason}" if reason },
15
+ )
16
+ end
17
+ end
18
+ end