Module: IPFSEndpoints

Extended by:
Params, Request
Included in:
Blockfrostruby::IPFS
Defined in:
lib/blockfrostruby/endpoints/ipfs/ipfs_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

#add_a_file(filepath) ⇒ Hash

Calls post request on (@url)/ipfs/add

Parameters:

  • filepath (String) —

    will be added to the url for get request.

Returns:

  • (Hash) —

    formatted result with status and body keys.



39
40
41
# File 'lib/blockfrostruby/endpoints/ipfs/ipfs_endpoints.rb', line 39

def add_a_file(filepath)
  Request.post_file("#{@url}/ipfs/add", @project_id, filepath)
end

#get_localstorage_pinned_object(ipfs_path) ⇒ Hash

Calls get request on (@url)/ipfs/pin/list/(ipfs_path)

Parameters:

  • ipfs_path (String) —

    will be added to the url for get request.

Returns:

  • (Hash) —

    formatted result with status and body keys.



23
24
25
# File 'lib/blockfrostruby/endpoints/ipfs/ipfs_endpoints.rb', line 23

def get_localstorage_pinned_object(ipfs_path)
  Request.get_response("#{@url}/ipfs/pin/list/#{ipfs_path}", @project_id)
end

#get_localstorage_pinned_objects_list(params = {}) ⇒ Hash

Calls get request on (@url)/ipfs/pin/list

Parameters:

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

Returns:

  • (Hash) —

    formatted result with status and body keys.



14
15
16
17
# File 'lib/blockfrostruby/endpoints/ipfs/ipfs_endpoints.rb', line 14

def get_localstorage_pinned_objects_list(params = {})
  params = Params.define_params(params, @config)
  Request.get_response("#{@url}/ipfs/pin/list", @project_id, params)
end

#get_relay_to_ipfs_gateway(ipfs_path) ⇒ Hash

Calls get request on (@url)/ipfs/gateway/(ipfs_path)

Parameters:

  • ipfs_path (String) —

    will be added to the url for get request.

Returns:

  • (Hash) —

    formatted result with status and body keys.



31
32
33
# File 'lib/blockfrostruby/endpoints/ipfs/ipfs_endpoints.rb', line 31

def get_relay_to_ipfs_gateway(ipfs_path)
  Request.get_response("#{@url}/ipfs/gateway/#{ipfs_path}", @project_id)
end

#pin_an_object(ipfs_path) ⇒ Hash

Calls post request on (@url)/ipfs/pin/add/(ipfs_path)

Parameters:

  • ipfs_path (String) —

    will be added to the url for get request.

Returns:

  • (Hash) —

    formatted result with status and body keys.



47
48
49
# File 'lib/blockfrostruby/endpoints/ipfs/ipfs_endpoints.rb', line 47

def pin_an_object(ipfs_path)
  Request.post_request_raw("#{@url}/ipfs/pin/add/#{ipfs_path}", @project_id)
end

#remove_pinned_object(ipfs_path) ⇒ Hash

Calls post request on (@url)/ipfs//pin/remove/(ipfs_path)

Parameters:

  • ipfs_path (String) —

    will be added to the url for get request.

Returns:

  • (Hash) —

    formatted result with status and body keys.



55
56
57
# File 'lib/blockfrostruby/endpoints/ipfs/ipfs_endpoints.rb', line 55

def remove_pinned_object(ipfs_path)
  Request.post_request_raw("#{@url}/ipfs/pin/remove/#{ipfs_path}", @project_id)
end