Skip to content

Commit

Permalink
Merge pull request #24 from lacepool/add_extended_adress_info_endpoint
Browse files Browse the repository at this point in the history
add endpoint for extended address info
  • Loading branch information
robinboening authored Jan 5, 2024
2 parents 6ef8747 + baee119 commit debe8a5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/blockfrostruby/endpoints/cardano/addresses_endpoints.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ def get_specific_address(address)
Request.get_response("#{@url}/addresses/#{address}", @project_id)
end

# Calls get request on (@url)/addresses/(address)/extended.
#
# @param address [String] will be added to the url for get request.
# @return [Hash] formatted result with status and body keys.
def get_extended_address_info(address)
Request.get_response("#{@url}/addresses/#{address}/extended", @project_id)
end

# Calls get request on (@url)/addresses/(address)/total.
#
# @param address [String] will be added to the url for get request.
Expand Down
22 changes: 22 additions & 0 deletions spec/endpoints/addresses_endpoints_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,28 @@
end
end

context 'when calls get_extended_address_info method' do
context 'with valid address' do
it 'returns status 200, response body includes address, amount, stake_address, type, script' do
response = blockfrost_mainnet.get_extended_address_info(valid_address)
expect(response[:status]).to eq(200)
expect(response[:body]).to include(address: valid_address)
expect(response[:body]).to include(:amount)
expect(response[:body]).to include(:stake_address)
expect(response[:body]).to include(:type)
expect(response[:body]).to include(:script)
end
end

context 'with invalid address' do
it 'returns status 400, response body includes error' do
response = blockfrost_mainnet.get_extended_address_info(invalid_address)
expect(response[:status]).to eq(400)
expect(response[:body]).to include(:error)
end
end
end

context 'when calls get_address_details method' do
context 'with valid address' do
it 'returns status 200, response body includes address' do
Expand Down

0 comments on commit debe8a5

Please sign in to comment.