dock-api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/build.yml +11 -0
- data/.github/workflows/scheduled_build.yml +14 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +86 -0
- data/LICENSE.txt +21 -0
- data/README.md +124 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/dock-api.gemspec +34 -0
- data/lib/dock/api/configuration.rb +20 -0
- data/lib/dock/api/endpoints/anchors.rb +27 -0
- data/lib/dock/api/endpoints/base.rb +29 -0
- data/lib/dock/api/endpoints/credentials.rb +23 -0
- data/lib/dock/api/endpoints/dids.rb +31 -0
- data/lib/dock/api/endpoints/jobs.rb +15 -0
- data/lib/dock/api/endpoints/presentations.rb +15 -0
- data/lib/dock/api/endpoints/profiles.rb +31 -0
- data/lib/dock/api/endpoints/registries.rb +35 -0
- data/lib/dock/api/endpoints/revocation_status.rb +15 -0
- data/lib/dock/api/endpoints/schemas.rb +23 -0
- data/lib/dock/api/endpoints/verify.rb +15 -0
- data/lib/dock/api/version.rb +7 -0
- data/lib/dock/api.rb +48 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2b2d8dbfadbcc5cfb8a38a080f8ab47689fe0de13a108f95ce1560735672f90d
|
4
|
+
data.tar.gz: '0460937cfd6cd14517ccbc4f4633bb6e9039d0205788e7d1321f0ea16fd3fdc4'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: da2480f9b19c951e0ddc93e76781dbc347c8c2978430b5bdfe2e0c5f1b4c703e76abafb7f7b5e2f94e8156d1bf821d9c07716979168b6b64160672110dfe8576
|
7
|
+
data.tar.gz: 3f2232e85226c00be8909173db6406ece2d430b11d0da51dc23b9abed674bbbf0807045c56eed7ca761840f1980621f30c198a645c26bd44a00f890326262d68
|
@@ -0,0 +1,11 @@
|
|
1
|
+
name: Build
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
steps:
|
7
|
+
- uses: actions/checkout@v2
|
8
|
+
- uses: ruby/setup-ruby@v1
|
9
|
+
with:
|
10
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
11
|
+
- run: DOCK_API_TOKEN=${{ secrets.DOCK_API_TOKEN }} bundle exec rspec
|
@@ -0,0 +1,14 @@
|
|
1
|
+
name: Scheduled Build
|
2
|
+
on:
|
3
|
+
schedule:
|
4
|
+
- cron: "15 0 * * *"
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
14
|
+
- run: VCR=all DOCK_API_TOKEN=${{ secrets.DOCK_API_TOKEN }} bundle exec rspec
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.7.1
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in dock-api.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem 'pry'
|
9
|
+
gem 'rake', '~> 12.0'
|
10
|
+
gem 'rspec', '~> 3.0'
|
11
|
+
gem 'rspec-retry'
|
12
|
+
gem 'rubocop'
|
13
|
+
gem 'rubocop-rake'
|
14
|
+
gem 'rubocop-rspec'
|
15
|
+
gem 'vcr'
|
16
|
+
gem 'yard'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
dock-api (0.1.0)
|
5
|
+
faraday (>= 2.0.0.alpha.pre.4)
|
6
|
+
httpx (>= 0.18)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ast (2.4.2)
|
12
|
+
coderay (1.1.3)
|
13
|
+
diff-lcs (1.4.4)
|
14
|
+
faraday (2.0.0.alpha.pre.4)
|
15
|
+
multipart-post (>= 1.2, < 3)
|
16
|
+
ruby2_keywords (>= 0.0.4)
|
17
|
+
http-2-next (0.5.0)
|
18
|
+
httpx (0.18.3)
|
19
|
+
http-2-next (>= 0.4.1)
|
20
|
+
method_source (1.0.0)
|
21
|
+
multipart-post (2.1.1)
|
22
|
+
parallel (1.21.0)
|
23
|
+
parser (3.1.0.0)
|
24
|
+
ast (~> 2.4.1)
|
25
|
+
pry (0.14.1)
|
26
|
+
coderay (~> 1.1)
|
27
|
+
method_source (~> 1.0)
|
28
|
+
rainbow (3.0.0)
|
29
|
+
rake (12.3.3)
|
30
|
+
regexp_parser (2.2.0)
|
31
|
+
rexml (3.2.5)
|
32
|
+
rspec (3.10.0)
|
33
|
+
rspec-core (~> 3.10.0)
|
34
|
+
rspec-expectations (~> 3.10.0)
|
35
|
+
rspec-mocks (~> 3.10.0)
|
36
|
+
rspec-core (3.10.1)
|
37
|
+
rspec-support (~> 3.10.0)
|
38
|
+
rspec-expectations (3.10.1)
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
+
rspec-support (~> 3.10.0)
|
41
|
+
rspec-mocks (3.10.2)
|
42
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
+
rspec-support (~> 3.10.0)
|
44
|
+
rspec-retry (0.6.2)
|
45
|
+
rspec-core (> 3.3)
|
46
|
+
rspec-support (3.10.3)
|
47
|
+
rubocop (1.24.1)
|
48
|
+
parallel (~> 1.10)
|
49
|
+
parser (>= 3.0.0.0)
|
50
|
+
rainbow (>= 2.2.2, < 4.0)
|
51
|
+
regexp_parser (>= 1.8, < 3.0)
|
52
|
+
rexml
|
53
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
54
|
+
ruby-progressbar (~> 1.7)
|
55
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
56
|
+
rubocop-ast (1.15.1)
|
57
|
+
parser (>= 3.0.1.1)
|
58
|
+
rubocop-rake (0.6.0)
|
59
|
+
rubocop (~> 1.0)
|
60
|
+
rubocop-rspec (2.7.0)
|
61
|
+
rubocop (~> 1.19)
|
62
|
+
ruby-progressbar (1.11.0)
|
63
|
+
ruby2_keywords (0.0.5)
|
64
|
+
unicode-display_width (2.1.0)
|
65
|
+
vcr (6.0.0)
|
66
|
+
webrick (1.7.0)
|
67
|
+
yard (0.9.27)
|
68
|
+
webrick (~> 1.7.0)
|
69
|
+
|
70
|
+
PLATFORMS
|
71
|
+
ruby
|
72
|
+
|
73
|
+
DEPENDENCIES
|
74
|
+
dock-api!
|
75
|
+
pry
|
76
|
+
rake (~> 12.0)
|
77
|
+
rspec (~> 3.0)
|
78
|
+
rspec-retry
|
79
|
+
rubocop
|
80
|
+
rubocop-rake
|
81
|
+
rubocop-rspec
|
82
|
+
vcr
|
83
|
+
yard
|
84
|
+
|
85
|
+
BUNDLED WITH
|
86
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Robin Bortlik
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
[![Build](https://github.com/robinbortlik/dock-api/actions/workflows/build.yml/badge.svg)](https://github.com/robinbortlik/dock-api/actions/workflows/build.yml)
|
2
|
+
[![Scheduled Build](https://github.com/robinbortlik/dock-api/actions/workflows/scheduled_build.yml/badge.svg)](https://github.com/robinbortlik/dock-api/actions/workflows/scheduled_build.yml)
|
3
|
+
|
4
|
+
# dock-api
|
5
|
+
|
6
|
+
Ruby client for [Dock network](https://dock.io/) API .
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'dock-api'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
```bash
|
18
|
+
$ bundle install
|
19
|
+
```
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
```bash
|
23
|
+
$ gem install dock-api
|
24
|
+
```
|
25
|
+
|
26
|
+
## Configuration
|
27
|
+
|
28
|
+
In order to connect to dock API you firs need to generate API token, which can be done on https://console.api.dock.io/ .
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
Dock::Api.configure do |conf|
|
32
|
+
conf.auth_token = ENV.fetch("DOCK_API_TOKEN")
|
33
|
+
conf.host = "https://api.dock.io"
|
34
|
+
conf.log_requests = true # useful for debugging
|
35
|
+
conf.request_retry_count = 3 # default 1
|
36
|
+
end
|
37
|
+
|
38
|
+
```
|
39
|
+
|
40
|
+
### Usage
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
# Anchors
|
44
|
+
|
45
|
+
Dock::Api::Anchors.list
|
46
|
+
Dock::Api::Anchors.find
|
47
|
+
Dock::Api::Anchors.create
|
48
|
+
Dock::Api::Anchors.verify
|
49
|
+
|
50
|
+
# Credentials
|
51
|
+
|
52
|
+
Dock::Api::Credentials.find
|
53
|
+
Dock::Api::Credentials.destroy
|
54
|
+
Dock::Api::Credentials.create
|
55
|
+
|
56
|
+
# Dids
|
57
|
+
|
58
|
+
Dock::Api::Dids.list
|
59
|
+
Dock::Api::Dids.find
|
60
|
+
Dock::Api::Dids.create
|
61
|
+
Dock::Api::Dids.update
|
62
|
+
Dock::Api::Dids.destroy
|
63
|
+
|
64
|
+
# Jobs
|
65
|
+
|
66
|
+
Dock::Api::Jobs.find
|
67
|
+
|
68
|
+
# Presentations
|
69
|
+
|
70
|
+
Dock::Api::Presentations.create
|
71
|
+
|
72
|
+
# Profiles
|
73
|
+
|
74
|
+
Dock::Api::Profiles.list
|
75
|
+
Dock::Api::Profiles.find
|
76
|
+
Dock::Api::Profiles.create
|
77
|
+
Dock::Api::Profiles.update
|
78
|
+
Dock::Api::Profiles.destroy
|
79
|
+
|
80
|
+
# Registries
|
81
|
+
|
82
|
+
Dock::Api::Registries.list
|
83
|
+
Dock::Api::Registries.find
|
84
|
+
Dock::Api::Registries.create
|
85
|
+
Dock::Api::Registries.destroy
|
86
|
+
Dock::Api::Registries.revoke
|
87
|
+
Dock::Api::Registries.unrevoke
|
88
|
+
|
89
|
+
# RevocationStatus
|
90
|
+
|
91
|
+
Dock::Api::RevocationStatus.find
|
92
|
+
|
93
|
+
# Schemas
|
94
|
+
|
95
|
+
Dock::Api::Schemas.list
|
96
|
+
Dock::Api::Schemas.find
|
97
|
+
Dock::Api::Schemas.create
|
98
|
+
|
99
|
+
# Verify
|
100
|
+
|
101
|
+
Dock::Api::Verify.verify
|
102
|
+
```
|
103
|
+
|
104
|
+
### Documentations
|
105
|
+
|
106
|
+
Official Dock API documentation: https://docs.api.dock.io/#the-dock-api
|
107
|
+
|
108
|
+
Swagger console: https://swagger.api.dock.io/
|
109
|
+
|
110
|
+
|
111
|
+
### Development
|
112
|
+
|
113
|
+
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.
|
114
|
+
|
115
|
+
To install this gem onto 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
116
|
+
|
117
|
+
## Contributing
|
118
|
+
|
119
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/robinbortlik/dock-api.
|
120
|
+
|
121
|
+
|
122
|
+
## License
|
123
|
+
|
124
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'dock/api'
|
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/setup
ADDED
data/dock-api.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/dock/api/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'dock-api'
|
7
|
+
spec.version = Dock::Api::VERSION
|
8
|
+
spec.authors = ['Robin Bortlik']
|
9
|
+
spec.email = ['robinbortlik@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'Ruby client for Dock network API'
|
12
|
+
# spec.description = %q{Write a longer description or delete this line.}
|
13
|
+
spec.homepage = 'https://github.com/robinbortlik/dock-api'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
16
|
+
|
17
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
|
18
|
+
|
19
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
+
spec.metadata['source_code_uri'] = 'https://github.com/robinbortlik/dock-api'
|
21
|
+
# spec.metadata["changelog_uri"] = "Put your gem's CHANGELOG.md URL here."
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
|
+
end
|
28
|
+
spec.bindir = 'exe'
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ['lib']
|
31
|
+
|
32
|
+
spec.add_dependency 'faraday', '>= 2.0.0.alpha.pre.4'
|
33
|
+
spec.add_dependency 'httpx', '>= 0.18'
|
34
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dock
|
4
|
+
module Api
|
5
|
+
class Configuration
|
6
|
+
attr_accessor :auth_token, :host, :log_requests, :request_retry_count
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@auth_token = nil
|
10
|
+
@host = nil
|
11
|
+
@log_requests = nil
|
12
|
+
@request_retry_count = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def request_retry_count
|
16
|
+
@request_retry_count || 1
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dock
|
4
|
+
module Api
|
5
|
+
class Anchors < Dock::Api::Base
|
6
|
+
NAMESPACE = '/anchors'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def list
|
10
|
+
get(NAMESPACE)
|
11
|
+
end
|
12
|
+
|
13
|
+
def find(id)
|
14
|
+
get("#{NAMESPACE}/#{id}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def create(attrs = {})
|
18
|
+
post(NAMESPACE, attrs)
|
19
|
+
end
|
20
|
+
|
21
|
+
def verify(attrs = {})
|
22
|
+
post("#{NAMESPACE}/verify", attrs)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dock
|
4
|
+
module Api
|
5
|
+
class Base
|
6
|
+
class << self
|
7
|
+
def connection
|
8
|
+
Dock::Api.connection
|
9
|
+
end
|
10
|
+
|
11
|
+
def get(url)
|
12
|
+
connection.get(url).body
|
13
|
+
end
|
14
|
+
|
15
|
+
def delete(url)
|
16
|
+
connection.delete(url).body
|
17
|
+
end
|
18
|
+
|
19
|
+
def post(url, data)
|
20
|
+
connection.post(url, data).body
|
21
|
+
end
|
22
|
+
|
23
|
+
def patch(url, data)
|
24
|
+
connection.patch(url, data).body
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dock
|
4
|
+
module Api
|
5
|
+
class Credentials < Dock::Api::Base
|
6
|
+
NAMESPACE = '/credentials'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def find(id)
|
10
|
+
get("#{NAMESPACE}/#{id}")
|
11
|
+
end
|
12
|
+
|
13
|
+
def destroy(id)
|
14
|
+
delete("#{NAMESPACE}/#{id}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def create(attrs = {})
|
18
|
+
post(NAMESPACE, attrs)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dock
|
4
|
+
module Api
|
5
|
+
class Dids < Dock::Api::Base
|
6
|
+
NAMESPACE = '/dids'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def list
|
10
|
+
get(NAMESPACE)
|
11
|
+
end
|
12
|
+
|
13
|
+
def find(id)
|
14
|
+
get("#{NAMESPACE}/#{id}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def destroy(id)
|
18
|
+
delete("#{NAMESPACE}/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def create(attrs = {})
|
22
|
+
post(NAMESPACE, attrs)
|
23
|
+
end
|
24
|
+
|
25
|
+
def update(id, attrs = {})
|
26
|
+
patch("#{NAMESPACE}/#{id}", attrs)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dock
|
4
|
+
module Api
|
5
|
+
class Profiles < Dock::Api::Base
|
6
|
+
NAMESPACE = '/profiles'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def list
|
10
|
+
get(NAMESPACE)
|
11
|
+
end
|
12
|
+
|
13
|
+
def find(id)
|
14
|
+
get("#{NAMESPACE}/#{id}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def destroy(id)
|
18
|
+
delete("#{NAMESPACE}/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def create(attrs = {})
|
22
|
+
post(NAMESPACE, attrs)
|
23
|
+
end
|
24
|
+
|
25
|
+
def update(id, attrs = {})
|
26
|
+
patch("#{NAMESPACE}/#{id}", attrs)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dock
|
4
|
+
module Api
|
5
|
+
class Registries < Dock::Api::Base
|
6
|
+
NAMESPACE = '/registries'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def list
|
10
|
+
get(NAMESPACE)
|
11
|
+
end
|
12
|
+
|
13
|
+
def find(id)
|
14
|
+
get("#{NAMESPACE}/#{id}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def destroy(id)
|
18
|
+
delete("#{NAMESPACE}/#{id}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def create(attrs = {})
|
22
|
+
post(NAMESPACE, attrs)
|
23
|
+
end
|
24
|
+
|
25
|
+
def revoke(id, credential_ids:)
|
26
|
+
post("#{NAMESPACE}/#{id}", action: :revoke, credentialIds: credential_ids)
|
27
|
+
end
|
28
|
+
|
29
|
+
def unrevoke(id, credential_ids:)
|
30
|
+
post("#{NAMESPACE}/#{id}", action: :unrevoke, credentialIds: credential_ids)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dock
|
4
|
+
module Api
|
5
|
+
class RevocationStatus < Dock::Api::Base
|
6
|
+
NAMESPACE = '/revocationStatus'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def find(reg_id:, rev_id:)
|
10
|
+
get("#{NAMESPACE}/#{reg_id}/#{rev_id}")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dock
|
4
|
+
module Api
|
5
|
+
class Schemas < Dock::Api::Base
|
6
|
+
NAMESPACE = '/schemas'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def list
|
10
|
+
get(NAMESPACE)
|
11
|
+
end
|
12
|
+
|
13
|
+
def find(id)
|
14
|
+
get("#{NAMESPACE}/#{id}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def create(attrs = {})
|
18
|
+
post(NAMESPACE, attrs)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/dock/api.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# require "dock/api/version"
|
4
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
+
|
6
|
+
require 'httpx'
|
7
|
+
require 'httpx/adapters/faraday'
|
8
|
+
require 'faraday'
|
9
|
+
require 'api/configuration'
|
10
|
+
require 'api/endpoints/base'
|
11
|
+
require 'api/endpoints/anchors'
|
12
|
+
require 'api/endpoints/credentials'
|
13
|
+
require 'api/endpoints/dids'
|
14
|
+
require 'api/endpoints/jobs'
|
15
|
+
require 'api/endpoints/presentations'
|
16
|
+
require 'api/endpoints/profiles'
|
17
|
+
require 'api/endpoints/registries'
|
18
|
+
require 'api/endpoints/revocation_status'
|
19
|
+
require 'api/endpoints/schemas'
|
20
|
+
require 'api/endpoints/verify'
|
21
|
+
|
22
|
+
module Dock
|
23
|
+
module Api
|
24
|
+
class Error < StandardError; end
|
25
|
+
|
26
|
+
class << self
|
27
|
+
def config
|
28
|
+
@config ||= Configuration.new
|
29
|
+
end
|
30
|
+
|
31
|
+
def configure
|
32
|
+
yield(config)
|
33
|
+
end
|
34
|
+
|
35
|
+
def connection
|
36
|
+
@conn ||= Faraday.new(url: config.host) do |f|
|
37
|
+
f.adapter :httpx
|
38
|
+
f.request :json
|
39
|
+
f.request :url_encoded
|
40
|
+
f.request :retry, max: config.request_retry_count
|
41
|
+
f.request :authorization, 'Bearer', config.auth_token
|
42
|
+
f.response :json
|
43
|
+
f.response :logger if config.log_requests
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dock-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Robin Bortlik
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-01-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.0.alpha.pre.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.0.alpha.pre.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: httpx
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.18'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.18'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- robinbortlik@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".github/workflows/build.yml"
|
49
|
+
- ".github/workflows/scheduled_build.yml"
|
50
|
+
- ".gitignore"
|
51
|
+
- ".rspec"
|
52
|
+
- ".ruby-version"
|
53
|
+
- Gemfile
|
54
|
+
- Gemfile.lock
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- bin/console
|
59
|
+
- bin/setup
|
60
|
+
- dock-api.gemspec
|
61
|
+
- lib/dock/api.rb
|
62
|
+
- lib/dock/api/configuration.rb
|
63
|
+
- lib/dock/api/endpoints/anchors.rb
|
64
|
+
- lib/dock/api/endpoints/base.rb
|
65
|
+
- lib/dock/api/endpoints/credentials.rb
|
66
|
+
- lib/dock/api/endpoints/dids.rb
|
67
|
+
- lib/dock/api/endpoints/jobs.rb
|
68
|
+
- lib/dock/api/endpoints/presentations.rb
|
69
|
+
- lib/dock/api/endpoints/profiles.rb
|
70
|
+
- lib/dock/api/endpoints/registries.rb
|
71
|
+
- lib/dock/api/endpoints/revocation_status.rb
|
72
|
+
- lib/dock/api/endpoints/schemas.rb
|
73
|
+
- lib/dock/api/endpoints/verify.rb
|
74
|
+
- lib/dock/api/version.rb
|
75
|
+
homepage: https://github.com/robinbortlik/dock-api
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata:
|
79
|
+
allowed_push_host: https://rubygems.org/
|
80
|
+
homepage_uri: https://github.com/robinbortlik/dock-api
|
81
|
+
source_code_uri: https://github.com/robinbortlik/dock-api
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 2.3.0
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubygems_version: 3.1.2
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Ruby client for Dock network API
|
101
|
+
test_files: []
|