blockfrost-ruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +39 -0
  5. data/CHANGELOG.md +5 -0
  6. data/Gemfile +10 -0
  7. data/LICENSE +201 -0
  8. data/README.md +134 -0
  9. data/Rakefile +8 -0
  10. data/blockfrost-ruby.gemspec +40 -0
  11. data/lib/blockfrost-ruby.rb +98 -0
  12. data/lib/blockfrostruby/config.yml +4 -0
  13. data/lib/blockfrostruby/configuration.rb +30 -0
  14. data/lib/blockfrostruby/constants.rb +9 -0
  15. data/lib/blockfrostruby/endpoints/cardano/accounts_endpoints.rb +99 -0
  16. data/lib/blockfrostruby/endpoints/cardano/addresses_endpoints.rb +47 -0
  17. data/lib/blockfrostruby/endpoints/cardano/assets_endpoints.rb +70 -0
  18. data/lib/blockfrostruby/endpoints/cardano/blocks_endpoints.rb +84 -0
  19. data/lib/blockfrostruby/endpoints/cardano/epochs_endpoints.rb +105 -0
  20. data/lib/blockfrostruby/endpoints/cardano/health_endpoints.rb +28 -0
  21. data/lib/blockfrostruby/endpoints/cardano/ledger_endpoints.rb +14 -0
  22. data/lib/blockfrostruby/endpoints/cardano/metadata_endpoints.rb +40 -0
  23. data/lib/blockfrostruby/endpoints/cardano/metrics_endpoints.rb +21 -0
  24. data/lib/blockfrostruby/endpoints/cardano/network_endpoints.rb +14 -0
  25. data/lib/blockfrostruby/endpoints/cardano/nutlink_endpoints.rb +50 -0
  26. data/lib/blockfrostruby/endpoints/cardano/pools_endpoints.rb +102 -0
  27. data/lib/blockfrostruby/endpoints/cardano/transactions_endpoints.rb +99 -0
  28. data/lib/blockfrostruby/endpoints/custom_endpoints.rb +26 -0
  29. data/lib/blockfrostruby/endpoints/ipfs/ipfs_endpoints.rb +58 -0
  30. data/lib/blockfrostruby/params.rb +66 -0
  31. data/lib/blockfrostruby/request.rb +216 -0
  32. data/lib/blockfrostruby/validator.rb +219 -0
  33. data/lib/blockfrostruby/version.rb +5 -0
  34. metadata +82 -0
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Example: stake1u9ylzsgxaa6xctf4juup682ar3juj85n8tx3hthnljg47zctvm3rc
4
+
5
+ require_relative '../../../blockfrostruby/request'
6
+ require_relative '../../../blockfrostruby/params'
7
+
8
+ module AccountsEndpoints
9
+ extend Request
10
+ extend Params
11
+
12
+ # Calls get request on (@url)/accounts/(address).
13
+ #
14
+ # @param address [String] will be added to the url for get request.
15
+ # @return [Hash] formatted result with status and body keys.
16
+ def get_account_address(address)
17
+ Request.get_response("#{@url}/accounts/#{address}", @project_id)
18
+ end
19
+
20
+ # Calls get request on (@url)/accounts/(address)/rewards.
21
+ #
22
+ # @param address [String] will be added to the url for get request.
23
+ # @param params [Hash] - params passed by user.
24
+ # @return [Hash] formatted result with status and body keys.
25
+ def get_account_rewards(address, params = {})
26
+ params = Params.define_params(params, @config)
27
+ Request.get_response("#{@url}/accounts/#{address}/rewards", @project_id, params)
28
+ end
29
+
30
+ # Calls get request on (@url)/accounts/(address)/history.
31
+ #
32
+ # @param address [String] will be added to the url for get request.
33
+ # @param params [Hash] - params passed by user.
34
+ # @return [Hash] formatted result with status and body keys.
35
+ def get_account_history(address, params = {})
36
+ params = Params.define_params(params, @config)
37
+ Request.get_response("#{@url}/accounts/#{address}/history", @project_id, params)
38
+ end
39
+
40
+ # Calls get request on (@url)/accounts/(address)/delegations.
41
+ #
42
+ # @param address [String] will be added to the url for get request.
43
+ # @param params [Hash] - params passed by user.
44
+ # @return [Hash] formatted result with status and body keys.
45
+ def get_account_delegations(address, params = {})
46
+ params = Params.define_params(params, @config)
47
+ Request.get_response("#{@url}/accounts/#{address}/delegations", @project_id, params)
48
+ end
49
+
50
+ # Calls get request on (@url)/accounts/(address)/registrations.
51
+ #
52
+ # @param address [String] will be added to the url for get request.
53
+ # @param params [Hash] - params passed by user.
54
+ # @return [Hash] formatted result with status and body keys.
55
+ def get_account_registrations(address, params = {})
56
+ params = Params.define_params(params, @config)
57
+ Request.get_response("#{@url}/accounts/#{address}/registations", @project_id, params)
58
+ end
59
+
60
+ # Calls get request on (@url)/accounts/(address)/withdrawals.
61
+ #
62
+ # @param address [String] will be added to the url for get request.
63
+ # @param params [Hash] - params passed by user.
64
+ # @return [Hash] formatted result with status and body keys.
65
+ def get_account_withdrawals(address, params = {})
66
+ params = Params.define_params(params, @config)
67
+ Request.get_response("#{@url}/accounts/#{address}/withdrawals", @project_id, params)
68
+ end
69
+
70
+ # Calls get request on (@url)/accounts/(address)/mirs.
71
+ #
72
+ # @param address [String] will be added to the url for get request.
73
+ # @param params [Hash] - params passed by user.
74
+ # @return [Hash] formatted result with status and body keys.
75
+ def get_account_mirs(address, params = {})
76
+ params = Params.define_params(params, @config)
77
+ Request.get_response("#{@url}/accounts/#{address}/mirs", @project_id, params)
78
+ end
79
+
80
+ # Calls get request on (@url)/accounts/(address)/addresses.
81
+ #
82
+ # @param address [String] will be added to the url for get request.
83
+ # @param params [Hash] - params passed by user.
84
+ # @return [Hash] formatted result with status and body keys.
85
+ def get_account_addresses(address, params = {})
86
+ params = Params.define_params(params, @config)
87
+ Request.get_response("#{@url}/accounts/#{address}/addresses", @project_id, params, @config)
88
+ end
89
+
90
+ # Calls get request on (@url)/accounts/(address)/addresses/assets.
91
+ #
92
+ # @param address [String] will be added to the url for get request.
93
+ # @param params [Hash] - params passed by user.
94
+ # @return [Hash] formatted result with status and body keys.
95
+ def get_account_addresses_assets(address, params = {})
96
+ params = Params.define_params(params, @config)
97
+ Request.get_response("#{@url}/accounts/#{address}/addresses/assets", @project_id, params)
98
+ end
99
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Example: addr1qxqs59lphg8g6qndelq8xwqn60ag3aeyfcp33c2kdp46a09re5df3pzwwmyq946axfcejy5n4x0y99wqpgtp2gd0k09qsgy6pz
4
+
5
+ require_relative '../../../blockfrostruby/request'
6
+ require_relative '../../../blockfrostruby/params'
7
+
8
+ module AddressesEndpoints
9
+ extend Request
10
+ extend Params
11
+
12
+ # Calls get request on (@url)/addresses/(address).
13
+ #
14
+ # @param address [String] will be added to the url for get request.
15
+ # @return [Hash] formatted result with status and body keys.
16
+ def get_address(address)
17
+ Request.get_response("#{@url}/addresses/#{address}", @project_id)
18
+ end
19
+
20
+ # Calls get request on (@url)/addresses/(address)/total.
21
+ #
22
+ # @param address [String] will be added to the url for get request.
23
+ # @return [Hash] formatted result with status and body keys.
24
+ def get_address_details(address)
25
+ Request.get_response("#{@url}/addresses/#{address}/total", @project_id)
26
+ end
27
+
28
+ # Calls get request on (@url)/addresses/(address)/utxos.
29
+ #
30
+ # @param address [String] will be added to the url for get request.
31
+ # @param params [Hash] - params passed by user.
32
+ # @return [Hash] formatted result with status and body keys.
33
+ def get_address_utxos(address, params = {})
34
+ params = Params.define_params(params, @config)
35
+ Request.get_response("#{@url}/addresses/#{address}/utxos", @project_id, params)
36
+ end
37
+
38
+ # Calls get request on (@url)/addresses/(address)/transactions.
39
+ #
40
+ # @param address [String] will be added to the url for get request.
41
+ # @param params [Hash] - params passed by user.
42
+ # @return [Hash] formatted result with status and body keys.
43
+ def get_address_transactions(address, params = {})
44
+ params = Params.define_params(params, @config)
45
+ Request.get_response("#{@url}/addresses/#{address}/transactions", @project_id, params)
46
+ end
47
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Example: 81791e9e2b5929574039c38020374c753a548ef84bd7eaef8c908bdf43617264616e6f4b6f6d626174533154323541303035
4
+
5
+ require_relative '../../../blockfrostruby/request'
6
+ require_relative '../../../blockfrostruby/params'
7
+
8
+ module AssetsEndpoints
9
+ extend Request
10
+ extend Params
11
+
12
+ # Calls get request on (@url)/assets.
13
+ #
14
+ # @param params [Hash] - params passed by user.
15
+ # @return [Hash] formatted result with status and body keys.
16
+ def get_assets(params = {})
17
+ params = Params.define_params(params, @config)
18
+ Request.get_response("#{@url}/assets", @project_id, params)
19
+ end
20
+
21
+ # Calls get request on (@url)/assets/(asset).
22
+ #
23
+ # @param asset [String] will be added to the url for get request.
24
+ # @param params [Hash] - params passed by user.
25
+ # @return [Hash] formatted result with status and body keys.
26
+ def get_asset(asset, params = {})
27
+ params = Params.define_params(params, @config)
28
+ Request.get_response("#{@url}/assets/#{asset}", @project_id, params)
29
+ end
30
+
31
+ # Calls get request on (@url)/assets/(asset)/history.
32
+ #
33
+ # @param asset [String] will be added to the url for get request.
34
+ # @param params [Hash] - params passed by user.
35
+ # @return [Hash] formatted result with status and body keys.
36
+ def get_asset_history(asset, params = {})
37
+ params = Params.define_params(params, @config)
38
+ Request.get_response("#{@url}/assets/#{asset}/history", @project_id, params)
39
+ end
40
+
41
+ # Calls get request on (@url)/assets/(asset)/transactions.
42
+ #
43
+ # @param asset [String] will be added to the url for get request.
44
+ # @param params [Hash] - params passed by user.
45
+ # @return [Hash] formatted result with status and body keys.
46
+ def get_asset_transactions(asset, params = {})
47
+ params = Params.define_params(params, @config)
48
+ Request.get_response("#{@url}/assets/#{asset}/transactions", @project_id, params)
49
+ end
50
+
51
+ # Calls get request on (@url)/assets/(asset)/addresses.
52
+ #
53
+ # @param asset [String] will be added to the url for get request.
54
+ # @param params [Hash] - params passed by user.
55
+ # @return [Hash] formatted result with status and body keys.
56
+ def get_asset_addresses(asset, params = {})
57
+ params = Params.define_params(params, @config)
58
+ Request.get_response("#{@url}/assets/#{asset}/addresses", @project_id, params)
59
+ end
60
+
61
+ # Calls get request on (@url)/assets/policy/(policy_id).
62
+ #
63
+ # @param policy_id [String] will be added to the url for get request.
64
+ # @param params [Hash] - params passed by user.
65
+ # @return [Hash] formatted result with status and body keys.
66
+ def get_assets_of_policy(policy_id, params = {})
67
+ params = Params.define_params(params, @config)
68
+ Request.get_response("#{@url}/assets/policy/#{policy_id}", @project_id, params)
69
+ end
70
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Example hash_or_number: 5ea1ba291e8eef538635a53e59fddba7810d1679631cc3aed7c8e6c4091a516a
4
+ # Example slot_number: 30895909
5
+ # Example epoch_number: 219
6
+
7
+ require_relative '../../../blockfrostruby/request'
8
+ require_relative '../../../blockfrostruby/params'
9
+
10
+ module BlocksEndpoints
11
+ extend Request
12
+ extend Params
13
+
14
+ # Calls get request on (@url)/blocks/latest.
15
+ #
16
+ # @return [Hash] formatted result with status and body keys.
17
+ def get_block_latest
18
+ Request.get_response("#{@url}/blocks/latest", @project_id)
19
+ end
20
+
21
+ # Calls get request on (@url)/blocks/latest/txs.
22
+ #
23
+ # @param params [Hash] - params passed by user.
24
+ # @return [Hash] formatted result with status and body keys.
25
+ def get_block_latest_transactions(params = {})
26
+ params = Params.define_params(params, @config)
27
+ Request.get_response("#{@url}/blocks/latest/txs", @project_id, params)
28
+ end
29
+
30
+ # Calls get request on (@url)/blocks/(hash_or_number).
31
+ #
32
+ # @param hash_or_number [String] will be added to the url for get request.
33
+ # @return [Hash] formatted result with status and body keys.
34
+ def get_block(hash_or_number)
35
+ Request.get_response("#{@url}/blocks/#{hash_or_number}", @project_id)
36
+ end
37
+
38
+ # Calls get request on (@url)/blocks/slot/(slot_number).
39
+ #
40
+ # @param slot_number [String] will be added to the url for get request.
41
+ # @return [Hash] formatted result with status and body keys.
42
+ def get_block_in_slot(slot_number)
43
+ Request.get_response("#{@url}/blocks/slot/#{slot_number}", @project_id)
44
+ end
45
+
46
+ # Calls get request on (@url)/blocks/epoch/(epoch_number)/slot/(slot_number).
47
+ #
48
+ # @param slot_number [String] will be added to the url for get request.
49
+ # @param epoch_number [String] will be added to the url for get request.
50
+ # @return [Hash] formatted result with status and body keys.
51
+ def get_block_in_slot_in_epoch(slot_number, epoch_number)
52
+ Request.get_response("#{@url}/blocks/epoch/#{epoch_number}/slot/#{slot_number}", @project_id)
53
+ end
54
+
55
+ # Calls get request on (@url)/blocks/(hash_or_number)/next.
56
+ #
57
+ # @param hash_or_number [String] will be added to the url for get request.
58
+ # @param params [Hash] - params passed by user.
59
+ # @return [Hash] formatted result with status and body keys.
60
+ def get_list_of_next_blocks(hash_or_number, params = {})
61
+ params = Params.define_params(params, @config)
62
+ Request.get_response("#{@url}/blocks/#{hash_or_number}/next", @project_id, params)
63
+ end
64
+
65
+ # Calls get request on (@url)/blocks/(hash_or_number)/previous.
66
+ #
67
+ # @param hash_or_number [String] will be added to the url for get request.
68
+ # @param params [Hash] - params passed by user.
69
+ # @return [Hash] formatted result with status and body keys.
70
+ def get_list_of_previous_blocks(hash_or_number, params = {})
71
+ params = Params.define_params(params, @config)
72
+ Request.get_response("#{@url}/blocks/#{hash_or_number}/previous", @project_id, params)
73
+ end
74
+
75
+ # Calls get request on (@url)/blocks/(hash_or_number)/txs.
76
+ #
77
+ # @param hash_or_number [String] will be added to the url for get request.
78
+ # @param params [Hash] - params passed by user.
79
+ # @return [Hash] formatted result with status and body keys.
80
+ def get_block_transactions(hash_or_number, params = {})
81
+ params = Params.define_params(params, @config)
82
+ Request.get_response("#{@url}/blocks/#{hash_or_number}/txs", @project_id, params)
83
+ end
84
+ end
@@ -0,0 +1,105 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Example epoch_number: 225
4
+ # Example pool_id: pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy
5
+
6
+ require_relative '../../../blockfrostruby/request'
7
+ require_relative '../../../blockfrostruby/params'
8
+
9
+ module EpochsEndpoints
10
+ extend Request
11
+ extend Params
12
+
13
+ # Calls get request on (@url)/epochs/latest.
14
+ #
15
+ # @return [Hash] formatted result with status and body keys.
16
+ def get_latest_epoch
17
+ Request.get_response("#{@url}/epochs/latest", @project_id)
18
+ end
19
+
20
+ # Calls get request on (@url)/epochs/latest/parameters.
21
+ #
22
+ # @return [Hash] formatted result with status and body keys.
23
+ def get_latest_epoch_parameters
24
+ Request.get_response("#{@url}/epochs/latest/parameters", @project_id)
25
+ end
26
+
27
+ # Calls get request on (@url)/epochs/(epoch_number).
28
+ #
29
+ # @param epoch_number [String] will be added to the url for get request.
30
+ # @param params [Hash] - params passed by user.
31
+ # @return [Hash] formatted result with status and body keys.
32
+ def get_epoch(epoch_number, params = {})
33
+ params = Params.define_params(params, @config)
34
+ Request.get_response("#{@url}/epochs/#{epoch_number}", @project_id, params)
35
+ end
36
+
37
+ # Calls get request on (@url)/epochs/(epoch_number)/next.
38
+ #
39
+ # @param epoch_number [String] will be added to the url for get request.
40
+ # @param params [Hash] - params passed by user.
41
+ # @return [Hash] formatted result with status and body keys.
42
+ def get_list_of_next_epochs(epoch_number, params = {})
43
+ params = Params.define_params(params, @config)
44
+ Request.get_response("#{@url}/epochs/#{epoch_number}/next", @project_id, params)
45
+ end
46
+
47
+ # Calls get request on (@url)/epochs/(epoch_number)/previous.
48
+ #
49
+ # @param epoch_number [String] will be added to the url for get request.
50
+ # @param params [Hash] - params passed by user.
51
+ # @return [Hash] formatted result with status and body keys.
52
+ def get_list_of_previous_epochs(epoch_number, params = {})
53
+ params = Params.define_params(params, @config)
54
+ Request.get_response("#{@url}/epochs/#{epoch_number}/previous", @project_id, params)
55
+ end
56
+
57
+ # Calls get request on (@url)/epochs/(epoch_number)/stakes.
58
+ #
59
+ # @param epoch_number [String] will be added to the url for get request.
60
+ # @param params [Hash] - params passed by user.
61
+ # @return [Hash] formatted result with status and body keys.
62
+ def get_epoch_stakes(epoch_number, params = {})
63
+ params = Params.define_params(params, @config)
64
+ Request.get_response("#{@url}/epochs/#{epoch_number}/stakes", @project_id, params)
65
+ end
66
+
67
+ # Calls get request on (@url)/epochs/(epoch_number)/stakes/(pool_id).
68
+ #
69
+ # @param epoch_number [String] will be added to the url for get request.
70
+ # @param params [Hash] - params passed by user.
71
+ # @return [Hash] formatted result with status and body keys.
72
+ def get_epoch_stakes_by_pool(epoch_number, pool_id, params = {})
73
+ params = Params.define_params(params, @config)
74
+ Request.get_response("#{@url}/epochs/#{epoch_number}/stakes/#{pool_id}", @project_id, params)
75
+ end
76
+
77
+ # Calls get request on (@url)/epochs/(epoch_number)/blocks.
78
+ #
79
+ # @param epoch_number [String] will be added to the url for get request.
80
+ # @param params [Hash] - params passed by user.
81
+ # @return [Hash] formatted result with status and body keys.
82
+ def get_epoch_blocks(epoch_number, params = {})
83
+ params = Params.define_params(params, @config)
84
+ Request.get_response("#{@url}/epochs/#{epoch_number}/blocks", @project_id, params)
85
+ end
86
+
87
+ # Calls get request on (@url)/epochs/(epoch_number)/bloks/(pool_id).
88
+ #
89
+ # @param epoch_number [String] will be added to the url for get request.
90
+ # @param pool_id [String] will be added to the url for get request.
91
+ # @param params [Hash] - params passed by user.
92
+ # @return [Hash] formatted result with status and body keys.
93
+ def get_epoch_blocks_by_pool(epoch_number, pool_id, params = {})
94
+ params = Params.define_params(params, @config)
95
+ Request.get_response("#{@url}/epochs/#{epoch_number}/blocks/#{pool_id}", @project_id, params)
96
+ end
97
+
98
+ # Calls get request on (@url)/epochs/(epoch_number)/parameters.
99
+ #
100
+ # @param epoch_number [String] will be added to the url for get request.
101
+ # @return [Hash] formatted result with status and body keys.
102
+ def get_epoch_parameters(epoch_number)
103
+ Request.get_response("#{@url}/epochs/#{epoch_number}/parameters", @project_id)
104
+ end
105
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../blockfrostruby/request'
4
+
5
+ module HealthEndpoints
6
+ extend Request
7
+
8
+ # Calls get request on (@url)/.
9
+ #
10
+ # @return [Hash] formatted result with status and body keys.
11
+ def get_root
12
+ Request.get_response("#{@url}/", @project_id)
13
+ end
14
+
15
+ # Calls get request on (@url)/health.
16
+ #
17
+ # @return [Hash] formatted result with status and body keys.
18
+ def get_health
19
+ Request.get_response("#{@url}/health", @project_id)
20
+ end
21
+
22
+ # Calls get request on (@url)/health/clock.
23
+ #
24
+ # @return [Hash] formatted result with status and body keys.
25
+ def get_health_clock
26
+ Request.get_response("#{@url}/health/clock", @project_id)
27
+ end
28
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../blockfrostruby/request'
4
+
5
+ module LedgerEndpoints
6
+ extend Request
7
+
8
+ # Calls get request on (@url)/genesis.
9
+ #
10
+ # @return [Hash] formatted result with status and body keys.
11
+ def get_genesis
12
+ Request.get_response("#{@url}/genesis", @project_id)
13
+ end
14
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Example label: 1990
4
+
5
+ require_relative '../../../blockfrostruby/request'
6
+ require_relative '../../../blockfrostruby/params'
7
+
8
+ module MetadataEndpoints
9
+ extend Request
10
+ extend Params
11
+
12
+ # Calls get request on (@url)/metadata/txs/labels.
13
+ #
14
+ # @param params [Hash] - params passed by user.
15
+ # @return [Hash] formatted result with status and body keys.
16
+ def get_transactions_metadata_labels(params = {})
17
+ params = Params.define_params(params, @config)
18
+ Request.get_response("#{@url}/metadata/txs/labels", @project_id, params)
19
+ end
20
+
21
+ # Calls get request on (@url)/metadata/txs/labels/(label).
22
+ #
23
+ # @param label [String] will be added to the url for get request.
24
+ # @param params [Hash] - params passed by user.
25
+ # @return [Hash] formatted result with status and body keys.
26
+ def get_transaction_metadata_content_in_json(label, params = {})
27
+ params = Params.define_params(params, @config)
28
+ Request.get_response("#{@url}/metadata/txs/labels/#{label}", @project_id, params)
29
+ end
30
+
31
+ # Calls get request on (@url)/metadata/txs/labels/(label)/cbor.
32
+ #
33
+ # @param label [String] will be added to the url for get request.
34
+ # @param params [Hash] - params passed by user.
35
+ # @return [Hash] formatted result with status and body keys.
36
+ def get_transaction_metadata_content_in_cbor(label, params = {})
37
+ params = Params.define_params(params, @config)
38
+ Request.get_response("#{@url}/metadata/txs/labels/#{label}/cbor", @project_id, params)
39
+ end
40
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../blockfrostruby/request'
4
+
5
+ module MetricsEndpoints
6
+ extend Request
7
+
8
+ # Calls get request on (@url)/metrics.
9
+ #
10
+ # @return [Hash] formatted result with status and body keys.
11
+ def get_metrics
12
+ Request.get_response("#{@url}/metrics", @project_id)
13
+ end
14
+
15
+ # Calls get request on (@url)/metrics.
16
+ #
17
+ # @return [Hash] formatted result with status and body keys.
18
+ def get_metrics_endpoints
19
+ Request.get_response("#{@url}/metrics/endpoints", @project_id)
20
+ end
21
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../blockfrostruby/request'
4
+
5
+ module NetworkEndpoints
6
+ extend Request
7
+
8
+ # Calls get request on (@url)/network.
9
+ #
10
+ # @return [Hash] formatted result with status and body keys.
11
+ def get_network
12
+ Request.get_response("#{@url}/network", @project_id)
13
+ end
14
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Example address: addr1qxqs59lphg8g6qndelq8xwqn60ag3aeyfcp33c2kdp46a09re5df3pzwwmyq946axfcejy5n4x0y99wqpgtp2gd0k09qsgy6pz
4
+
5
+ require_relative '../../../blockfrostruby/request'
6
+ require_relative '../../../blockfrostruby/params'
7
+
8
+ module NutlinkEndpoints
9
+ extend Request
10
+ extend Params
11
+
12
+ # Calls get request on (@url)/nutlink/(address).
13
+ #
14
+ # @param address [String] will be added to the url for get request.
15
+ # @return [Hash] formatted result with status and body keys.
16
+ def get_address_metadata_list(address)
17
+ Request.get_response("#{@url}/nutlink/#{address}", @project_id)
18
+ end
19
+
20
+ # Calls get request on (@url)/nutlink/(address)/tickers.
21
+ #
22
+ # @param address [String] will be added to the url for get request.
23
+ # @param params [Hash] - params passed by user.
24
+ # @return [Hash] formatted result with status and body keys.
25
+ def get_address_metadata_tickers_list(address, params = {})
26
+ params = Params.define_params(params, @config)
27
+ Request.get_response("#{@url}/nutlink/#{address}/tickers", @project_id, params)
28
+ end
29
+
30
+ # Calls get request on (@url)/nutlink/(address)/tickers/(ticker).
31
+ #
32
+ # @param address [String] will be added to the url for get request.
33
+ # @param ticker [String] will be added to the url for get request.
34
+ # @param params [Hash] - params passed by user.
35
+ # @return [Hash] formatted result with status and body keys.
36
+ def get_ticker_records_by_address(address, ticker, params = {})
37
+ params = Params.define_params(params, @config)
38
+ Request.get_response("#{@url}/nutlink/#{address}/tickers/#{ticker}", @project_id, params)
39
+ end
40
+
41
+ # Calls get request on (@url)/nutlink/tickers/(ticker).
42
+ #
43
+ # @param ticker [String] will be added to the url for get request.
44
+ # @param params [Hash] - params passed by user.
45
+ # @return [Hash] formatted result with status and body keys.
46
+ def get_ticker_records(ticker, params = {})
47
+ params = Params.define_params(params, @config)
48
+ Request.get_response("#{@url}/nutlink/tickers/#{ticker}", @project_id, params)
49
+ end
50
+ end