blockfrost-ruby 0.1.0 → 0.1.1
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/.env.example +3 -0
- data/.github/workflows/nix.yaml +13 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +4 -1
- data/Gemfile +1 -1
- data/README.md +22 -13
- data/default.nix +16 -0
- data/gemset.nix +95 -0
- data/lib/blockfrost-ruby.rb +26 -0
- data/lib/blockfrostruby/constants.rb +2 -0
- data/lib/blockfrostruby/endpoints/cardano/accounts_endpoints.rb +3 -3
- data/lib/blockfrostruby/endpoints/cardano/addresses_endpoints.rb +1 -1
- data/lib/blockfrostruby/endpoints/cardano/assets_endpoints.rb +2 -3
- data/lib/blockfrostruby/endpoints/cardano/epochs_endpoints.rb +2 -3
- data/lib/blockfrostruby/version.rb +1 -1
- data/shell.nix +12 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6409f9244d146bc02002c7f9add828de36d1564fdabfdae1cc51d2016c16608
|
4
|
+
data.tar.gz: 73521600b8d9a2895333178706bd151a8c6e5f5d412a3901e067640a12913f06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21b47ca521f021b62e2afaaf3b0244b3f1c48af14c773d34875a6635b0885734ae2d5fd26dfc2f93fb00d4a55d81a66bc3b2de7c7bc20ce89c10e1949c346c8a
|
7
|
+
data.tar.gz: 9ed16e266632b2c95bbe6940e2895429cc27516cc7eca3bacadad63cdc5dccec34306a0e2462beaefb88f24a1ecac655ef9c3303bbc35bd5c73e6c2b0d5d300a
|
data/.env.example
ADDED
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,21 +1,28 @@
|
|
1
|
-
|
1
|
+
[](https://rubygems.org/gems/blockfrost-ruby) <a href="https://fivebinaries.com/"><img src="https://img.shields.io/badge/made%20by-Five%20Binaries-darkviolet.svg?style=flat-square" /></a>
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
<img src="https://blockfrost.io/images/logo.svg" width="250" align="right" height="90">
|
4
|
+
|
5
|
+
# blockfrost-ruby
|
6
|
+
|
7
|
+
<br/>
|
8
|
+
|
9
|
+
<p align="center">Ruby SDK for <a href="https://blockfrost.io">Blockfrost.io</a> API.</p>
|
10
|
+
<p align="center">
|
11
|
+
<a href="#installation">Installation</a> •
|
12
|
+
<a href="#usage">Usage</a> •
|
13
|
+
<a href="#development">Development</a>
|
14
|
+
</p>
|
15
|
+
<br>
|
9
16
|
|
10
|
-
More information about using this API can be found on https://docs.blockfrost.io/
|
11
17
|
## Installation
|
12
18
|
|
13
|
-
|
14
|
-
|
19
|
+
You can download the latest release directly from rubygems.org:
|
20
|
+
|
21
|
+
$ gem install blockfrost-ruby
|
15
22
|
|
16
|
-
To
|
23
|
+
To build the current master, download this repo to your machine, then go to the directory:
|
17
24
|
|
18
|
-
$ cd
|
25
|
+
$ cd blockfrost-ruby
|
19
26
|
|
20
27
|
And run next commands:
|
21
28
|
|
@@ -78,6 +85,8 @@ blockfrost_mainnet = Blockfrostruby::CardanoMainNet.new('your-API-key')
|
|
78
85
|
# Or if you want to access other networks:
|
79
86
|
|
80
87
|
blockfrost_testnet = Blockfrostruby::CardanoTestNet.new('your-API-key')
|
88
|
+
blockfrost_preview = Blockfrostruby::CardanoPreview.new('your-API-key')
|
89
|
+
blockfrost_preprod = Blockfrostruby::CardanoPreprod.new('your-API-key')
|
81
90
|
blockfrost_ipfs = Blockfrostruby::IPFS.new('your-API-key')
|
82
91
|
|
83
92
|
|
@@ -131,4 +140,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
131
140
|
|
132
141
|
## Contributing
|
133
142
|
|
134
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/blockfrost/
|
143
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/blockfrost/blockfrost-ruby.
|
data/default.nix
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
with import <nixpkgs> {};
|
2
|
+
let
|
3
|
+
gems = bundlerEnv {
|
4
|
+
name = "blockfrost-ruby";
|
5
|
+
inherit ruby;
|
6
|
+
gemdir = ./.;
|
7
|
+
};
|
8
|
+
in stdenv.mkDerivation {
|
9
|
+
name = "blockfrost-ruby";
|
10
|
+
src = ./.;
|
11
|
+
|
12
|
+
installPhase = ''
|
13
|
+
mkdir -p $out
|
14
|
+
cp -r $src $out
|
15
|
+
'';
|
16
|
+
}
|
data/gemset.nix
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
{
|
2
|
+
blockfrost-ruby = {
|
3
|
+
groups = ["default"];
|
4
|
+
platforms = [];
|
5
|
+
source = {
|
6
|
+
path = ./.;
|
7
|
+
type = "path";
|
8
|
+
};
|
9
|
+
version = "0.1.1";
|
10
|
+
};
|
11
|
+
diff-lcs = {
|
12
|
+
groups = ["default"];
|
13
|
+
platforms = [];
|
14
|
+
source = {
|
15
|
+
remotes = ["https://rubygems.org"];
|
16
|
+
sha256 = "0rwvjahnp7cpmracd8x732rjgnilqv2sx7d1gfrysslc3h039fa9";
|
17
|
+
type = "gem";
|
18
|
+
};
|
19
|
+
version = "1.5.0";
|
20
|
+
};
|
21
|
+
dotenv = {
|
22
|
+
groups = ["default"];
|
23
|
+
platforms = [];
|
24
|
+
source = {
|
25
|
+
remotes = ["https://rubygems.org"];
|
26
|
+
sha256 = "1n0pi8x8ql5h1mijvm8lgn6bhq4xjb5a500p5r1krq4s6j9lg565";
|
27
|
+
type = "gem";
|
28
|
+
};
|
29
|
+
version = "2.8.1";
|
30
|
+
};
|
31
|
+
rake = {
|
32
|
+
groups = ["default"];
|
33
|
+
platforms = [];
|
34
|
+
source = {
|
35
|
+
remotes = ["https://rubygems.org"];
|
36
|
+
sha256 = "15whn7p9nrkxangbs9hh75q585yfn66lv0v2mhj6q6dl6x8bzr2w";
|
37
|
+
type = "gem";
|
38
|
+
};
|
39
|
+
version = "13.0.6";
|
40
|
+
};
|
41
|
+
rspec = {
|
42
|
+
dependencies = ["rspec-core" "rspec-expectations" "rspec-mocks"];
|
43
|
+
groups = ["default"];
|
44
|
+
platforms = [];
|
45
|
+
source = {
|
46
|
+
remotes = ["https://rubygems.org"];
|
47
|
+
sha256 = "171rc90vcgjl8p1bdrqa92ymrj8a87qf6w20x05xq29mljcigi6c";
|
48
|
+
type = "gem";
|
49
|
+
};
|
50
|
+
version = "3.12.0";
|
51
|
+
};
|
52
|
+
rspec-core = {
|
53
|
+
dependencies = ["rspec-support"];
|
54
|
+
groups = ["default"];
|
55
|
+
platforms = [];
|
56
|
+
source = {
|
57
|
+
remotes = ["https://rubygems.org"];
|
58
|
+
sha256 = "1ibb81slc35q5yp276sixp3yrvj9q92wlmi1glbnwlk6g49z8rn4";
|
59
|
+
type = "gem";
|
60
|
+
};
|
61
|
+
version = "3.12.0";
|
62
|
+
};
|
63
|
+
rspec-expectations = {
|
64
|
+
dependencies = ["diff-lcs" "rspec-support"];
|
65
|
+
groups = ["default"];
|
66
|
+
platforms = [];
|
67
|
+
source = {
|
68
|
+
remotes = ["https://rubygems.org"];
|
69
|
+
sha256 = "0qldsmjhqr4344zdlamzggr3y98wdk2c4hihkhwx8imk800gkl8v";
|
70
|
+
type = "gem";
|
71
|
+
};
|
72
|
+
version = "3.12.0";
|
73
|
+
};
|
74
|
+
rspec-mocks = {
|
75
|
+
dependencies = ["diff-lcs" "rspec-support"];
|
76
|
+
groups = ["default"];
|
77
|
+
platforms = [];
|
78
|
+
source = {
|
79
|
+
remotes = ["https://rubygems.org"];
|
80
|
+
sha256 = "1yvwnb0x5d6d4ff3wlgahk0wcw72ic51gd2snr1xxc5ify41kabv";
|
81
|
+
type = "gem";
|
82
|
+
};
|
83
|
+
version = "3.12.0";
|
84
|
+
};
|
85
|
+
rspec-support = {
|
86
|
+
groups = ["default"];
|
87
|
+
platforms = [];
|
88
|
+
source = {
|
89
|
+
remotes = ["https://rubygems.org"];
|
90
|
+
sha256 = "12y52zwwb3xr7h91dy9k3ndmyyhr3mjcayk0nnarnrzz8yr48kfx";
|
91
|
+
type = "gem";
|
92
|
+
};
|
93
|
+
version = "3.12.0";
|
94
|
+
};
|
95
|
+
}
|
data/lib/blockfrost-ruby.rb
CHANGED
@@ -79,6 +79,32 @@ module Blockfrostruby
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
+
class CardanoPreview < CardanoMainNet
|
83
|
+
# Create an instanse of CardanoPreview object.
|
84
|
+
# Using of SDK is a calling methods on such object.
|
85
|
+
#
|
86
|
+
# @param project_id [String] the project_id from API
|
87
|
+
# @param config [Hash] a config with params: use_asc_order_as_default, default_count_per_page, parallel_requests, sleep_between_retries_ms
|
88
|
+
# @return [Object] with attr_reader :config, :project_id, :url
|
89
|
+
def initialize(project_id, config = {})
|
90
|
+
super
|
91
|
+
@url = CARDANO_PREVIEW_URL
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
class CardanoPreprod < CardanoMainNet
|
96
|
+
# Create an instanse of CardanoPreprod object.
|
97
|
+
# Using of SDK is a calling methods on such object.
|
98
|
+
#
|
99
|
+
# @param project_id [String] the project_id from API
|
100
|
+
# @param config [Hash] a config with params: use_asc_order_as_default, default_count_per_page, parallel_requests, sleep_between_retries_ms
|
101
|
+
# @return [Object] with attr_reader :config, :project_id, :url
|
102
|
+
def initialize(project_id, config = {})
|
103
|
+
super
|
104
|
+
@url = CARDANO_PREPROD_URL
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
82
108
|
class IPFS < Net
|
83
109
|
include IPFSEndpoints
|
84
110
|
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
CARDANO_MAINNET_URL = 'https://cardano-mainnet.blockfrost.io/api/v0'
|
4
4
|
CARDANO_TESTNET_URL = 'https://cardano-testnet.blockfrost.io/api/v0'
|
5
|
+
CARDANO_PREVIEW_URL = 'https://cardano-preview.blockfrost.io/api/v0'
|
6
|
+
CARDANO_PREPROD_URL = 'https://cardano-preprod.blockfrost.io/api/v0'
|
5
7
|
IPFS_URL = 'https://ipfs.blockfrost.io/api/v0'
|
6
8
|
|
7
9
|
MAX_COUNT_PER_PAGE = 100
|
@@ -54,7 +54,7 @@ module AccountsEndpoints
|
|
54
54
|
# @return [Hash] formatted result with status and body keys.
|
55
55
|
def get_account_registrations(address, params = {})
|
56
56
|
params = Params.define_params(params, @config)
|
57
|
-
Request.get_response("#{@url}/accounts/#{address}/
|
57
|
+
Request.get_response("#{@url}/accounts/#{address}/registrations", @project_id, params)
|
58
58
|
end
|
59
59
|
|
60
60
|
# Calls get request on (@url)/accounts/(address)/withdrawals.
|
@@ -82,9 +82,9 @@ module AccountsEndpoints
|
|
82
82
|
# @param address [String] will be added to the url for get request.
|
83
83
|
# @param params [Hash] - params passed by user.
|
84
84
|
# @return [Hash] formatted result with status and body keys.
|
85
|
-
def
|
85
|
+
def get_account_assosiated_addresses(address, params = {})
|
86
86
|
params = Params.define_params(params, @config)
|
87
|
-
Request.get_response("#{@url}/accounts/#{address}/addresses", @project_id, params
|
87
|
+
Request.get_response("#{@url}/accounts/#{address}/addresses", @project_id, params)
|
88
88
|
end
|
89
89
|
|
90
90
|
# Calls get request on (@url)/accounts/(address)/addresses/assets.
|
@@ -13,7 +13,7 @@ module AddressesEndpoints
|
|
13
13
|
#
|
14
14
|
# @param address [String] will be added to the url for get request.
|
15
15
|
# @return [Hash] formatted result with status and body keys.
|
16
|
-
def
|
16
|
+
def get_specific_address(address)
|
17
17
|
Request.get_response("#{@url}/addresses/#{address}", @project_id)
|
18
18
|
end
|
19
19
|
|
@@ -23,9 +23,8 @@ module AssetsEndpoints
|
|
23
23
|
# @param asset [String] will be added to the url for get request.
|
24
24
|
# @param params [Hash] - params passed by user.
|
25
25
|
# @return [Hash] formatted result with status and body keys.
|
26
|
-
def
|
27
|
-
|
28
|
-
Request.get_response("#{@url}/assets/#{asset}", @project_id, params)
|
26
|
+
def get_specific_asset(asset)
|
27
|
+
Request.get_response("#{@url}/assets/#{asset}", @project_id)
|
29
28
|
end
|
30
29
|
|
31
30
|
# Calls get request on (@url)/assets/(asset)/history.
|
@@ -29,9 +29,8 @@ module EpochsEndpoints
|
|
29
29
|
# @param epoch_number [String] will be added to the url for get request.
|
30
30
|
# @param params [Hash] - params passed by user.
|
31
31
|
# @return [Hash] formatted result with status and body keys.
|
32
|
-
def get_epoch(epoch_number
|
33
|
-
|
34
|
-
Request.get_response("#{@url}/epochs/#{epoch_number}", @project_id, params)
|
32
|
+
def get_epoch(epoch_number)
|
33
|
+
Request.get_response("#{@url}/epochs/#{epoch_number}", @project_id)
|
35
34
|
end
|
36
35
|
|
37
36
|
# Calls get request on (@url)/epochs/(epoch_number)/next.
|
data/shell.nix
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
with (import <nixpkgs> {});
|
2
|
+
let
|
3
|
+
ruby = ruby_3_1;
|
4
|
+
env = bundlerEnv {
|
5
|
+
name = "blockfrost-ruby-env";
|
6
|
+
inherit ruby;
|
7
|
+
gemdir = ./.;
|
8
|
+
};
|
9
|
+
in stdenv.mkDerivation {
|
10
|
+
name = "blockfrost-ruby";
|
11
|
+
buildInputs = [ env ruby nodejs git rubyPackages_3_1.rake rubyPackages_3_1.rspec ];
|
12
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blockfrost-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan (https://github.com/18bitmood)
|
@@ -22,6 +22,8 @@ executables: []
|
|
22
22
|
extensions: []
|
23
23
|
extra_rdoc_files: []
|
24
24
|
files:
|
25
|
+
- ".env.example"
|
26
|
+
- ".github/workflows/nix.yaml"
|
25
27
|
- ".gitignore"
|
26
28
|
- ".rspec"
|
27
29
|
- ".rubocop.yml"
|
@@ -31,6 +33,8 @@ files:
|
|
31
33
|
- README.md
|
32
34
|
- Rakefile
|
33
35
|
- blockfrost-ruby.gemspec
|
36
|
+
- default.nix
|
37
|
+
- gemset.nix
|
34
38
|
- lib/blockfrost-ruby.rb
|
35
39
|
- lib/blockfrostruby/config.yml
|
36
40
|
- lib/blockfrostruby/configuration.rb
|
@@ -54,6 +58,7 @@ files:
|
|
54
58
|
- lib/blockfrostruby/request.rb
|
55
59
|
- lib/blockfrostruby/validator.rb
|
56
60
|
- lib/blockfrostruby/version.rb
|
61
|
+
- shell.nix
|
57
62
|
homepage: https://github.com/blockfrost/blockfrost-ruby
|
58
63
|
licenses: []
|
59
64
|
metadata:
|
@@ -75,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
80
|
- !ruby/object:Gem::Version
|
76
81
|
version: '0'
|
77
82
|
requirements: []
|
78
|
-
rubygems_version: 3.2.
|
83
|
+
rubygems_version: 3.2.26
|
79
84
|
signing_key:
|
80
85
|
specification_version: 4
|
81
86
|
summary: Ruby SDK to work with Blockfrost (Cardano Blockchain API)
|