Module: EpochsEndpoints

Extended by:
Params, Request
Included in:
Blockfrostruby::CardanoMainNet
Defined in:
lib/blockfrostruby/endpoints/cardano/epochs_endpoints.rb

Constant Summary

Constants included from Blockfrostruby

Blockfrostruby::VERSION

Instance Method Summary collapse

Methods included from Request

get_response, post_file, post_request_cbor, post_request_raw

Methods included from Params

define_params

Methods included from Validator

validate_init_params, validate_params

Methods included from Configuration

default_config, define_config

Instance Method Details

#get_epoch(epoch_number) ⇒ Hash

Calls get request on (@url)/epochs/(epoch_number).

Parameters:

  • epoch_number (String)

    will be added to the url for get request.

  • params (Hash)
    • params passed by user.

Returns:

  • (Hash)

    formatted result with status and body keys.



32
33
34
# File 'lib/blockfrostruby/endpoints/cardano/epochs_endpoints.rb', line 32

def get_epoch(epoch_number)
  Request.get_response("#{@url}/epochs/#{epoch_number}", @project_id)
end

#get_epoch_blocks(epoch_number, params = {}) ⇒ Hash

Calls get request on (@url)/epochs/(epoch_number)/blocks.

Parameters:

  • epoch_number (String)

    will be added to the url for get request.

  • params (Hash) (defaults to: {})
    • params passed by user.

Returns:

  • (Hash)

    formatted result with status and body keys.



81
82
83
84
# File 'lib/blockfrostruby/endpoints/cardano/epochs_endpoints.rb', line 81

def get_epoch_blocks(epoch_number, params = {})
  params = Params.define_params(params, @config)
  Request.get_response("#{@url}/epochs/#{epoch_number}/blocks", @project_id, params)
end

#get_epoch_blocks_by_pool(epoch_number, pool_id, params = {}) ⇒ Hash

Calls get request on (@url)/epochs/(epoch_number)/bloks/(pool_id).

Parameters:

  • epoch_number (String)

    will be added to the url for get request.

  • pool_id (String)

    will be added to the url for get request.

  • params (Hash) (defaults to: {})
    • params passed by user.

Returns:

  • (Hash)

    formatted result with status and body keys.



92
93
94
95
# File 'lib/blockfrostruby/endpoints/cardano/epochs_endpoints.rb', line 92

def get_epoch_blocks_by_pool(epoch_number, pool_id, params = {})
  params = Params.define_params(params, @config)
  Request.get_response("#{@url}/epochs/#{epoch_number}/blocks/#{pool_id}", @project_id, params)
end

#get_epoch_parameters(epoch_number) ⇒ Hash

Calls get request on (@url)/epochs/(epoch_number)/parameters.

Parameters:

  • epoch_number (String)

    will be added to the url for get request.

Returns:

  • (Hash)

    formatted result with status and body keys.



101
102
103
# File 'lib/blockfrostruby/endpoints/cardano/epochs_endpoints.rb', line 101

def get_epoch_parameters(epoch_number)
  Request.get_response("#{@url}/epochs/#{epoch_number}/parameters", @project_id)
end

#get_epoch_stakes(epoch_number, params = {}) ⇒ Hash

Calls get request on (@url)/epochs/(epoch_number)/stakes.

Parameters:

  • epoch_number (String)

    will be added to the url for get request.

  • params (Hash) (defaults to: {})
    • params passed by user.

Returns:

  • (Hash)

    formatted result with status and body keys.



61
62
63
64
# File 'lib/blockfrostruby/endpoints/cardano/epochs_endpoints.rb', line 61

def get_epoch_stakes(epoch_number, params = {})
  params = Params.define_params(params, @config)
  Request.get_response("#{@url}/epochs/#{epoch_number}/stakes", @project_id, params)
end

#get_epoch_stakes_by_pool(epoch_number, pool_id, params = {}) ⇒ Hash

Calls get request on (@url)/epochs/(epoch_number)/stakes/(pool_id).

Parameters:

  • epoch_number (String)

    will be added to the url for get request.

  • params (Hash) (defaults to: {})
    • params passed by user.

Returns:

  • (Hash)

    formatted result with status and body keys.



71
72
73
74
# File 'lib/blockfrostruby/endpoints/cardano/epochs_endpoints.rb', line 71

def get_epoch_stakes_by_pool(epoch_number, pool_id, params = {})
  params = Params.define_params(params, @config)
  Request.get_response("#{@url}/epochs/#{epoch_number}/stakes/#{pool_id}", @project_id, params)
end

#get_latest_epochHash

Calls get request on (@url)/epochs/latest.

Returns:

  • (Hash)

    formatted result with status and body keys.



16
17
18
# File 'lib/blockfrostruby/endpoints/cardano/epochs_endpoints.rb', line 16

def get_latest_epoch
  Request.get_response("#{@url}/epochs/latest", @project_id)
end

#get_latest_epoch_parametersHash

Calls get request on (@url)/epochs/latest/parameters.

Returns:

  • (Hash)

    formatted result with status and body keys.



23
24
25
# File 'lib/blockfrostruby/endpoints/cardano/epochs_endpoints.rb', line 23

def get_latest_epoch_parameters
  Request.get_response("#{@url}/epochs/latest/parameters", @project_id)
end

#get_list_of_next_epochs(epoch_number, params = {}) ⇒ Hash

Calls get request on (@url)/epochs/(epoch_number)/next.

Parameters:

  • epoch_number (String)

    will be added to the url for get request.

  • params (Hash) (defaults to: {})
    • params passed by user.

Returns:

  • (Hash)

    formatted result with status and body keys.



41
42
43
44
# File 'lib/blockfrostruby/endpoints/cardano/epochs_endpoints.rb', line 41

def get_list_of_next_epochs(epoch_number, params = {})
  params = Params.define_params(params, @config)
  Request.get_response("#{@url}/epochs/#{epoch_number}/next", @project_id, params)
end

#get_list_of_previous_epochs(epoch_number, params = {}) ⇒ Hash

Calls get request on (@url)/epochs/(epoch_number)/previous.

Parameters:

  • epoch_number (String)

    will be added to the url for get request.

  • params (Hash) (defaults to: {})
    • params passed by user.

Returns:

  • (Hash)

    formatted result with status and body keys.



51
52
53
54
# File 'lib/blockfrostruby/endpoints/cardano/epochs_endpoints.rb', line 51

def get_list_of_previous_epochs(epoch_number, params = {})
  params = Params.define_params(params, @config)
  Request.get_response("#{@url}/epochs/#{epoch_number}/previous", @project_id, params)
end